controlist 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock.3.2 +106 -0
- data/Gemfile.lock.4.1 +84 -0
- data/Gemfile.lock.4.2 +101 -0
- data/LICENSE.txt +22 -0
- data/README.md +96 -0
- data/Rakefile +8 -0
- data/controlist.gemspec +42 -0
- data/lib/controlist/errors.rb +26 -0
- data/lib/controlist/interceptor.rb +193 -0
- data/lib/controlist/managers/base_manager.rb +31 -0
- data/lib/controlist/managers/thread_based_manager.rb +32 -0
- data/lib/controlist/permission.rb +209 -0
- data/lib/controlist/permissions/advanced_constrain.rb +24 -0
- data/lib/controlist/permissions/constrain.rb +10 -0
- data/lib/controlist/permissions/operation.rb +32 -0
- data/lib/controlist/permissions/ordered_package.rb +56 -0
- data/lib/controlist/permissions/simple_constrain.rb +16 -0
- data/lib/controlist/version.rb +3 -0
- data/lib/controlist.rb +32 -0
- data/test/feature_test.rb +233 -0
- data/test/fixtures/clazz.yml +6 -0
- data/test/fixtures/user.yml +25 -0
- data/test/migrate.rb +20 -0
- data/test/models/clazz.rb +5 -0
- data/test/models/user.rb +5 -0
- data/test/test.sqlite3 +0 -0
- data/test/test_helper.rb +40 -0
- metadata +208 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0fe714a3aad4e99f1f5939eaeb793a6b61c485cf
|
4
|
+
data.tar.gz: 99b51da4fc36bd7c17f92d3de8c4c0afbace75dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5791061e742d2fd3f2dd9ae8fdd3cbb7ef211cdf9ddd5689e36b51ff650dae29b6202371125994a8d32cb8be1c74c839fdb68855bafe0925279778960bce6afc
|
7
|
+
data.tar.gz: b9fbeedd4de2e2c92f01fd5fdc1b9e7171dc8977a7bcbf9a594a596001a78b4b6a28fee60b095985e3646340f8061f4be21b732d9a77e5fa4a424c6f46ab0e39
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock.3.2
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
controlist (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://ruby.taobao.org/
|
8
|
+
specs:
|
9
|
+
actionpack (3.2.22)
|
10
|
+
activemodel (= 3.2.22)
|
11
|
+
activesupport (= 3.2.22)
|
12
|
+
builder (~> 3.0.0)
|
13
|
+
erubis (~> 2.7.0)
|
14
|
+
journey (~> 1.0.4)
|
15
|
+
rack (~> 1.4.5)
|
16
|
+
rack-cache (~> 1.2)
|
17
|
+
rack-test (~> 0.6.1)
|
18
|
+
sprockets (~> 2.2.1)
|
19
|
+
activemodel (3.2.22)
|
20
|
+
activesupport (= 3.2.22)
|
21
|
+
builder (~> 3.0.0)
|
22
|
+
activerecord (3.2.22)
|
23
|
+
activemodel (= 3.2.22)
|
24
|
+
activesupport (= 3.2.22)
|
25
|
+
arel (~> 3.0.2)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activesupport (3.2.22)
|
28
|
+
i18n (~> 0.6, >= 0.6.4)
|
29
|
+
multi_json (~> 1.0)
|
30
|
+
ansi (1.5.0)
|
31
|
+
arel (3.0.3)
|
32
|
+
builder (3.0.4)
|
33
|
+
docile (1.1.5)
|
34
|
+
erubis (2.7.0)
|
35
|
+
hashie (3.4.2)
|
36
|
+
hike (1.2.3)
|
37
|
+
i18n (0.7.0)
|
38
|
+
journey (1.0.4)
|
39
|
+
json (1.8.3)
|
40
|
+
minitest (4.7.5)
|
41
|
+
minitest-rails (1.0.1)
|
42
|
+
minitest (~> 4.7)
|
43
|
+
minitest-test (~> 1.0)
|
44
|
+
railties (>= 3.0, < 4.1)
|
45
|
+
minitest-reporters (0.14.24)
|
46
|
+
ansi
|
47
|
+
builder
|
48
|
+
minitest (>= 2.12, < 5.0)
|
49
|
+
powerbar
|
50
|
+
minitest-test (1.1.0)
|
51
|
+
minitest (~> 4.0)
|
52
|
+
multi_json (1.11.1)
|
53
|
+
power_assert (0.2.3)
|
54
|
+
powerbar (1.0.12)
|
55
|
+
ansi (~> 1.5.0)
|
56
|
+
hashie (>= 1.1.0)
|
57
|
+
rack (1.4.7)
|
58
|
+
rack-cache (1.2)
|
59
|
+
rack (>= 0.4)
|
60
|
+
rack-ssl (1.3.4)
|
61
|
+
rack
|
62
|
+
rack-test (0.6.3)
|
63
|
+
rack (>= 1.0)
|
64
|
+
railties (3.2.22)
|
65
|
+
actionpack (= 3.2.22)
|
66
|
+
activesupport (= 3.2.22)
|
67
|
+
rack-ssl (~> 1.3.2)
|
68
|
+
rake (>= 0.8.7)
|
69
|
+
rdoc (~> 3.4)
|
70
|
+
thor (>= 0.14.6, < 2.0)
|
71
|
+
rake (10.4.2)
|
72
|
+
rdoc (3.12.2)
|
73
|
+
json (~> 1.4)
|
74
|
+
simplecov (0.10.0)
|
75
|
+
docile (~> 1.1.0)
|
76
|
+
json (~> 1.8)
|
77
|
+
simplecov-html (~> 0.10.0)
|
78
|
+
simplecov-html (0.10.0)
|
79
|
+
sprockets (2.2.3)
|
80
|
+
hike (~> 1.2)
|
81
|
+
multi_json (~> 1.0)
|
82
|
+
rack (~> 1.0)
|
83
|
+
tilt (~> 1.1, != 1.3.0)
|
84
|
+
sqlite3 (1.3.10)
|
85
|
+
test-unit (3.1.2)
|
86
|
+
power_assert
|
87
|
+
thor (0.19.1)
|
88
|
+
tilt (1.4.1)
|
89
|
+
tzinfo (0.3.44)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
activerecord (~> 3.2.1)
|
96
|
+
activesupport (~> 3.2.1)
|
97
|
+
minitest
|
98
|
+
minitest-rails
|
99
|
+
minitest-reporters
|
100
|
+
controlist!
|
101
|
+
simplecov (~> 0.10.0)
|
102
|
+
sqlite3 (~> 1.3.10)
|
103
|
+
test-unit
|
104
|
+
|
105
|
+
BUNDLED WITH
|
106
|
+
1.10.2
|
data/Gemfile.lock.4.1
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
controlist (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://ruby.taobao.org/
|
8
|
+
specs:
|
9
|
+
actionpack (4.1.12)
|
10
|
+
actionview (= 4.1.12)
|
11
|
+
activesupport (= 4.1.12)
|
12
|
+
rack (~> 1.5.2)
|
13
|
+
rack-test (~> 0.6.2)
|
14
|
+
actionview (4.1.12)
|
15
|
+
activesupport (= 4.1.12)
|
16
|
+
builder (~> 3.1)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
activemodel (4.1.12)
|
19
|
+
activesupport (= 4.1.12)
|
20
|
+
builder (~> 3.1)
|
21
|
+
activerecord (4.1.12)
|
22
|
+
activemodel (= 4.1.12)
|
23
|
+
activesupport (= 4.1.12)
|
24
|
+
arel (~> 5.0.0)
|
25
|
+
activesupport (4.1.12)
|
26
|
+
i18n (~> 0.6, >= 0.6.9)
|
27
|
+
json (~> 1.7, >= 1.7.7)
|
28
|
+
minitest (~> 5.1)
|
29
|
+
thread_safe (~> 0.1)
|
30
|
+
tzinfo (~> 1.1)
|
31
|
+
ansi (1.5.0)
|
32
|
+
arel (5.0.1.20140414130214)
|
33
|
+
builder (3.2.2)
|
34
|
+
docile (1.1.5)
|
35
|
+
erubis (2.7.0)
|
36
|
+
i18n (0.7.0)
|
37
|
+
json (1.8.3)
|
38
|
+
minitest (5.7.0)
|
39
|
+
minitest-rails (2.1.1)
|
40
|
+
minitest (~> 5.4)
|
41
|
+
railties (~> 4.1)
|
42
|
+
minitest-reporters (1.0.17)
|
43
|
+
ansi
|
44
|
+
builder
|
45
|
+
minitest (>= 5.0)
|
46
|
+
ruby-progressbar
|
47
|
+
rack (1.5.5)
|
48
|
+
rack-test (0.6.3)
|
49
|
+
rack (>= 1.0)
|
50
|
+
railties (4.1.12)
|
51
|
+
actionpack (= 4.1.12)
|
52
|
+
activesupport (= 4.1.12)
|
53
|
+
rake (>= 0.8.7)
|
54
|
+
thor (>= 0.18.1, < 2.0)
|
55
|
+
rake (10.4.2)
|
56
|
+
ruby-progressbar (1.7.5)
|
57
|
+
simplecov (0.10.0)
|
58
|
+
docile (~> 1.1.0)
|
59
|
+
json (~> 1.8)
|
60
|
+
simplecov-html (~> 0.10.0)
|
61
|
+
simplecov-html (0.10.0)
|
62
|
+
sqlite3 (1.3.10)
|
63
|
+
thor (0.19.1)
|
64
|
+
thread_safe (0.3.5)
|
65
|
+
tzinfo (1.2.2)
|
66
|
+
thread_safe (~> 0.1)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
ruby
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
activerecord (~> 4.1.1)
|
73
|
+
activesupport (~> 4.1.1)
|
74
|
+
bundler (~> 1.7)
|
75
|
+
minitest (~> 5.7.0)
|
76
|
+
minitest-rails (~> 2.1.1)
|
77
|
+
minitest-reporters (~> 1.0.17)
|
78
|
+
rake (~> 10.0)
|
79
|
+
controlist!
|
80
|
+
simplecov (~> 0.10.0)
|
81
|
+
sqlite3 (~> 1.3.10)
|
82
|
+
|
83
|
+
BUNDLED WITH
|
84
|
+
1.10.2
|
data/Gemfile.lock.4.2
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
controlist (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://ruby.taobao.org/
|
8
|
+
specs:
|
9
|
+
actionpack (4.2.3)
|
10
|
+
actionview (= 4.2.3)
|
11
|
+
activesupport (= 4.2.3)
|
12
|
+
rack (~> 1.6)
|
13
|
+
rack-test (~> 0.6.2)
|
14
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
15
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
+
actionview (4.2.3)
|
17
|
+
activesupport (= 4.2.3)
|
18
|
+
builder (~> 3.1)
|
19
|
+
erubis (~> 2.7.0)
|
20
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
21
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
22
|
+
activemodel (4.2.3)
|
23
|
+
activesupport (= 4.2.3)
|
24
|
+
builder (~> 3.1)
|
25
|
+
activerecord (4.2.3)
|
26
|
+
activemodel (= 4.2.3)
|
27
|
+
activesupport (= 4.2.3)
|
28
|
+
arel (~> 6.0)
|
29
|
+
activesupport (4.2.3)
|
30
|
+
i18n (~> 0.7)
|
31
|
+
json (~> 1.7, >= 1.7.7)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
34
|
+
tzinfo (~> 1.1)
|
35
|
+
ansi (1.5.0)
|
36
|
+
arel (6.0.0)
|
37
|
+
builder (3.2.2)
|
38
|
+
docile (1.1.5)
|
39
|
+
erubis (2.7.0)
|
40
|
+
i18n (0.7.0)
|
41
|
+
json (1.8.3)
|
42
|
+
loofah (2.0.2)
|
43
|
+
nokogiri (>= 1.5.9)
|
44
|
+
mini_portile (0.6.2)
|
45
|
+
minitest (5.7.0)
|
46
|
+
minitest-rails (2.1.1)
|
47
|
+
minitest (~> 5.4)
|
48
|
+
railties (~> 4.1)
|
49
|
+
minitest-reporters (1.0.17)
|
50
|
+
ansi
|
51
|
+
builder
|
52
|
+
minitest (>= 5.0)
|
53
|
+
ruby-progressbar
|
54
|
+
nokogiri (1.6.6.2)
|
55
|
+
mini_portile (~> 0.6.0)
|
56
|
+
rack (1.6.4)
|
57
|
+
rack-test (0.6.3)
|
58
|
+
rack (>= 1.0)
|
59
|
+
rails-deprecated_sanitizer (1.0.3)
|
60
|
+
activesupport (>= 4.2.0.alpha)
|
61
|
+
rails-dom-testing (1.0.6)
|
62
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
63
|
+
nokogiri (~> 1.6.0)
|
64
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
65
|
+
rails-html-sanitizer (1.0.2)
|
66
|
+
loofah (~> 2.0)
|
67
|
+
railties (4.2.3)
|
68
|
+
actionpack (= 4.2.3)
|
69
|
+
activesupport (= 4.2.3)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
thor (>= 0.18.1, < 2.0)
|
72
|
+
rake (10.4.2)
|
73
|
+
ruby-progressbar (1.7.5)
|
74
|
+
simplecov (0.10.0)
|
75
|
+
docile (~> 1.1.0)
|
76
|
+
json (~> 1.8)
|
77
|
+
simplecov-html (~> 0.10.0)
|
78
|
+
simplecov-html (0.10.0)
|
79
|
+
sqlite3 (1.3.10)
|
80
|
+
thor (0.19.1)
|
81
|
+
thread_safe (0.3.5)
|
82
|
+
tzinfo (1.2.2)
|
83
|
+
thread_safe (~> 0.1)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
activerecord (~> 4.2.1)
|
90
|
+
activesupport (~> 4.2.1)
|
91
|
+
bundler (~> 1.7)
|
92
|
+
minitest (~> 5.7.0)
|
93
|
+
minitest-rails (~> 2.1.1)
|
94
|
+
minitest-reporters (~> 1.0.17)
|
95
|
+
rake (~> 10.0)
|
96
|
+
controlist!
|
97
|
+
simplecov (~> 0.10.0)
|
98
|
+
sqlite3 (~> 1.3.10)
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.10.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 ALO7 Inc.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Controlist
|
2
|
+
|
3
|
+
## Fine-grained access control library for Ruby ActiveRecord
|
4
|
+
|
5
|
+
Controlist support Ruby 1.9 and 2.x, ActiveRecord 3.2 and 4.1+
|
6
|
+
|
7
|
+
## Use Case
|
8
|
+
|
9
|
+
RBAC (Role-Based Access Control)
|
10
|
+
Security for API Server
|
11
|
+
Any scenario that need fine-grained or flexible access control
|
12
|
+
|
13
|
+
## Feature
|
14
|
+
|
15
|
+
* Support ActiveRecord CRUD permissions
|
16
|
+
* Support attribute level permission
|
17
|
+
* Support association level permission
|
18
|
+
* Filter attributes for READ permission
|
19
|
+
* Check changed and previous value for persistence operation
|
20
|
+
* CRUD permission support lambda, argument is "Relation" for READ or "Object" for persistence(ActiveRecord 4.1+)
|
21
|
+
* Attribute value check support lambda and raw sql
|
22
|
+
* Modify permissions on the fly
|
23
|
+
* Skip permission check on demand
|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
Add this line to your application's Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'controlist'
|
31
|
+
```
|
32
|
+
|
33
|
+
And then execute:
|
34
|
+
|
35
|
+
$ bundle
|
36
|
+
|
37
|
+
Or install it yourself as:
|
38
|
+
|
39
|
+
$ gem install controlist
|
40
|
+
|
41
|
+
## Usage
|
42
|
+
|
43
|
+
### Initialization
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'controlist'
|
47
|
+
require 'controlist/managers/thread_based_manager'
|
48
|
+
Controlist.initialize Controlist::Managers::ThreadBasedManager
|
49
|
+
```
|
50
|
+
|
51
|
+
You can use your customized manager or configuration to initialize Controlist
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
require 'controlist'
|
55
|
+
Controlist.initialize YourManager #, attribute_proxy: "_val", value_object_proxy: "_value_object", logger: Logger.new(STDOUT)
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
## Example
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Controlist.permission_provider.set_permission_package(OrderedPackage.new(
|
63
|
+
Controlist::Permission.new(User, READ, true, [
|
64
|
+
SimpleConstrain.new("name", "Tom"),
|
65
|
+
SimpleConstrain.new("name", ["Grade 1", "Grade 2"], relation: "clazz"),
|
66
|
+
AdvancedConstrain.new(property: "age", value: 5, operator: ">="),
|
67
|
+
SimpleConstrain.new("age", "null"),
|
68
|
+
SimpleConstrain.new("age", [1,2,3]),
|
69
|
+
SimpleConstrain.new("clazz_id", -> { Clazz.select(:id).map(&:id) }),
|
70
|
+
AdvancedConstrain.new(clause: "age != 100"),
|
71
|
+
AdvancedConstrain.new(proc_read: lambda{|relation| relation.order("id DESC").limit(3) })
|
72
|
+
])))
|
73
|
+
relation = User.all
|
74
|
+
relation.to_sql
|
75
|
+
assert_equal [:clazz], relation.joins_values
|
76
|
+
assert_equal ["(users.name = 'Tom') and (clazzs.name in ('Grade 1','Grade 2'))" +
|
77
|
+
" and (users.age >= 5) and (users.age is null) and (users.age in (1,2,3))" +
|
78
|
+
" and (users.clazz_id in (1,2)) and (age != 100)"], relation.where_values
|
79
|
+
assert_equal 3, relation.limit_value
|
80
|
+
assert_equal ["id DESC"], relation.order_values
|
81
|
+
```
|
82
|
+
|
83
|
+
And more examples, please see [more examples](https://github.com/alo7/controlist/blob/master/test/feature_test.rb)
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
1. Fork it ( https://github.com/alo7/controlist.git )
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create a new Pull Request
|
92
|
+
|
93
|
+
|
94
|
+
## License
|
95
|
+
|
96
|
+
Controlist is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/controlist.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'controlist/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "controlist"
|
8
|
+
spec.version = Controlist::VERSION
|
9
|
+
spec.authors = ["Leon Li"]
|
10
|
+
spec.email = ["qianthinking@gmail.com"]
|
11
|
+
spec.summary = %q{Fine-grained access control library for Ruby ActiveRecord}
|
12
|
+
spec.description = %q{Use Case: RBAC (Role-Based Access Control), security for API Server and any scenario that need fine-grained or flexible access control}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "minitest-rails", "~> 2.1.1"
|
25
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.0.17"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.7.0"
|
27
|
+
spec.add_development_dependency "simplecov", "~> 0.10.0"
|
28
|
+
spec.add_development_dependency "sqlite3", "~> 1.3.10"
|
29
|
+
spec.add_development_dependency "activesupport", "~> 4.2.1"
|
30
|
+
spec.add_development_dependency "activerecord", "~> 4.2.1"
|
31
|
+
|
32
|
+
#For ActiveRecord 3 test
|
33
|
+
#spec.add_development_dependency "minitest-rails"
|
34
|
+
#spec.add_development_dependency "minitest-reporters"
|
35
|
+
#spec.add_development_dependency "minitest"
|
36
|
+
#spec.add_development_dependency "test-unit"
|
37
|
+
#spec.add_development_dependency "simplecov", "~> 0.10.0"
|
38
|
+
#spec.add_development_dependency "sqlite3", "~> 1.3.10"
|
39
|
+
#spec.add_development_dependency "activesupport", "~> 3.2.1"
|
40
|
+
#spec.add_development_dependency "activerecord", "~> 3.2.1"
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Controlist
|
2
|
+
|
3
|
+
class ControlistError < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
class NoPermissionError < ControlistError
|
7
|
+
end
|
8
|
+
|
9
|
+
class PermissionForbidden < ControlistError
|
10
|
+
attr_reader :permission
|
11
|
+
|
12
|
+
def initialize(message, permission = nil)
|
13
|
+
@permission = permission
|
14
|
+
super(message)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class NotReuseableError < ControlistError
|
19
|
+
attr_reader :relation
|
20
|
+
def initialize(message, relation = nil)
|
21
|
+
@relation = relation
|
22
|
+
super(message)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|