rollenspiel 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/rollenspiel/role.rb +14 -0
- data/app/models/rollenspiel/role_grant.rb +0 -17
- data/app/models/rollenspiel/role_grantee.rb +5 -0
- data/app/models/rollenspiel/role_provider.rb +0 -4
- data/app/models/rollenspiel/role_provider/role_builder.rb +0 -4
- data/app/models/rollenspiel/role_provider/role_structure.rb +1 -8
- data/db/migrate/20150101000000_create_rollenspiel.rb +3 -4
- data/lib/rollenspiel.rb +4 -4
- data/lib/rollenspiel/version.rb +1 -1
- data/test/dummy/app/models/test_department.rb +1 -1
- data/test/dummy/app/models/test_organization.rb +2 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +1 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +114 -0
- data/test/dummy/log/test.log +9299 -0
- data/test/models/rollenspiel/role_test.rb +21 -1
- metadata +35 -36
- data/app/models/rollenspiel/role_provider/role_callback.rb +0 -28
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
module Rollenspiel
|
4
4
|
class RoleTest < ActiveSupport::TestCase
|
5
5
|
test "creates and inherits" do
|
6
|
-
r =
|
6
|
+
r = Role.create! name: 'manager'
|
7
7
|
r.inherit! Role.new(name: 'read')
|
8
8
|
|
9
9
|
assert r.inherited? 'read'
|
@@ -16,5 +16,25 @@ module Rollenspiel
|
|
16
16
|
o = TestOrganization.create!
|
17
17
|
assert o.role(:read).provider
|
18
18
|
end
|
19
|
+
|
20
|
+
test "destroys when inherited to role is destroyed" do
|
21
|
+
r1 = Role.create! name: "one"
|
22
|
+
r2 = Role.create!(name: "two")
|
23
|
+
r1.inherit! r2
|
24
|
+
|
25
|
+
assert_difference("RoleInheritance.count", -1) do
|
26
|
+
r1.destroy!
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
test "destroys when inherited from role is destroyed" do
|
31
|
+
r1 = Role.create! name: "one"
|
32
|
+
r2 = Role.create!(name: "two")
|
33
|
+
r1.inherit! r2
|
34
|
+
|
35
|
+
assert_difference("RoleInheritance.count", -1) do
|
36
|
+
r2.destroy!
|
37
|
+
end
|
38
|
+
end
|
19
39
|
end
|
20
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollenspiel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Bissinger
|
@@ -14,42 +14,42 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Rails engine for role management for ActiveRecord. Supports scoping and
|
@@ -60,6 +60,8 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- MIT-LICENSE
|
64
|
+
- Rakefile
|
63
65
|
- app/assets/javascripts/rollenspiel/application.js
|
64
66
|
- app/assets/javascripts/rollenspiel/roles.js
|
65
67
|
- app/assets/stylesheets/rollenspiel/application.css
|
@@ -71,19 +73,18 @@ files:
|
|
71
73
|
- app/models/rollenspiel/role_grant.rb
|
72
74
|
- app/models/rollenspiel/role_grantee.rb
|
73
75
|
- app/models/rollenspiel/role_inheritance.rb
|
76
|
+
- app/models/rollenspiel/role_provider.rb
|
74
77
|
- app/models/rollenspiel/role_provider/role_builder.rb
|
75
|
-
- app/models/rollenspiel/role_provider/role_callback.rb
|
76
78
|
- app/models/rollenspiel/role_provider/role_structure.rb
|
77
|
-
- app/models/rollenspiel/role_provider.rb
|
78
79
|
- app/views/layouts/rollenspiel/application.html.erb
|
79
80
|
- config/routes.rb
|
80
81
|
- db/migrate/20150101000000_create_rollenspiel.rb
|
82
|
+
- lib/rollenspiel.rb
|
81
83
|
- lib/rollenspiel/engine.rb
|
82
84
|
- lib/rollenspiel/version.rb
|
83
|
-
- lib/rollenspiel.rb
|
84
85
|
- lib/tasks/rollenspiel_tasks.rake
|
85
|
-
-
|
86
|
-
- Rakefile
|
86
|
+
- test/dummy/README.rdoc
|
87
|
+
- test/dummy/Rakefile
|
87
88
|
- test/dummy/app/assets/javascripts/application.js
|
88
89
|
- test/dummy/app/assets/stylesheets/application.css
|
89
90
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -96,6 +97,7 @@ files:
|
|
96
97
|
- test/dummy/bin/rails
|
97
98
|
- test/dummy/bin/rake
|
98
99
|
- test/dummy/bin/setup
|
100
|
+
- test/dummy/config.ru
|
99
101
|
- test/dummy/config/application.rb
|
100
102
|
- test/dummy/config/boot.rb
|
101
103
|
- test/dummy/config/database.yml
|
@@ -114,7 +116,6 @@ files:
|
|
114
116
|
- test/dummy/config/locales/en.yml
|
115
117
|
- test/dummy/config/routes.rb
|
116
118
|
- test/dummy/config/secrets.yml
|
117
|
-
- test/dummy/config.ru
|
118
119
|
- test/dummy/db/development.sqlite3
|
119
120
|
- test/dummy/db/migrate/20140101000000_create_test_organizations.rb
|
120
121
|
- test/dummy/db/migrate/20140101000001_create_test_departments.rb
|
@@ -127,8 +128,6 @@ files:
|
|
127
128
|
- test/dummy/public/422.html
|
128
129
|
- test/dummy/public/500.html
|
129
130
|
- test/dummy/public/favicon.ico
|
130
|
-
- test/dummy/Rakefile
|
131
|
-
- test/dummy/README.rdoc
|
132
131
|
- test/dummy/test/fixtures/test_departments.yml
|
133
132
|
- test/dummy/test/fixtures/test_organizations.yml
|
134
133
|
- test/dummy/test/fixtures/test_users.yml
|
@@ -140,42 +139,42 @@ files:
|
|
140
139
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/4KoHNnd0srVcZDM2qvUv-2R8ZJhYRp6S9pnQl-9XFSQ.cache
|
141
140
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/4xqeSsWQoM_togOvhZvTvIBwDPLRkea_UHXXoXJGjno.cache
|
142
141
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/8AnnxzlvFqY6eM0139-Bl742fXrZSh5C7uN0BdM7KMA.cache
|
143
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/_Zi-iE18hxVpJ6VE-kNgKaoY1IpTqnjnCXh6uSLaq_4.cache
|
144
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/a0OQZvG0vdPraTeOZPNqOYPY3MDg9bmBMDH6Ue_YJwg.cache
|
145
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/AhdR-QatDyVJabzNmk9wjWLsRkO4ftWICMFPN3-4YBE.cache
|
146
142
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/AKQyyWKDhOtqZ8JSvqkQIPxuRuIAK4XupMQkFaaNzro.cache
|
147
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/
|
148
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/cdoQw4jMrNQ2iCjbdEoCMQAsNDxYwq4-NNgq1wpt_TY.cache
|
149
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/dIzM65yploWcEDKSOhiO7uElWjebFFAruHUWeiI_Bpw.cache
|
143
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/AhdR-QatDyVJabzNmk9wjWLsRkO4ftWICMFPN3-4YBE.cache
|
150
144
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/E99_7rcxzVS-S0iUG3JF9GuVP8PIvyD2xld-H--2IV0.cache
|
151
145
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/EJJC5pngTESQOa5n2IHVSLXVIzMacWbTYAnGu7_w044.cache
|
152
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/ePc81mhC4IDkbmtFsavJJ4d1KBs5JTSV6siK03J1i7M.cache
|
153
146
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/ExcdBwTofL3eAKB1EFOefu69YTn2RvU6STyvHfuqMdo.cache
|
154
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/eZvTuIRbohD2dTVrrG7WzyiW4EsdL7Y3ascivXDg-uk.cache
|
155
147
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/FSpZ649yw7hwU46YFDz_K8Js84QQoLOZAjgSZPKLuZ0.cache
|
156
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/hY95Dc8LPvwLFzl_Ai4UzQzOYP_dhLLXdowieAfdyQo.cache
|
157
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/idU09QLKLgPg1CGNmN38X2HThWUNngCHUUF03QDIecw.cache
|
158
148
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/J5Fp6sNdGIKuasBo_x8iBJDpkjoUCwA8wVPyMcHB_kE.cache
|
159
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/jNbVBmCum-qbnYBY515sB_YwbwcPl9fGeQ98d8hXSh0.cache
|
160
149
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/K9XNZ-CpA7qM3s_jBR51G4MHnJr2By13VJrbiceBEyM.cache
|
161
150
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/L1zP9jdez10yB6zMnTRAG2n8MsM3WzAmTHuRYwbEdQ4.cache
|
162
151
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/L6MQZMxvSxkJit4rcj3tDNyT4BsU-IfG5xFxR9eyO10.cache
|
163
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/m5QS13lCjZoRBoS09s7T56MFVvCS48M39XNpOifBzwE.cache
|
164
152
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/M6U9KTkftE4ymlej_zhyE3XIpyTXYwmw4dZyiU088hM.cache
|
165
153
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/MUtU6zUC1yHAenhHN-v73PomWUB7ec9adkQApfd2vSI.cache
|
166
154
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/OtexTHbGR4EyooNQJJM6NIPTdnv08PkyUDsaa4OtIEE.cache
|
167
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/p7rAAHIbe8WJWOESJ7ZbnMf0AmDgXOYZC0z2Xm6S3I4.cache
|
168
155
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/R85rKYcNL9hT4GOpkgAoH41jsh-wtFHgsn_jU8wNFjY.cache
|
169
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/uDstL5Rsh_AH44z6izMdw-GUgc3lntEfgRxlPwIrvb4.cache
|
170
156
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/UjnyuM3_07mUHvzA2NnkAHvMR_rVr6gxtVZQo2USiIE.cache
|
171
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/ujpxHdfT_9N2rmiFQGlvtF_HUv1l8TRvaL-qeJOjko0.cache
|
172
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/v8weRQckvatemopqt_fTPn3s_sQAhpA1dawBtFLeCRM.cache
|
173
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/xoi13Tp0LZbQX71b_LijbX_8d93SSCU0E3I6qk6hbgI.cache
|
174
157
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/XoZ29pxTm-KmWSK-WEqBYEpFHhGEBcqteZKpKA3Bvzk.cache
|
175
158
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/YCvdjXcRnq2kjo_IwXCetxWchRJ8EPoyKxgbYlRRaE4.cache
|
176
|
-
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/Yg5O-8__19NXtsu36fPQmawND2of6uw-Cw8d6zM_AF8.cache
|
177
159
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/YTVA6f8ZlQ_hnnJFE7-rZFuFH8_3FW1c-osUol54TAw.cache
|
160
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/Yg5O-8__19NXtsu36fPQmawND2of6uw-Cw8d6zM_AF8.cache
|
178
161
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/YyFN0R7z8B8xa7tzGy9OtqnNt9iqXEWJM4fjrHJEtsA.cache
|
162
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/_Zi-iE18hxVpJ6VE-kNgKaoY1IpTqnjnCXh6uSLaq_4.cache
|
163
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/a0OQZvG0vdPraTeOZPNqOYPY3MDg9bmBMDH6Ue_YJwg.cache
|
164
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/arnBM3FLKdGEg64Tc9aFtg6qIcJn901JX2-WYfG3L-Q.cache
|
165
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/cdoQw4jMrNQ2iCjbdEoCMQAsNDxYwq4-NNgq1wpt_TY.cache
|
166
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/dIzM65yploWcEDKSOhiO7uElWjebFFAruHUWeiI_Bpw.cache
|
167
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/ePc81mhC4IDkbmtFsavJJ4d1KBs5JTSV6siK03J1i7M.cache
|
168
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/eZvTuIRbohD2dTVrrG7WzyiW4EsdL7Y3ascivXDg-uk.cache
|
169
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/hY95Dc8LPvwLFzl_Ai4UzQzOYP_dhLLXdowieAfdyQo.cache
|
170
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/idU09QLKLgPg1CGNmN38X2HThWUNngCHUUF03QDIecw.cache
|
171
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/jNbVBmCum-qbnYBY515sB_YwbwcPl9fGeQ98d8hXSh0.cache
|
172
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/m5QS13lCjZoRBoS09s7T56MFVvCS48M39XNpOifBzwE.cache
|
173
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/p7rAAHIbe8WJWOESJ7ZbnMf0AmDgXOYZC0z2Xm6S3I4.cache
|
174
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/uDstL5Rsh_AH44z6izMdw-GUgc3lntEfgRxlPwIrvb4.cache
|
175
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/ujpxHdfT_9N2rmiFQGlvtF_HUv1l8TRvaL-qeJOjko0.cache
|
176
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/v8weRQckvatemopqt_fTPn3s_sQAhpA1dawBtFLeCRM.cache
|
177
|
+
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/xoi13Tp0LZbQX71b_LijbX_8d93SSCU0E3I6qk6hbgI.cache
|
179
178
|
- test/dummy/tmp/cache/assets/development/sprockets/v3.0/zUZwt19D-sgLbqC_Ewb6PrjxuylihJ_pXypGPWMHk70.cache
|
180
179
|
- test/fixtures/rollenspiel/roles.yml
|
181
180
|
- test/integration/navigation_test.rb
|
@@ -198,17 +197,17 @@ require_paths:
|
|
198
197
|
- lib
|
199
198
|
required_ruby_version: !ruby/object:Gem::Requirement
|
200
199
|
requirements:
|
201
|
-
- -
|
200
|
+
- - ">="
|
202
201
|
- !ruby/object:Gem::Version
|
203
202
|
version: '0'
|
204
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
204
|
requirements:
|
206
|
-
- -
|
205
|
+
- - ">="
|
207
206
|
- !ruby/object:Gem::Version
|
208
207
|
version: '0'
|
209
208
|
requirements: []
|
210
209
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.4.5
|
212
211
|
signing_key:
|
213
212
|
specification_version: 4
|
214
213
|
summary: Role management for Rails 4.2 / ActiveRecord. Supports scoping and inheritance.
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Rollenspiel
|
2
|
-
module RoleProvider
|
3
|
-
class RoleCallback
|
4
|
-
attr_reader :role_name, :provider_type
|
5
|
-
|
6
|
-
def initialize block
|
7
|
-
@block = block
|
8
|
-
end
|
9
|
-
|
10
|
-
def scope_to_role role
|
11
|
-
@role_name = role.name.try(:to_s)
|
12
|
-
@provider_type = role.provider_type
|
13
|
-
end
|
14
|
-
|
15
|
-
def matches? role
|
16
|
-
@role_name == role.name && @provider_type == role.provider_type
|
17
|
-
end
|
18
|
-
|
19
|
-
def apply thing
|
20
|
-
@block.call(thing)
|
21
|
-
end
|
22
|
-
|
23
|
-
def ==other
|
24
|
-
role_name == other.role_name && provider_type == other.provider_type
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|