eaco 0.8.0 → 0.8.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: 9384ef5a98077f6557e1e69eb7f54fb0463d35d5
4
- data.tar.gz: 5728d953f8b9aef185fc97a84ae1a236c35ae9eb
3
+ metadata.gz: 536f9a37ebe0f8c16425d643a8cb91c119d5f61c
4
+ data.tar.gz: 0e9c61eeddaca078398925b397e39795f7b8247b
5
5
  SHA512:
6
- metadata.gz: 7f5c5de62937bef96163b634a895903cdc4fa76368ac7b1dc56765d395bb5445ca0c41e3ef9b49c6992b5dda264210ecb50b79613a574c31887ec7da83d35aec
7
- data.tar.gz: 15d230d2416a2fd7a0ddaf5479433759d494d7a285944d38606f05630567a321f0baf4a787ecbd4a993ff155a9d1031a66c53fb97dbb9ba5876f9ba6b6801b47
6
+ metadata.gz: 9780bf31341fde6cce7a5046c83d667e2ec09b6595b3806a4ed3d42ca3d67264eaa13d44d61d6e0d65e3acf4911f899088986bf72cf01f5640e1b8d4d5e4c8d3
7
+ data.tar.gz: ee7f5cf26bce90db25812ae255409b0b938119678ff3a1f08b278eda2b53b5457c383835c4700f6e5a84d402b64368af01043ebff87515a70f946e52d002eacd
data/.yardopts CHANGED
@@ -1 +1,6 @@
1
- --protected --private --no-private --hide-void-return '{lib,features/support}/**/*.rb' - README.md LICENSE.txt
1
+ --protected
2
+ --private
3
+ --no-private
4
+ --hide-void-return
5
+ --plugin cucumber
6
+ '{lib,features}/**/*.rb' - README.md LICENSE.txt
data/README.md CHANGED
@@ -11,10 +11,12 @@ framework for Ruby.
11
11
 
12
12
  ![Eaco e Telamone][eaco-e-telamone]
13
13
 
14
+ *"Aeacus telemon by user Ravenous at en.wikipedia.org - Public domain through Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Aeacus_telemon.jpg"*
15
+
14
16
  ## Design
15
17
 
16
- Eaco provides your context's Resources discretionary access by an Actor.
17
- Access to the Resource is determined using an ACL.
18
+ Eaco provides your application's Resources discretionary access.
19
+ Access to the Resource is determined matching an ACL against an Actor.
18
20
 
19
21
  Different Actors can have different levels of access to the same Resource,
20
22
  depending on their role as determined by the ACL.
@@ -22,24 +24,23 @@ depending on their role as determined by the ACL.
22
24
  To each role are granted a set of possible abilities, and access is verified
23
25
  by checking whether a given actor can perform a specific ability.
24
26
 
25
- Actors are described by their Designators, a pluggable mechanism to be
26
- implemented in your application.
27
-
28
- Each Actor has many designators that describe either its identity or its
29
- belonging to a group or occupying a position in a department.
27
+ Actors are described by their Designators, a pluggable mechanism whose details
28
+ are up to your application. For instance, an Actor can have many designators
29
+ that describe either its identity or its belonging to a group or occupying a
30
+ position in a department.
30
31
 
31
32
  Designators are Ruby classes that can embed any sort of custom behaviour that
32
33
  your application requires.
33
34
 
34
35
  ACLs are hashes with designators as keys and roles as values. Extracting
35
36
  authorized collections requires only an hash key lookup mechanism in your
36
- database. Adapters are provided for PG's jsonb and for CouchDB-Lucene.
37
+ database. Adapters are provided for PG's +jsonb+ and for CouchDB-Lucene.
37
38
 
38
39
  ## Installation
39
40
 
40
41
  Add this line to your application's Gemfile:
41
42
 
42
- gem 'eaco', github: 'ifad/eaco'
43
+ gem 'eaco'
43
44
 
44
45
  And then execute:
45
46
 
