authorule 1.0.0 → 1.0.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +6 -1
- data/authorule.gemspec +1 -0
- data/lib/authorule/rule.rb +47 -43
- data/lib/authorule/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc8a761d88dbb431e51fd694ef8eac055fee841e
|
4
|
+
data.tar.gz: 64859909d0c0996e7f20c873bb1214fcd9f05ea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa51ce5b6ba6e6e8c4d739c329ef73d3b54036735a046b6ca6422122da62485a501e7d20640907a48435a0968483c2f4c9738813197eda1fd57037daf58b6af
|
7
|
+
data.tar.gz: 6e7432a9008d5f4c54fc169b3a68316f530ed9f6d94f20a6ac40466002502800ecefe4cb4e86307f7a61dbd892a598e397a12e7d55a23c8d346e7486c1e833df
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
authorule (0.0
|
4
|
+
authorule (1.0.0)
|
5
5
|
activesupport (~> 3.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -32,6 +32,10 @@ GEM
|
|
32
32
|
rspec-expectations (2.14.3)
|
33
33
|
diff-lcs (>= 1.1.3, < 2.0)
|
34
34
|
rspec-mocks (2.14.3)
|
35
|
+
simplecov (0.7.1)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
simplecov-html (~> 0.7.1)
|
38
|
+
simplecov-html (0.7.1)
|
35
39
|
tzinfo (0.3.37)
|
36
40
|
|
37
41
|
PLATFORMS
|
@@ -43,3 +47,4 @@ DEPENDENCIES
|
|
43
47
|
bundler (~> 1.3)
|
44
48
|
rake
|
45
49
|
rspec (~> 2.14)
|
50
|
+
simplecov
|
data/authorule.gemspec
CHANGED
data/lib/authorule/rule.rb
CHANGED
@@ -34,56 +34,60 @@ module Authorule
|
|
34
34
|
######
|
35
35
|
# Rule creation accessors
|
36
36
|
|
37
|
-
|
38
|
-
def self.allow(kind, name, attributes = {})
|
39
|
-
new attributes.merge(:kind => kind, :name => name, :allow => true)
|
40
|
-
end
|
37
|
+
module ClassMethods
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
# Builds an allow rule for the given kind and name.
|
40
|
+
def allow(kind, name, attributes = {})
|
41
|
+
new attributes.merge(:kind => kind, :name => name, :allow => true)
|
42
|
+
end
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
# Creates an allow rule for the given kind and name.
|
45
|
+
def allow!(kind, name, attributes = {})
|
46
|
+
allow(kind, name, attributes).save
|
47
|
+
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
# Builds a deny rule for the given kind and name.
|
50
|
+
def deny(kind, name, attributes = {})
|
51
|
+
new attributes.merge(:kind => kind, :name => name, :allow => false)
|
52
|
+
end
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# Rule.allow_all # => kind 'all', name 'all'
|
62
|
-
# Rule.allow_all(:resource) # => kind 'resource', name 'all'
|
63
|
-
def self.allow_all(kind = :all, attributes = {})
|
64
|
-
new attributes.merge(:kind => kind, :name => 'all', :allow => true)
|
65
|
-
end
|
54
|
+
# Creates a deny rule for the given kind and name.
|
55
|
+
def deny!(kind, name, attributes = {})
|
56
|
+
deny(kind, name, attributes).save
|
57
|
+
end
|
66
58
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
59
|
+
# Builds an 'allow all' rule.
|
60
|
+
#
|
61
|
+
# == Examples
|
62
|
+
#
|
63
|
+
# Rule.allow_all # => kind 'all', name 'all'
|
64
|
+
# Rule.allow_all(:resource) # => kind 'resource', name 'all'
|
65
|
+
def allow_all(kind = :all, attributes = {})
|
66
|
+
new attributes.merge(:kind => kind, :name => 'all', :allow => true)
|
67
|
+
end
|
72
68
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
69
|
+
# Creates an 'allow all' rule.
|
70
|
+
# @see .allow_all
|
71
|
+
def allow_all!(kind = :all, attributes = {})
|
72
|
+
allow_all(kind, attributes).save
|
73
|
+
end
|
74
|
+
|
75
|
+
# Creates a 'deny all' rule.
|
76
|
+
#
|
77
|
+
# == Examples
|
78
|
+
#
|
79
|
+
# Rule.deny_all # => kind 'all', name 'all'
|
80
|
+
# Rule.deny_all(:resource) # => kind 'resource', name 'all'
|
81
|
+
def deny_all(kind = :all, attributes = {})
|
82
|
+
new attributes.merge(:kind => kind, :name => 'all', :allow => false)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Creates an 'deny all' rule.
|
86
|
+
# @see .deny_all
|
87
|
+
def deny_all!(kind = :all, attributes = {})
|
88
|
+
allow_all(kind, attributes).save
|
89
|
+
end
|
82
90
|
|
83
|
-
# Creates an 'deny all' rule.
|
84
|
-
# @see .deny_all
|
85
|
-
def self.deny_all!(kind = :all, attributes = {})
|
86
|
-
allow_all(kind, attributes).save
|
87
91
|
end
|
88
92
|
|
89
93
|
######
|
data/lib/authorule/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joost Lubach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.14'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
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'
|
83
97
|
description: Rule-based programmable permission system.
|
84
98
|
email:
|
85
99
|
- joost@yoazt.com
|