authorule 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94b612796ca264f8a74cc1a5279093c602cffe77
4
- data.tar.gz: 8753373eca10d39f80ccbfa89469d5e6b7e30e34
3
+ metadata.gz: bc8a761d88dbb431e51fd694ef8eac055fee841e
4
+ data.tar.gz: 64859909d0c0996e7f20c873bb1214fcd9f05ea8
5
5
  SHA512:
6
- metadata.gz: 90a3b01b1e02017f54ec9c3a931d0662a36b424e7f3c5c8c38f8277b2ceea8f8e646d5addad3cbf06261c095bce725302e71dcd1b204a718b57dda5a6c8858cf
7
- data.tar.gz: 2ed129fc2f22109705614d3fd0f807eb79b88bb465503fd22c48751db6c1c266dc5c1291ba9fec4253b1b362c9be029a9e4285ee2e73beb0785eac275c5c85a2
6
+ metadata.gz: 2fa51ce5b6ba6e6e8c4d739c329ef73d3b54036735a046b6ca6422122da62485a501e7d20640907a48435a0968483c2f4c9738813197eda1fd57037daf58b6af
7
+ data.tar.gz: 6e7432a9008d5f4c54fc169b3a68316f530ed9f6d94f20a6ac40466002502800ecefe4cb4e86307f7a61dbd892a598e397a12e7d55a23c8d346e7486c1e833df
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ * Bug fix: rule creators now properly available on class.
4
+
1
5
  ## 1.0.0
2
6
 
3
7
  * V1 Release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authorule (0.0.2)
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
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "activerecord", "~> 3.2"
26
26
  spec.add_development_dependency "rspec", "~> 2.14"
27
+ spec.add_development_dependency "simplecov"
27
28
  end
@@ -34,56 +34,60 @@ module Authorule
34
34
  ######
35
35
  # Rule creation accessors
36
36
 
37
- # Builds an allow rule for the given kind and name.
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
- # Creates an allow rule for the given kind and name.
43
- def self.allow!(kind, name, attributes = {})
44
- allow(kind, name, attributes).save
45
- end
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
- # Builds a deny rule for the given kind and name.
48
- def self.deny(kind, name, attributes = {})
49
- new attributes.merge(:kind => kind, :name => name, :allow => false)
50
- end
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
- # Creates a deny rule for the given kind and name.
53
- def self.deny!(kind, name, attributes = {})
54
- deny(kind, name, attributes).save
55
- end
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
- # Builds an 'allow all' rule.
58
- #
59
- # == Examples
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
- # Creates an 'allow all' rule.
68
- # @see .allow_all
69
- def self.allow_all!(kind = :all, attributes = {})
70
- allow_all(kind, attributes).save
71
- end
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
- # Creates a 'deny all' rule.
74
- #
75
- # == Examples
76
- #
77
- # Rule.deny_all # => kind 'all', name 'all'
78
- # Rule.deny_all(:resource) # => kind 'resource', name 'all'
79
- def self.deny_all(kind = :all, attributes = {})
80
- new attributes.merge(:kind => kind, :name => 'all', :allow => false)
81
- end
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
  ######
@@ -1,3 +1,3 @@
1
1
  module Authorule
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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-16 00:00:00.000000000 Z
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