heimdallr 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "heimdallr"
6
- s.version = "1.0.0"
6
+ s.version = "1.0.1"
7
7
  s.authors = ["Peter Zotov", "Boris Staal"]
8
8
  s.email = ["whitequark@whitequark.org", "boris@roundlake.ru"]
9
9
  s.homepage = "http://github.com/roundlake/heimdallr"
@@ -222,5 +222,9 @@ module Heimdallr
222
222
  options: @options
223
223
  }.merge(@restrictions.reflection)
224
224
  end
225
+
226
+ def creatable?
227
+ @restrictions.can? :create
228
+ end
225
229
  end
226
230
  end
@@ -252,6 +252,10 @@ module Heimdallr
252
252
  }.merge(@restrictions.reflection)
253
253
  end
254
254
 
255
+ def creatable?
256
+ @restrictions.can? :create
257
+ end
258
+
255
259
  def modifiable?
256
260
  @restrictions.can? :update
257
261
  end
@@ -109,6 +109,12 @@ describe Heimdallr::Proxy do
109
109
  article.restrict(@looser).implicit.secrecy_level.should == nil
110
110
  end
111
111
 
112
+ it "should answer if object is creatable" do
113
+ Article.restrict(@john).creatable?.should == true
114
+ Article.restrict(@admin).creatable?.should == true
115
+ Article.restrict(@looser).creatable?.should == true
116
+ end
117
+
112
118
  it "should answer if object is modifiable" do
113
119
  article = Article.create! :owner_id => @john.id, :content => 'test', :secrecy_level => 4
114
120
  article.restrict(@john).modifiable?.should == true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdallr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-04-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &70194887048460 !ruby/object:Gem::Requirement
17
+ requirement: &70094345321720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70194887048460
25
+ version_requirements: *70094345321720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activemodel
28
- requirement: &70194887047820 !ruby/object:Gem::Requirement
28
+ requirement: &70094345321100 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70194887047820
36
+ version_requirements: *70094345321100
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &70194887047340 !ruby/object:Gem::Requirement
39
+ requirement: &70094345320640 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70194887047340
47
+ version_requirements: *70094345320640
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: activerecord
50
- requirement: &70194887039320 !ruby/object:Gem::Requirement
50
+ requirement: &70094345320060 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70194887039320
58
+ version_requirements: *70094345320060
59
59
  description: ! "Heimdallr aims to provide an easy to configure and efficient object-
60
60
  and field-level access\n control solution, reusing proven patterns from gems like
61
61
  CanCan and allowing one to manage permissions in a very\n fine-grained manner."