@@ -89,6 +90,7 @@ with an ACL [(rdoc)](http://www.rubydoc.info/github/ifad/eaco/master/Eaco/ACL):
89
90
  # An example ACL
90
91
  >> document = Document.first
91
92
  => #<Document id:42 name:"President's report for loans.docx" [...]>
93
+
92
94
  >> document.acl
93
95
  => #<Document::ACL {"user:10" => :owner, "group:reviewers" => :reader}>
94
96
  ```
@@ -99,6 +101,7 @@ and an Actor [(rdoc)](http://www.rubydoc.info/github/ifad/eaco/master/Eaco/Actor
99
101
  # An example Actor
100
102
  >> user = User.find(10)
101
103
  => #<User id:10 name:"Bob Fropp" group_ids:['employees'], tags:['english']>
104
+
102
105
  >> user.designators
103
106
  => #<Set{ #<Designator(User) value:10>, #<Designator(Group) value:"employees">, #<Designator(Tag) value:"english"> }
104
107
  ```
@@ -164,25 +167,27 @@ Grant reader access to a group:
164
167
  => true
165
168
  ```
166
169
 
167
- Obtain a collection of Resources accessible by a given Actor [(rdoc)](http://www.rubydoc.info/github/ifad/eaco/master/Eaco/Adapters):
170
+ Obtain a collection of Resources accessible by a given Actor
171
+ [(rdoc)](http://www.rubydoc.info/github/ifad/eaco/master/Eaco/Adapters):
168
172
 
169
173
  ```ruby
170
174
  >> Document.accessible_by(user)
171
175
  ```
172
176
 
173
177
  Check whether a controller action can be accessed by an user. Your
174
- `ApplicationController` must respond to `current_user` for this to work.
178
+ Controller must respond to `current_user` for this to work.
175
179
  [(rdoc)](http://www.rubydoc.info/github/ifad/eaco/master/Eaco/Controller)
176
180
 
177
181
  ```ruby
178
182
  class DocumentsController < ApplicationController
179
183
  before_filter :find_document
180
184
 
181
- authorize :edit, :update, [:document, :read]
185
+ authorize :show, [:document, :read]
186
+ authorize :edit, [:document, :edit]
182
187
 
183
188
  private
184
189
  def find_document
185
- @document = Document.find(:id)
190
+ @document = Document.find(params[:id])
186
191
  end
187
192
  end
188
193
  ```
@@ -208,9 +213,9 @@ see `features/active_record.example.yml` for an example.
208
213
 
209
214
  Run `bundle` once. This will install the base bundle.
210
215
 
211
- Run `appraisal` once. This will install the supported Rails versions and pg.
216
+ Run `appraisal` once. This will install the supported Rails versions and +pg+.
212
217
 
213
- Run `rake`. This will run the specs and cucumber features.
218
+ Run `rake`. This will run the specs and cucumber features and report coverage.
214
219
 
215
220
  Specs are run against the supported rails versions in turn. If you want to
216
221
  focus on a single release, use `appraisal rails-X.Y rake`, where `X.Y` can be
@@ -228,4 +233,4 @@ focus on a single release, use `appraisal rails-X.Y rake`, where `X.Y` can be
228
233
 
229
234
  This software is Made in Italy :it: :smile:.
230
235
 
231
- [eaco-e-telamone]: http://upload.wikimedia.org/wikipedia/commons/7/70/Aeacus_telemon.jpg "Aeacus telemon by user Ravenous at en.wikipedia.org - Public domain through Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Aeacus_telemon.jpg#mediaviewer/File:Aeacus_telemon.jpg"
236
+ [eaco-e-telamone]: http://upload.wikimedia.org/wikipedia/commons/7/70/Aeacus_telemon.jpg
@@ -17,12 +17,17 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- [
21
- ["bundler", "~> 1.6"],
22
- "rake", "byebug", "guard", "yard", "appraisal",
23
- "rspec", "guard-rspec", "yard-rspec",
24
- "cucumber", "guard-cucumber", "coveralls",
25
- "guard-shell"
26
-
27
- ].each {|gem| spec.add_development_dependency *gem }
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "byebug"
23
+ spec.add_development_dependency "guard"
24
+ spec.add_development_dependency "yard"
25
+ spec.add_development_dependency "appraisal"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "guard-rspec"
28
+ spec.add_development_dependency "cucumber"
29
+ spec.add_development_dependency "guard-cucumber"
30
+ spec.add_development_dependency "yard-cucumber"
31
+ spec.add_development_dependency "coveralls"
32
+ spec.add_development_dependency "guard-shell"
28
33
  end
@@ -27,6 +27,8 @@ module Eaco
27
27
  adapter.class.parent::PostgreSQLColumn.instance_eval do
28
28
  include Column
29
29
  end
30
+
31
+ base.extend Scoped
30
32
  end
31
33
 
32
34
  ##
@@ -2,6 +2,6 @@ module Eaco
2
2
 
3
3
  # Current version
4
4
  #
5
- VERSION = '0.8.0'
5
+ VERSION = '0.8.1'
6
6
 
7
7
  end
@@ -4,10 +4,10 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::Actor do
6
6
 
7
- pending '#designators'
7
+ #pending '#designators'
8
8
 
9
- pending '#is_admin?'
9
+ #pending '#is_admin?'
10
10
 
11
- pending '#can?'
11
+ #pending '#can?'
12
12
 
13
13
  end
@@ -5,8 +5,8 @@ require 'eaco/controller'
5
5
 
6
6
  RSpec.describe Eaco::Controller do
7
7
 
8
- pending '.authorize'
8
+ #pending '.authorize'
9
9
 
10
- pending '.permission_for'
10
+ #pending '.permission_for'
11
11
 
12
12
  end
@@ -4,22 +4,22 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::Designator do
6
6
 
7
- pending '#make'
7
+ #pending '#make'
8
8
 
9
- pending '#parse'
9
+ #pending '#parse'
10
10
 
11
- pending '#resolve'
11
+ #pending '#resolve'
12
12
 
13
- pending '#configure!'
13
+ #pending '#configure!'
14
14
 
15
- pending '#harvest'
15
+ #pending '#harvest'
16
16
 
17
- pending '#label'
17
+ #pending '#label'
18
18
 
19
- pending '#id'
19
+ #pending '#id'
20
20
 
21
- pending '#search'
21
+ #pending '#search'
22
22
 
23
- pending '#new'
23
+ #pending '#new'
24
24
 
25
25
  end
@@ -4,6 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::DSL::ACL do
6
6
 
7
- pending '#new'
7
+ #pending '#new'
8
8
 
9
9
  end
@@ -4,12 +4,12 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::DSL::Actor do
6
6
 
7
- pending '#new'
7
+ #pending '#new'
8
8
 
9
- pending '#designators'
9
+ #pending '#designators'
10
10
 
11
- pending '#admin_logic'
11
+ #pending '#admin_logic'
12
12
 
13
- pending '.find_designator'
13
+ #pending '.find_designator'
14
14
 
15
15
  end
@@ -4,14 +4,14 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::DSL::Resource do
6
6
 
7
- pending '#new'
7
+ #pending '#new'
8
8
 
9
- pending '#permissions'
9
+ #pending '#permissions'
10
10
 
11
- pending '#roles'
11
+ #pending '#roles'
12
12
 
13
- pending '#roles_priority'
13
+ #pending '#roles_priority'
14
14
 
15
- pending '#roles_with_labels'
15
+ #pending '#roles_with_labels'
16
16
 
17
17
  end
@@ -4,6 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::Error do
6
6
 
7
- pending '#new'
7
+ #pending '#new'
8
8
 
9
9
  end
@@ -4,28 +4,28 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe Eaco::Resource do
6
6
 
7
- pending '.role?'
7
+ #pending '.role?'
8
8
 
9
- pending '.allows?'
9
+ #pending '.allows?'
10
10
 
11
- pending '.role_of'
11
+ #pending '.role_of'
12
12
 
13
- pending '.permissions'
13
+ #pending '.permissions'
14
14
 
15
- pending '.roles'
15
+ #pending '.roles'
16
16
 
17
- pending '.roles_priority'
17
+ #pending '.roles_priority'
18
18
 
19
- pending '.roles_with_labels'
19
+ #pending '.roles_with_labels'
20
20
 
21
- pending '#allows?'
21
+ #pending '#allows?'
22
22
 
23
- pending '#role_of'
23
+ #pending '#role_of'
24
24
 
25
- pending '#grant'
25
+ #pending '#grant'
26
26
 
27
- pending '#revoke'
27
+ #pending '#revoke'
28
28
 
29
- pending '#batch_grant'
29
+ #pending '#batch_grant'
30
30
 
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eaco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: yard-rspec
126
+ name: cucumber
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: cucumber
140
+ name: guard-cucumber
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: guard-cucumber
154
+ name: yard-cucumber
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -199,6 +199,7 @@ executables: []
199
199
  extensions: []
200
200
  extra_rdoc_files: []
201
201
  files:
202
+ - ".config/cucumber.yml"
202
203
  - ".gitignore"
203
204
  - ".rspec"
204
205
  - ".travis.yml"
@@ -273,10 +274,6 @@ files:
273
274
  - lib/eaco/version.rb
274
275
  - spec/eaco/acl_spec.rb
275
276
  - spec/eaco/actor_spec.rb
276
- - spec/eaco/adapters/active_record/postgres_jsonb_spec.rb
277
- - spec/eaco/adapters/active_record_spec.rb
278
- - spec/eaco/adapters/couchrest_model/couchdb_lucene_spec.rb
279
- - spec/eaco/adapters/couchrest_model_spec.rb
280
277
  - spec/eaco/controller_spec.rb
281
278
  - spec/eaco/designator_spec.rb
282
279
  - spec/eaco/dsl/acl_spec.rb
@@ -328,10 +325,6 @@ test_files:
328
325
  - features/support/env.rb
329
326
  - spec/eaco/acl_spec.rb
330
327
  - spec/eaco/actor_spec.rb
331
- - spec/eaco/adapters/active_record/postgres_jsonb_spec.rb
332
- - spec/eaco/adapters/active_record_spec.rb
333
- - spec/eaco/adapters/couchrest_model/couchdb_lucene_spec.rb
334
- - spec/eaco/adapters/couchrest_model_spec.rb
335
328
  - spec/eaco/controller_spec.rb
336
329
  - spec/eaco/designator_spec.rb
337
330
  - spec/eaco/dsl/acl_spec.rb
@@ -1,9 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Eaco::Adapters::ActiveRecord::PostgresJSONb do
6
-
7
- pending '.accessible_by'
8
-
9
- end
@@ -1,13 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Eaco::Adapters::ActiveRecord do
6
-
7
- pending '.included'
8
-
9
- pending '#acl'
10
-
11
- pending '#acl='
12
-
13
- end
@@ -1,9 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Eaco::Adapters::CouchrestModel::CouchDBLucene do
6
-
7
- pending '.accessible_by'
8
-
9
- end
@@ -1,9 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Eaco::Adapters::CouchrestModel do
6
-
7
- pending '.included'
8
-
9
- end