eaco 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +6 -6
- data/README.md +7 -1
- data/eaco.gemspec +1 -1
- data/features/rails_integration.feature +4 -3
- data/features/role_based_authorization.feature +33 -0
- data/features/step_definitions/actor_definition.rb +30 -0
- data/features/step_definitions/resource_authorization.rb +10 -6
- data/features/support/env.rb +16 -1
- data/lib/eaco/acl.rb +1 -1
- data/lib/eaco/actor.rb +10 -0
- data/lib/eaco/adapters/active_record/compatibility.rb +14 -12
- data/lib/eaco/cucumber/active_record/schema.rb +0 -1
- data/lib/eaco/cucumber/active_record/user.rb +1 -1
- data/lib/eaco/cucumber/active_record/user/designators.rb +18 -0
- data/lib/eaco/cucumber/active_record/user/designators/user.rb +48 -0
- data/lib/eaco/cucumber/world.rb +31 -0
- data/lib/eaco/designator.rb +1 -1
- data/lib/eaco/dsl/acl.rb +28 -12
- data/lib/eaco/dsl/resource.rb +1 -1
- data/lib/eaco/rake/default_task.rb +27 -2
- data/lib/eaco/resource.rb +15 -7
- data/lib/eaco/version.rb +1 -1
- data/spec/spec_helper.rb +5 -1
- metadata +22 -4
- data/features/step_definitions/database.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064c893c7bbedea1c0ef2d5b26e28e9595b1c195
|
4
|
+
data.tar.gz: b3113b80fbe9d98dd6a25d2581ff42ed984e7510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4673c887e41e8ce7df0b4886b4aa1a88f3eaa0b39f30d014cf74ba6524fdcd5f8d426bcc472ae5cbaf5314c23f39f8e0da978bdead17883f938dd825ac7b756f
|
7
|
+
data.tar.gz: bb14983548c641806fe0929ec99e7752fbf3391c24c872469f3f72f41ec627a26b17990622046d76365ac94e3262fa058fadf73ac1de68206f976e0dd65a96a8
|
data/Guardfile
CHANGED
@@ -14,7 +14,7 @@ guard :rspec, version: 3, cmd: 'rspec' do
|
|
14
14
|
watch('spec/spec_helper.rb') { "spec" }
|
15
15
|
|
16
16
|
# When a source changes run its unit spec.
|
17
|
-
watch(%r{^lib/(.+)\.rb$}) {|m| "spec/#{m[1]}_spec.rb"
|
17
|
+
watch(%r{^lib/(.+)\.rb$}) {|m| "spec/#{m[1]}_spec.rb" }
|
18
18
|
end
|
19
19
|
|
20
20
|
guard :cucumber do
|
@@ -22,13 +22,13 @@ guard :cucumber do
|
|
22
22
|
watch(%r{^features/.+\.feature$})
|
23
23
|
|
24
24
|
# When support code changes, rerun all features.
|
25
|
-
watch(%r{^features/support/.+$})
|
25
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
26
26
|
|
27
27
|
# When a step definition for a feature changes, rerun the corresponding feature.
|
28
28
|
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
29
29
|
end
|
30
30
|
|
31
|
-
guard :shell do
|
32
|
-
# Rerun scenarios when source code changes
|
33
|
-
watch(%r{^lib/.+\.rb$}) { 'cucumber' }
|
34
|
-
end
|
31
|
+
#guard :shell do
|
32
|
+
# # Rerun scenarios when source code changes
|
33
|
+
# watch(%r{^lib/.+\.rb$}) { 'cucumber' }
|
34
|
+
#end
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Eaco
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/ifad/eaco.svg)](https://travis-ci.org/ifad/eaco)
|
3
|
+
[![Build Status](https://travis-ci.org/ifad/eaco.svg)](https://travis-ci.org/ifad/eaco)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/ifad/eaco/badge.svg)](https://coveralls.io/r/ifad/eaco) (*currently writing specs*)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/ifad/eaco/badges/gpa.svg)](https://codeclimate.com/github/ifad/eaco)
|
5
6
|
[![Inline docs](http://inch-ci.org/github/ifad/eaco.svg?branch=master)](http://inch-ci.org/github/ifad/eaco/master)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/eaco.svg)](http://badge.fury.io/rb/eaco)
|
6
8
|
|
7
9
|
Eacus, the holder of the keys of Hades, is an ACL-based authorization
|
8
10
|
framework for Ruby.
|
@@ -222,4 +224,8 @@ focus on a single release, use `appraisal rails-X.Y rake`, where `X.Y` can be
|
|
222
224
|
4. Push to the branch (`git push origin my-new-feature`)
|
223
225
|
5. Create a new Pull Request
|
224
226
|
|
227
|
+
## Denominazione d'Origine Controllata
|
228
|
+
|
229
|
+
This software is Made in :italy:.
|
230
|
+
|
225
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"
|
data/eaco.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
["bundler", "~> 1.6"],
|
22
22
|
"rake", "byebug", "guard", "yard", "appraisal",
|
23
23
|
"rspec", "guard-rspec", "yard-rspec",
|
24
|
-
"cucumber", "guard-cucumber"
|
24
|
+
"cucumber", "guard-cucumber", "coveralls"
|
25
25
|
|
26
26
|
].each {|gem| spec.add_development_dependency *gem }
|
27
27
|
end
|
@@ -2,9 +2,10 @@ Feature: Rails integration
|
|
2
2
|
The framework should play nice with the most recent major Rails version
|
3
3
|
|
4
4
|
Background:
|
5
|
-
Given I
|
6
|
-
|
5
|
+
Given I have a Document resource defined as
|
6
|
+
"""
|
7
|
+
authorize $MODEL, using: :pg_jsonb
|
8
|
+
"""
|
7
9
|
|
8
10
|
Scenario:
|
9
|
-
When I authorize the Document model
|
10
11
|
Then I should be able to set an ACL on it
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Role-Based authorization
|
2
|
+
Access to a Resource by an Actor is determined by the
|
3
|
+
ACL set on the Resource and the Designators the Actor
|
4
|
+
is eligible.
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a Document resource defined as
|
8
|
+
"""
|
9
|
+
authorize $MODEL, using: :pg_jsonb do
|
10
|
+
roles :reader, :writer
|
11
|
+
|
12
|
+
permissions do
|
13
|
+
reader :read
|
14
|
+
writer reader, :write
|
15
|
+
end
|
16
|
+
end
|
17
|
+
"""
|
18
|
+
And I have an User actor defined as
|
19
|
+
"""
|
20
|
+
actor $MODEL do
|
21
|
+
designators do
|
22
|
+
user from: :id
|
23
|
+
end
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
Given I have an actor named Bob
|
27
|
+
And I have an actor named Tom
|
28
|
+
|
29
|
+
Scenario:
|
30
|
+
And I have a confidential one named "Supa Dupa Fly"
|
31
|
+
And I grant Bob access as a reader in quality of user
|
32
|
+
Then Bob should be able to read it
|
33
|
+
And Tom should not be able to read it
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Given(/I have an (\w+) actor defined as/) do |model_name, author_definition|
|
2
|
+
@actor_model = find_model(model_name)
|
3
|
+
|
4
|
+
eval_dsl author_definition, @actor_model
|
5
|
+
end
|
6
|
+
|
7
|
+
Given(/I have an actor named (\w+)/) do |actor_name|
|
8
|
+
actor = @actor_model.new
|
9
|
+
actor.name = actor_name
|
10
|
+
|
11
|
+
@actors ||= {}
|
12
|
+
@actors[actor_name] = actor
|
13
|
+
end
|
14
|
+
|
15
|
+
When(/I grant (\w+) access as a (\w+) in quality of (\w+)/) do |actor_name, role_name, designator|
|
16
|
+
actor = @actors.fetch(actor_name)
|
17
|
+
@resource.grant role_name, designator, actor
|
18
|
+
@resource.save!
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/(\w+) should be able to (\w+) it/) do |actor_name, permission_name|
|
22
|
+
actor = @actors.fetch(actor_name)
|
23
|
+
actor.can? permission_name, @resource
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/(\w+) should not be able to (\w+) it/) do |actor_name, permission_name|
|
27
|
+
actor = @actors.fetch(actor_name)
|
28
|
+
actor.cannot? permission_name, @resource
|
29
|
+
end
|
30
|
+
|
@@ -1,15 +1,19 @@
|
|
1
|
-
When(/I
|
2
|
-
@
|
1
|
+
When(/I have a (\w+) resource defined as/) do |model_name, resource_definition|
|
2
|
+
@resource_model = find_model(model_name)
|
3
3
|
|
4
|
-
|
4
|
+
eval_dsl resource_definition, @resource_model
|
5
|
+
end
|
6
|
+
|
7
|
+
When(/I have a confidential one named "([\w\s]+)"/) do |name|
|
8
|
+
@resource = @resource_model.new(name: name)
|
5
9
|
end
|
6
10
|
|
7
11
|
Then(/I should be able to set an ACL on it/) do
|
8
|
-
instance = @
|
12
|
+
instance = @resource_model.new
|
9
13
|
|
10
14
|
instance.acl = {foo: :bar}
|
11
15
|
instance.save!
|
12
|
-
instance = @
|
16
|
+
instance = @resource_model.find(instance.id)
|
13
17
|
|
14
|
-
instance.acl == {foo: :bar} && instance.acl.class.kind_of?(
|
18
|
+
instance.acl == {foo: :bar} && instance.acl.class.kind_of?(@resource_model.acl)
|
15
19
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'byebug'
|
3
|
+
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
6
|
+
|
3
7
|
require 'eaco'
|
4
8
|
require 'eaco/cucumber'
|
5
9
|
|
6
|
-
|
10
|
+
##
|
11
|
+
# Create a whole new world.
|
12
|
+
# @see {World}
|
13
|
+
# @!method World
|
7
14
|
World do
|
8
15
|
Eaco::Cucumber::World.new
|
9
16
|
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Recreate the schema before each feature, to start fresh.
|
20
|
+
# @see {ActiveRecord.define_schema!}
|
21
|
+
# @!method Before
|
22
|
+
Before do
|
23
|
+
Eaco::Cucumber::ActiveRecord.define_schema!
|
24
|
+
end
|
data/lib/eaco/acl.rb
CHANGED
data/lib/eaco/actor.rb
CHANGED
@@ -19,13 +19,21 @@ module Eaco
|
|
19
19
|
end
|
20
20
|
|
21
21
|
##
|
22
|
-
# Checks whether
|
23
|
-
#
|
22
|
+
# Checks whether this model is compatible.
|
23
|
+
#
|
24
|
+
# Looks up the {#support_module} and, if found, includes it in the
|
25
|
+
# target model.
|
24
26
|
#
|
25
27
|
# @see #support_module
|
28
|
+
#
|
29
|
+
# @return [nil]
|
30
|
+
#
|
26
31
|
def check!
|
27
|
-
|
28
|
-
|
32
|
+
mod = support_module
|
33
|
+
return unless mod
|
34
|
+
base.instance_eval { include mod }
|
35
|
+
|
36
|
+
nil
|
29
37
|
end
|
30
38
|
|
31
39
|
private
|
@@ -51,18 +59,12 @@ module Eaco
|
|
51
59
|
# Tries to look up the support module for the {#active_record_version}
|
52
60
|
# in the {Compatibility} namespace.
|
53
61
|
#
|
54
|
-
# @return [Module] the support module
|
55
|
-
#
|
56
|
-
# @raise [Eaco::Error] if not found.
|
62
|
+
# @return [Module] the support module or nil if not required.
|
57
63
|
#
|
58
64
|
# @see check!
|
59
65
|
#
|
60
66
|
def support_module
|
61
|
-
unless self.class.const_defined?(support_module_name)
|
62
|
-
raise Eaco::Error, <<-EOF
|
63
|
-
Unsupported Active Record version: #{active_record_version}
|
64
|
-
EOF
|
65
|
-
end
|
67
|
+
return unless self.class.const_defined?(support_module_name)
|
66
68
|
|
67
69
|
self.class.const_get support_module_name
|
68
70
|
end
|
@@ -13,7 +13,7 @@ module Eaco
|
|
13
13
|
# @see Eaco::Cucumber::World
|
14
14
|
#
|
15
15
|
class User < ::ActiveRecord::Base
|
16
|
-
autoload :Designators, '
|
16
|
+
autoload :Designators, 'eaco/cucumber/active_record/user/designators.rb'
|
17
17
|
|
18
18
|
has_many :positions
|
19
19
|
has_many :departments, through: :positions
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Eaco
|
2
|
+
module Cucumber
|
3
|
+
module ActiveRecord
|
4
|
+
class User
|
5
|
+
|
6
|
+
##
|
7
|
+
# The example {Designator}s for the {User} class.
|
8
|
+
#
|
9
|
+
# @see World
|
10
|
+
#
|
11
|
+
module Designators
|
12
|
+
autoload :User, 'eaco/cucumber/active_record/user/designators/user.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Eaco
|
2
|
+
module Cucumber
|
3
|
+
module ActiveRecord
|
4
|
+
class User
|
5
|
+
module Designators
|
6
|
+
|
7
|
+
##
|
8
|
+
# The simplest {Designator}. It resolves actors by their unique ID,
|
9
|
+
# such as an autoincrementing ID in a relational database.
|
10
|
+
#
|
11
|
+
# The ID is available as the {Designator#value}. If the Designator
|
12
|
+
# is instantiated with a live instance (see {Designator#initialize})
|
13
|
+
# then it is re-used and a query to the database is avoided.
|
14
|
+
#
|
15
|
+
# The designator string representation for user 42 is +"user:42"+.
|
16
|
+
#
|
17
|
+
class User < Eaco::Designator
|
18
|
+
##
|
19
|
+
# @return [String] the {User}'s name.
|
20
|
+
#
|
21
|
+
def describe(*)
|
22
|
+
"User '%s'" % [target_user.name]
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @return [Array] this very {User} wrapped in an +Array+.
|
27
|
+
#
|
28
|
+
def resolve
|
29
|
+
[target_user]
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
##
|
34
|
+
# Looks up this user by ID, and memoizes it using the
|
35
|
+
# {Designator#instance=} accessor.
|
36
|
+
#
|
37
|
+
# @return [User] this very user.
|
38
|
+
#
|
39
|
+
def target_user
|
40
|
+
self.instance ||= ActiveRecord::User.find(self.value)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/eaco/cucumber/world.rb
CHANGED
@@ -130,6 +130,37 @@ module Eaco
|
|
130
130
|
# Belonging to a department is the Designator of type +:department+
|
131
131
|
#
|
132
132
|
class World
|
133
|
+
|
134
|
+
##
|
135
|
+
# Set up the World:
|
136
|
+
#
|
137
|
+
# * Connect to ActiveRecord
|
138
|
+
#
|
139
|
+
def initialize
|
140
|
+
Eaco::Cucumber::ActiveRecord.connect!
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# @return [Class] a model in the {ActiveRecord} namespace.
|
145
|
+
#
|
146
|
+
def find_model(model_name)
|
147
|
+
Eaco::Cucumber::ActiveRecord.const_get(model_name)
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Evaluates the given {Eaco::DSL} code, substituting the
|
152
|
+
# +$MODEL+ string with the given model name.
|
153
|
+
#
|
154
|
+
# @param code [String] the DSL code to eval
|
155
|
+
# @param model [Class] the model name to substitute
|
156
|
+
#
|
157
|
+
# @return [void]
|
158
|
+
#
|
159
|
+
def eval_dsl(code, model)
|
160
|
+
# Sub in place to print final code when running cucumber
|
161
|
+
code.sub! '$MODEL', model.name
|
162
|
+
Eaco.eval! code, '(feature)'
|
163
|
+
end
|
133
164
|
end
|
134
165
|
|
135
166
|
end
|
data/lib/eaco/designator.rb
CHANGED
data/lib/eaco/dsl/acl.rb
CHANGED
@@ -7,19 +7,23 @@ module Eaco
|
|
7
7
|
# Block-less DSL to set up the {ACL} machinery onto an authorized {Resource}.
|
8
8
|
#
|
9
9
|
# * Defines an {ACL} subclass in the Resource namespace
|
10
|
+
# ({#define_acl_subclass})
|
11
|
+
#
|
10
12
|
# * Defines syntactic sugar on the ACL to easily retrieve {Actor}s with a
|
11
|
-
# specific Role
|
13
|
+
# specific Role ({#define_role_getters})
|
14
|
+
#
|
12
15
|
# * Installs {ACL} objects persistance for the supported ORMs
|
13
|
-
#
|
16
|
+
# ({#install_persistance})
|
17
|
+
#
|
18
|
+
# * Installs the authorized collection extraction strategy
|
19
|
+
# +.accessible_by+ ({#install_strategy})
|
14
20
|
#
|
15
21
|
class ACL < Base
|
16
22
|
|
17
23
|
##
|
18
|
-
# Performs ACL setup on the target Resource
|
24
|
+
# Performs ACL setup on the target Resource model.
|
19
25
|
#
|
20
|
-
# @
|
21
|
-
# @see #define_role_getters
|
22
|
-
# @see #install_persistance
|
26
|
+
# @return [nil]
|
23
27
|
#
|
24
28
|
def initialize(*)
|
25
29
|
super
|
@@ -27,6 +31,9 @@ module Eaco
|
|
27
31
|
define_acl_subclass
|
28
32
|
define_role_getters
|
29
33
|
install_persistance
|
34
|
+
install_strategy
|
35
|
+
|
36
|
+
nil
|
30
37
|
end
|
31
38
|
|
32
39
|
private
|
@@ -74,13 +81,11 @@ module Eaco
|
|
74
81
|
end
|
75
82
|
|
76
83
|
##
|
77
|
-
# Sets up the persistance layer for ACLs (+#acl+ and +#acl=+)
|
78
|
-
# authorized collection extraction strategy (+.accessible_by+).
|
84
|
+
# Sets up the persistance layer for ACLs (+#acl+ and +#acl=+).
|
79
85
|
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
# subclass (see {.define_acl_subclass})
|
83
|
-
# returns an +Enumerable+ collection.
|
86
|
+
# These APIs can be implemented directly in your Resource model, as long
|
87
|
+
# as the +acl+ accessor accepts and returns the Resource model's ACL
|
88
|
+
# subclass (see {.define_acl_subclass})
|
84
89
|
#
|
85
90
|
# See each adapter for the details of the extraction strategies
|
86
91
|
# they provide.
|
@@ -99,7 +104,18 @@ module Eaco
|
|
99
104
|
accessor on <#{target}> that accepts and returns a <#{target.acl}>.
|
100
105
|
EOF
|
101
106
|
end
|
107
|
+
end
|
102
108
|
|
109
|
+
##
|
110
|
+
# Sets up the authorized collection extraction strategy
|
111
|
+
# (+.accessible_by+).
|
112
|
+
#
|
113
|
+
# This API can be implemented directly in your model, as long as
|
114
|
+
# +.accessible_by+ returns an +Enumerable+ collection.
|
115
|
+
#
|
116
|
+
# @return [void]
|
117
|
+
#
|
118
|
+
def install_strategy
|
103
119
|
unless target.respond_to?(:accessible_by)
|
104
120
|
strategies = adapter ? adapter.strategies.keys : []
|
105
121
|
|
data/lib/eaco/dsl/resource.rb
CHANGED
@@ -122,7 +122,7 @@ module Eaco
|
|
122
122
|
# @return [nil]
|
123
123
|
#
|
124
124
|
def croak(msg)
|
125
|
-
$stderr.puts fancy(msg)
|
125
|
+
$stderr.puts fancy(with_appraisal(msg))
|
126
126
|
end
|
127
127
|
|
128
128
|
##
|
@@ -135,6 +135,20 @@ module Eaco
|
|
135
135
|
raise RuntimeError, fancy(msg)
|
136
136
|
end
|
137
137
|
|
138
|
+
##
|
139
|
+
# Adds the current appraisal name to msg, if present
|
140
|
+
#
|
141
|
+
# @param msg [String]
|
142
|
+
# @return [String]
|
143
|
+
#
|
144
|
+
def with_appraisal(msg)
|
145
|
+
if appraisal
|
146
|
+
msg = "%s \033[1;31m[%s]" % [msg, appraisal]
|
147
|
+
end
|
148
|
+
|
149
|
+
return msg
|
150
|
+
end
|
151
|
+
|
138
152
|
##
|
139
153
|
# Makes +msg+ fancy.
|
140
154
|
#
|
@@ -142,7 +156,18 @@ module Eaco
|
|
142
156
|
# @return [String]
|
143
157
|
#
|
144
158
|
def fancy(msg)
|
145
|
-
">>>\n>>> EACO: #{msg}\n>>>\n"
|
159
|
+
"\n\033[1;32m>>>\n>>> EACO: \033[1;37m#{msg}\033[1;32m\n>>>\n\033[0m"
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# @return [String] the current appraisal name, or nil
|
164
|
+
#
|
165
|
+
def appraisal
|
166
|
+
return unless running_appraisals?
|
167
|
+
|
168
|
+
gemfile = ENV['BUNDLE_GEMFILE']
|
169
|
+
|
170
|
+
File.basename(gemfile, '.*') if gemfile
|
146
171
|
end
|
147
172
|
|
148
173
|
##
|
data/lib/eaco/resource.rb
CHANGED
@@ -37,7 +37,7 @@ module Eaco
|
|
37
37
|
# @param role [Symbol] role name.
|
38
38
|
#
|
39
39
|
def role?(role)
|
40
|
-
role.to_sym
|
40
|
+
roles.include?(role.to_sym)
|
41
41
|
end
|
42
42
|
|
43
43
|
##
|
@@ -65,8 +65,8 @@ module Eaco
|
|
65
65
|
end
|
66
66
|
|
67
67
|
##
|
68
|
-
# @return [Symbol] the given +actor+ role in the given resource, or
|
69
|
-
# access is granted.
|
68
|
+
# @return [Symbol] the given +actor+ role in the given resource, or
|
69
|
+
# +nil+ if no access is granted.
|
70
70
|
#
|
71
71
|
# @param actor_or_designator [Actor or Designator]
|
72
72
|
# @param resource [Resource]
|
@@ -103,28 +103,36 @@ module Eaco
|
|
103
103
|
##
|
104
104
|
# The permissions defined for each role.
|
105
105
|
#
|
106
|
-
# @
|
106
|
+
# @return [Hash] the defined permissions, keyed by +role+
|
107
|
+
#
|
108
|
+
# @see DSL::Resource::Permissions
|
107
109
|
#
|
108
110
|
def permissions
|
109
111
|
end
|
110
112
|
|
111
113
|
# The defined roles.
|
112
114
|
#
|
113
|
-
# @
|
115
|
+
# @return [Set]
|
116
|
+
#
|
117
|
+
# @see DSL::Resource
|
114
118
|
#
|
115
119
|
def roles
|
116
120
|
end
|
117
121
|
|
118
122
|
# Roles' priority map keyed by role symbol.
|
119
123
|
#
|
120
|
-
# @
|
124
|
+
# @return [Hash]
|
125
|
+
#
|
126
|
+
# @see DSL::Resource
|
121
127
|
#
|
122
128
|
def roles_priority
|
123
129
|
end
|
124
130
|
|
125
131
|
# Role labels map keyed by role symbol
|
126
132
|
#
|
127
|
-
# @
|
133
|
+
# @return [Hash]
|
134
|
+
#
|
135
|
+
# @see DSL::Resource
|
128
136
|
#
|
129
137
|
def roles_with_labels
|
130
138
|
end
|
data/lib/eaco/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eaco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcello Barnaba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: coveralls
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
description:
|
168
182
|
email:
|
169
183
|
- vjt@openssl.it
|
@@ -185,7 +199,8 @@ files:
|
|
185
199
|
- features/active_record.example.yml
|
186
200
|
- features/active_record.travis.yml
|
187
201
|
- features/rails_integration.feature
|
188
|
-
- features/
|
202
|
+
- features/role_based_authorization.feature
|
203
|
+
- features/step_definitions/actor_definition.rb
|
189
204
|
- features/step_definitions/resource_authorization.rb
|
190
205
|
- features/support/env.rb
|
191
206
|
- gemfiles/rails_3.2.gemfile
|
@@ -213,6 +228,8 @@ files:
|
|
213
228
|
- lib/eaco/cucumber/active_record/position.rb
|
214
229
|
- lib/eaco/cucumber/active_record/schema.rb
|
215
230
|
- lib/eaco/cucumber/active_record/user.rb
|
231
|
+
- lib/eaco/cucumber/active_record/user/designators.rb
|
232
|
+
- lib/eaco/cucumber/active_record/user/designators/user.rb
|
216
233
|
- lib/eaco/cucumber/world.rb
|
217
234
|
- lib/eaco/designator.rb
|
218
235
|
- lib/eaco/dsl.rb
|
@@ -273,7 +290,8 @@ test_files:
|
|
273
290
|
- features/active_record.example.yml
|
274
291
|
- features/active_record.travis.yml
|
275
292
|
- features/rails_integration.feature
|
276
|
-
- features/
|
293
|
+
- features/role_based_authorization.feature
|
294
|
+
- features/step_definitions/actor_definition.rb
|
277
295
|
- features/step_definitions/resource_authorization.rb
|
278
296
|
- features/support/env.rb
|
279
297
|
- spec/eaco/acl_spec.rb
|