roles_mongoid_zhd 0.4.8 → 0.4.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +5 -5
- data/VERSION +1 -1
- data/lib/roles_mongoid/base.rb +2 -2
- data/lib/roles_mongoid/strategy/multi.rb +1 -1
- data/lib/roles_mongoid/strategy/multi/embed_many_roles.rb +1 -1
- data/lib/roles_mongoid/strategy/multi/many_roles.rb +1 -1
- data/lib/roles_mongoid/strategy/multi/role_strings.rb +1 -1
- data/lib/roles_mongoid/strategy/multi/roles_mask.rb +1 -1
- data/lib/roles_mongoid/strategy/shared.rb +1 -1
- data/lib/roles_mongoid/strategy/single.rb +1 -1
- data/lib/roles_mongoid/strategy/single/admin_flag.rb +1 -1
- data/lib/roles_mongoid/strategy/single/embed_one_role.rb +1 -1
- data/lib/roles_mongoid/strategy/single/one_role.rb +1 -1
- data/lib/roles_mongoid/strategy/single/role_string.rb +1 -1
- data/roles_mongoid.gemspec +1 -1
- data/spec/roles_mongoid/generators/roles_generator_spec.rb +2 -2
- data/spec/roles_mongoid/strategy/multi/embed_many_roles_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/multi/many_roles_old_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/multi/many_roles_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/multi/role_strings_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/multi/roles_mask_spec.rb +1 -19
- data/spec/roles_mongoid/strategy/single/admin_flag_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/single/embed_one_role_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/single/one_role_spec.rb +1 -1
- data/spec/roles_mongoid/strategy/single/role_string_spec.rb +1 -1
- data/tmp/rails/app/models/user.rb +1 -1
- metadata +3 -2
data/README.textile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
h1.
|
1
|
+
h1. Fork Info
|
2
2
|
|
3
3
|
Update Mongoid to 2.0.2 support.
|
4
4
|
|
@@ -30,13 +30,13 @@ Embedded Role
|
|
30
30
|
|
31
31
|
h2. Install
|
32
32
|
|
33
|
-
<code>gem install
|
33
|
+
<code>gem install roles_mongoid_zhd</code>
|
34
34
|
|
35
35
|
h3. Install in Rails app
|
36
36
|
|
37
37
|
Insert in Gemfile:
|
38
38
|
|
39
|
-
<code>gem '
|
39
|
+
<code>gem 'roles_mongoid_zhd'</code>
|
40
40
|
|
41
41
|
Run <code>$ bundle install</code> from terminal
|
42
42
|
|
@@ -48,7 +48,7 @@ Example: _role_string_ strategy
|
|
48
48
|
|
49
49
|
<pre>class User
|
50
50
|
include Mongoid::Document
|
51
|
-
include Roles
|
51
|
+
include Mongoid::Roles
|
52
52
|
|
53
53
|
strategy :one_role
|
54
54
|
valid_roles_are :admin, :guest, :user
|
@@ -59,7 +59,7 @@ Example: _one_role_ strategy
|
|
59
59
|
|
60
60
|
<pre>class User
|
61
61
|
include Mongoid::Document
|
62
|
-
include Roles
|
62
|
+
include Mongoid::Roles
|
63
63
|
|
64
64
|
strategy :one_role
|
65
65
|
valid_roles_are :admin, :guest, :user
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.8.1
|
data/lib/roles_mongoid/base.rb
CHANGED
@@ -30,7 +30,7 @@ module RoleStrategy::Mongoid
|
|
30
30
|
end
|
31
31
|
|
32
32
|
module Implementation
|
33
|
-
include Roles::
|
33
|
+
include Mongoid::Roles::Strategy::Multi
|
34
34
|
|
35
35
|
def set_role role
|
36
36
|
raise ArgumentError, "#set_role only takes a single role as argument, not #{role}" if role.kind_of?(Array)
|
@@ -34,7 +34,7 @@ module RoleStrategy::Mongoid
|
|
34
34
|
end
|
35
35
|
|
36
36
|
module Implementation
|
37
|
-
include Roles::
|
37
|
+
include Mongoid::Roles::Strategy::Single
|
38
38
|
|
39
39
|
def set_role role
|
40
40
|
raise ArgumentError, "#set_role only takes a single role as argument, not #{role}" if role.kind_of?(Array)
|
data/roles_mongoid.gemspec
CHANGED
@@ -32,7 +32,7 @@ describe 'role strategy generator: admin_flag' do
|
|
32
32
|
g.run_generator arguments.args
|
33
33
|
root_dir.should have_model_file :user do |clazz|
|
34
34
|
clazz.should include_module 'Mongoid::Document'
|
35
|
-
clazz.should include_module 'Roles
|
35
|
+
clazz.should include_module 'Mongoid::Roles'
|
36
36
|
puts "clazz: #{clazz}"
|
37
37
|
clazz.should have_call :valid_roles_are, :args => ':admin, :guest, :user'
|
38
38
|
clazz.should have_call :strategy, :args => ":admin_flag"
|
@@ -55,7 +55,7 @@ describe 'role strategy generator: admin_flag' do
|
|
55
55
|
|
56
56
|
root_dir.should have_model_file :user do |clazz|
|
57
57
|
clazz.should include_module 'Mongoid::Document'
|
58
|
-
clazz.should include_module 'Roles
|
58
|
+
clazz.should include_module 'Mongoid::Roles'
|
59
59
|
puts "clazz: #{clazz}"
|
60
60
|
clazz.should have_call :valid_roles_are, :args => ':admin, :guest, :user'
|
61
61
|
clazz.should have_call :strategy, :args => ":one_role"
|
@@ -4,7 +4,7 @@ use_roles_strategy :roles_mask
|
|
4
4
|
|
5
5
|
class User
|
6
6
|
include Mongoid::Document
|
7
|
-
include Roles
|
7
|
+
include Mongoid::Roles
|
8
8
|
|
9
9
|
strategy :roles_mask
|
10
10
|
valid_roles_are :admin, :guest, :user
|
@@ -18,21 +18,3 @@ load 'roles_mongoid/strategy/api_examples.rb'
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
# require 'spec_helper'
|
22
|
-
# use_roles_strategy :roles_mask
|
23
|
-
#
|
24
|
-
# class User
|
25
|
-
# include Mongoid::Document
|
26
|
-
# include Roles::Mongoid
|
27
|
-
#
|
28
|
-
# strategy :roles_mask, :default
|
29
|
-
# valid_roles_are :admin, :guest
|
30
|
-
#
|
31
|
-
# field :name, :type => String
|
32
|
-
# end
|
33
|
-
#
|
34
|
-
# describe "Roles for Mongoid: :roles_mask strategy" do
|
35
|
-
# load "roles_mongoid/user_setup"
|
36
|
-
# load "roles_generic/rspec/api"
|
37
|
-
# end
|
38
|
-
#
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roles_mongoid_zhd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 77
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
9
|
- 8
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 0.4.8.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- ZhangHanDong
|