third-prestige-rolify 3.3.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.rdoc +157 -0
- data/Gemfile +21 -0
- data/LICENSE +20 -0
- data/README.md +220 -0
- data/Rakefile +34 -0
- data/UPGRADE.rdoc +44 -0
- data/gemfiles/Gemfile.rails-3.2 +21 -0
- data/gemfiles/Gemfile.rails-4.0 +27 -0
- data/lib/generators/active_record/rolify_generator.rb +50 -0
- data/lib/generators/active_record/templates/README +8 -0
- data/lib/generators/active_record/templates/migration.rb +19 -0
- data/lib/generators/mongoid/rolify_generator.rb +51 -0
- data/lib/generators/mongoid/templates/README-mongoid +4 -0
- data/lib/generators/rolify/rolify_generator.rb +35 -0
- data/lib/generators/rolify/templates/README +13 -0
- data/lib/generators/rolify/templates/initializer.rb +8 -0
- data/lib/generators/rolify/templates/role-active_record.rb +11 -0
- data/lib/generators/rolify/templates/role-mongoid.rb +17 -0
- data/lib/generators/rolify/user_generator.rb +39 -0
- data/lib/rolify.rb +57 -0
- data/lib/rolify/adapters/active_record/resource_adapter.rb +26 -0
- data/lib/rolify/adapters/active_record/role_adapter.rb +86 -0
- data/lib/rolify/adapters/active_record/scopes.rb +27 -0
- data/lib/rolify/adapters/base.rb +60 -0
- data/lib/rolify/adapters/mongoid/resource_adapter.rb +27 -0
- data/lib/rolify/adapters/mongoid/role_adapter.rb +89 -0
- data/lib/rolify/adapters/mongoid/scopes.rb +27 -0
- data/lib/rolify/configure.rb +56 -0
- data/lib/rolify/dynamic.rb +21 -0
- data/lib/rolify/finders.rb +40 -0
- data/lib/rolify/matchers.rb +13 -0
- data/lib/rolify/railtie.rb +20 -0
- data/lib/rolify/resource.rb +31 -0
- data/lib/rolify/role.rb +85 -0
- data/lib/rolify/utils.rb +10 -0
- data/lib/rolify/version.rb +3 -0
- data/rolify.gemspec +30 -0
- data/spec/README.rdoc +24 -0
- data/spec/generators/rolify/rolify_activerecord_generator_spec.rb +163 -0
- data/spec/generators/rolify/rolify_mongoid_generator_spec.rb +112 -0
- data/spec/generators_helper.rb +21 -0
- data/spec/rolify/config_spec.rb +191 -0
- data/spec/rolify/custom_spec.rb +20 -0
- data/spec/rolify/matchers_spec.rb +24 -0
- data/spec/rolify/namespace_spec.rb +24 -0
- data/spec/rolify/resource_spec.rb +389 -0
- data/spec/rolify/resourcifed_and_rolifed_spec.rb +24 -0
- data/spec/rolify/role_spec.rb +20 -0
- data/spec/rolify/shared_contexts.rb +92 -0
- data/spec/rolify/shared_examples/shared_examples_for_add_role.rb +92 -0
- data/spec/rolify/shared_examples/shared_examples_for_callbacks.rb +65 -0
- data/spec/rolify/shared_examples/shared_examples_for_dynamic.rb +151 -0
- data/spec/rolify/shared_examples/shared_examples_for_finders.rb +77 -0
- data/spec/rolify/shared_examples/shared_examples_for_has_all_roles.rb +71 -0
- data/spec/rolify/shared_examples/shared_examples_for_has_any_role.rb +71 -0
- data/spec/rolify/shared_examples/shared_examples_for_has_role.rb +135 -0
- data/spec/rolify/shared_examples/shared_examples_for_only_has_role.rb +174 -0
- data/spec/rolify/shared_examples/shared_examples_for_remove_role.rb +121 -0
- data/spec/rolify/shared_examples/shared_examples_for_roles.rb +102 -0
- data/spec/rolify/shared_examples/shared_examples_for_scopes.rb +38 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/support/adapters/active_record.rb +76 -0
- data/spec/support/adapters/mongoid.rb +143 -0
- data/spec/support/adapters/mongoid.yml +6 -0
- data/spec/support/data.rb +25 -0
- data/spec/support/schema.rb +52 -0
- metadata +254 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
# Users
|
2
|
+
[ User, Customer, Admin::Moderator ].each do |user|
|
3
|
+
user.destroy_all
|
4
|
+
|
5
|
+
user.create(:login => "admin")
|
6
|
+
user.create(:login => "moderator")
|
7
|
+
user.create(:login => "god")
|
8
|
+
user.create(:login => "zombie")
|
9
|
+
end
|
10
|
+
|
11
|
+
# Roles
|
12
|
+
[ Role, Privilege, Admin::Right ].each do |role|
|
13
|
+
role.destroy_all
|
14
|
+
end
|
15
|
+
|
16
|
+
# Resources
|
17
|
+
Forum.create(:name => "forum 1")
|
18
|
+
Forum.create(:name => "forum 2")
|
19
|
+
Forum.create(:name => "forum 3")
|
20
|
+
|
21
|
+
Group.create(:name => "group 1")
|
22
|
+
Group.create(:name => "group 2")
|
23
|
+
|
24
|
+
Team.create(:team_code => "1", :name => "PSG")
|
25
|
+
Team.create(:team_code => "2", :name => "MU")
|
@@ -0,0 +1,52 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
self.verbose = false
|
3
|
+
|
4
|
+
[ :roles, :privileges, :admin_rights ].each do |table|
|
5
|
+
create_table(table) do |t|
|
6
|
+
t.string :name
|
7
|
+
t.references :resource, :polymorphic => true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
[ :users, :human_resources, :customers, :admin_moderators ].each do |table|
|
14
|
+
create_table(table) do |t|
|
15
|
+
t.string :login
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table(:users_roles, :id => false) do |t|
|
20
|
+
t.references :user
|
21
|
+
t.references :role
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table(:human_resources_roles, :id => false) do |t|
|
25
|
+
t.references :human_resource
|
26
|
+
t.references :role
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table(:customers_privileges, :id => false) do |t|
|
30
|
+
t.references :customer
|
31
|
+
t.references :privilege
|
32
|
+
end
|
33
|
+
|
34
|
+
create_table(:moderators_rights, :id => false) do |t|
|
35
|
+
t.references :moderator
|
36
|
+
t.references :right
|
37
|
+
end
|
38
|
+
|
39
|
+
create_table(:forums) do |t|
|
40
|
+
t.string :name
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table(:groups) do |t|
|
44
|
+
t.integer :parent_id
|
45
|
+
t.string :name
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table(:teams, :id => false) do |t|
|
49
|
+
t.primary_key :team_code
|
50
|
+
t.string :name
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,254 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: third-prestige-rolify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.3.0.rc5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Florent Monbillard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ammeter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fuubar
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.2.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.2.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mongoid
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.1'
|
125
|
+
description: Very simple Roles library without any authorization enforcement supporting
|
126
|
+
scope on resource objects (instance or class). Supports ActiveRecord and Mongoid
|
127
|
+
ORMs.
|
128
|
+
email:
|
129
|
+
- f.monbillard@gmail.com
|
130
|
+
executables: []
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- .travis.yml
|
136
|
+
- CHANGELOG.rdoc
|
137
|
+
- Gemfile
|
138
|
+
- LICENSE
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- UPGRADE.rdoc
|
142
|
+
- gemfiles/Gemfile.rails-3.2
|
143
|
+
- gemfiles/Gemfile.rails-4.0
|
144
|
+
- lib/generators/active_record/rolify_generator.rb
|
145
|
+
- lib/generators/active_record/templates/README
|
146
|
+
- lib/generators/active_record/templates/migration.rb
|
147
|
+
- lib/generators/mongoid/rolify_generator.rb
|
148
|
+
- lib/generators/mongoid/templates/README-mongoid
|
149
|
+
- lib/generators/rolify/rolify_generator.rb
|
150
|
+
- lib/generators/rolify/templates/README
|
151
|
+
- lib/generators/rolify/templates/initializer.rb
|
152
|
+
- lib/generators/rolify/templates/role-active_record.rb
|
153
|
+
- lib/generators/rolify/templates/role-mongoid.rb
|
154
|
+
- lib/generators/rolify/user_generator.rb
|
155
|
+
- lib/rolify.rb
|
156
|
+
- lib/rolify/adapters/active_record/resource_adapter.rb
|
157
|
+
- lib/rolify/adapters/active_record/role_adapter.rb
|
158
|
+
- lib/rolify/adapters/active_record/scopes.rb
|
159
|
+
- lib/rolify/adapters/base.rb
|
160
|
+
- lib/rolify/adapters/mongoid/resource_adapter.rb
|
161
|
+
- lib/rolify/adapters/mongoid/role_adapter.rb
|
162
|
+
- lib/rolify/adapters/mongoid/scopes.rb
|
163
|
+
- lib/rolify/configure.rb
|
164
|
+
- lib/rolify/dynamic.rb
|
165
|
+
- lib/rolify/finders.rb
|
166
|
+
- lib/rolify/matchers.rb
|
167
|
+
- lib/rolify/railtie.rb
|
168
|
+
- lib/rolify/resource.rb
|
169
|
+
- lib/rolify/role.rb
|
170
|
+
- lib/rolify/utils.rb
|
171
|
+
- lib/rolify/version.rb
|
172
|
+
- rolify.gemspec
|
173
|
+
- spec/README.rdoc
|
174
|
+
- spec/generators/rolify/rolify_activerecord_generator_spec.rb
|
175
|
+
- spec/generators/rolify/rolify_mongoid_generator_spec.rb
|
176
|
+
- spec/generators_helper.rb
|
177
|
+
- spec/rolify/config_spec.rb
|
178
|
+
- spec/rolify/custom_spec.rb
|
179
|
+
- spec/rolify/matchers_spec.rb
|
180
|
+
- spec/rolify/namespace_spec.rb
|
181
|
+
- spec/rolify/resource_spec.rb
|
182
|
+
- spec/rolify/resourcifed_and_rolifed_spec.rb
|
183
|
+
- spec/rolify/role_spec.rb
|
184
|
+
- spec/rolify/shared_contexts.rb
|
185
|
+
- spec/rolify/shared_examples/shared_examples_for_add_role.rb
|
186
|
+
- spec/rolify/shared_examples/shared_examples_for_callbacks.rb
|
187
|
+
- spec/rolify/shared_examples/shared_examples_for_dynamic.rb
|
188
|
+
- spec/rolify/shared_examples/shared_examples_for_finders.rb
|
189
|
+
- spec/rolify/shared_examples/shared_examples_for_has_all_roles.rb
|
190
|
+
- spec/rolify/shared_examples/shared_examples_for_has_any_role.rb
|
191
|
+
- spec/rolify/shared_examples/shared_examples_for_has_role.rb
|
192
|
+
- spec/rolify/shared_examples/shared_examples_for_only_has_role.rb
|
193
|
+
- spec/rolify/shared_examples/shared_examples_for_remove_role.rb
|
194
|
+
- spec/rolify/shared_examples/shared_examples_for_roles.rb
|
195
|
+
- spec/rolify/shared_examples/shared_examples_for_scopes.rb
|
196
|
+
- spec/spec_helper.rb
|
197
|
+
- spec/support/adapters/active_record.rb
|
198
|
+
- spec/support/adapters/mongoid.rb
|
199
|
+
- spec/support/adapters/mongoid.yml
|
200
|
+
- spec/support/data.rb
|
201
|
+
- spec/support/schema.rb
|
202
|
+
homepage: http://github.com/thirdprestige/rolify/
|
203
|
+
licenses: []
|
204
|
+
metadata: {}
|
205
|
+
post_install_message:
|
206
|
+
rdoc_options: []
|
207
|
+
require_paths:
|
208
|
+
- lib
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - '>'
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.3.1
|
219
|
+
requirements: []
|
220
|
+
rubyforge_project: third-prestige-rolify
|
221
|
+
rubygems_version: 2.0.3
|
222
|
+
signing_key:
|
223
|
+
specification_version: 4
|
224
|
+
summary: Roles library with resource scoping
|
225
|
+
test_files:
|
226
|
+
- spec/README.rdoc
|
227
|
+
- spec/generators/rolify/rolify_activerecord_generator_spec.rb
|
228
|
+
- spec/generators/rolify/rolify_mongoid_generator_spec.rb
|
229
|
+
- spec/generators_helper.rb
|
230
|
+
- spec/rolify/config_spec.rb
|
231
|
+
- spec/rolify/custom_spec.rb
|
232
|
+
- spec/rolify/matchers_spec.rb
|
233
|
+
- spec/rolify/namespace_spec.rb
|
234
|
+
- spec/rolify/resource_spec.rb
|
235
|
+
- spec/rolify/resourcifed_and_rolifed_spec.rb
|
236
|
+
- spec/rolify/role_spec.rb
|
237
|
+
- spec/rolify/shared_contexts.rb
|
238
|
+
- spec/rolify/shared_examples/shared_examples_for_add_role.rb
|
239
|
+
- spec/rolify/shared_examples/shared_examples_for_callbacks.rb
|
240
|
+
- spec/rolify/shared_examples/shared_examples_for_dynamic.rb
|
241
|
+
- spec/rolify/shared_examples/shared_examples_for_finders.rb
|
242
|
+
- spec/rolify/shared_examples/shared_examples_for_has_all_roles.rb
|
243
|
+
- spec/rolify/shared_examples/shared_examples_for_has_any_role.rb
|
244
|
+
- spec/rolify/shared_examples/shared_examples_for_has_role.rb
|
245
|
+
- spec/rolify/shared_examples/shared_examples_for_only_has_role.rb
|
246
|
+
- spec/rolify/shared_examples/shared_examples_for_remove_role.rb
|
247
|
+
- spec/rolify/shared_examples/shared_examples_for_roles.rb
|
248
|
+
- spec/rolify/shared_examples/shared_examples_for_scopes.rb
|
249
|
+
- spec/spec_helper.rb
|
250
|
+
- spec/support/adapters/active_record.rb
|
251
|
+
- spec/support/adapters/mongoid.rb
|
252
|
+
- spec/support/adapters/mongoid.yml
|
253
|
+
- spec/support/data.rb
|
254
|
+
- spec/support/schema.rb
|