arrthorizer 0.1.1 → 0.1.2
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.
- data/README.md +20 -2
- data/lib/arrthorizer.rb +4 -0
- data/lib/arrthorizer/rails/controller_action.rb +3 -0
- data/lib/arrthorizer/rails/controller_concern.rb +22 -1
- data/lib/arrthorizer/rspec.rb +16 -0
- data/lib/arrthorizer/rspec/matchers.rb +46 -0
- data/lib/arrthorizer/version.rb +1 -1
- data/lib/generators/arrthorizer/context_role/USAGE +14 -0
- data/lib/generators/arrthorizer/context_role/context_role_generator.rb +9 -0
- data/lib/generators/arrthorizer/context_role/templates/role.rb +16 -0
- data/lib/generators/arrthorizer/install/install_generator.rb +9 -0
- data/lib/generators/mini_test/context_role/context_role_generator.rb +11 -0
- data/lib/generators/mini_test/context_role/templates/role_test.rb +62 -0
- data/lib/generators/rspec/context_role/context_role_generator.rb +11 -0
- data/lib/generators/rspec/context_role/templates/role_spec.rb +53 -0
- data/lib/generators/test_unit/context_role/context_role_generator.rb +11 -0
- data/lib/generators/test_unit/context_role/templates/role_test.rb +61 -0
- data/spec/rails/controller_action/get_current_spec.rb +21 -0
- data/spec/rails/controller_concern/authorization_scope_spec.rb +30 -0
- data/spec/rails/controller_concern/authorize_spec.rb +38 -0
- data/spec/rails/controller_configuration/for_action_spec.rb +21 -0
- metadata +26 -3
data/README.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
[](https://codeclimate.com/github/BUS-OGD/arrthorizer)
|
2
2
|
[](https://travis-ci.org/BUS-OGD/arrthorizer)
|
3
|
+
[](https://gemnasium.com/BUS-OGD/arrthorizer)
|
4
|
+
[](http://badge.fury.io/rb/arrthorizer)
|
3
5
|
|
4
6
|
# Arrthorizer
|
5
7
|
|
6
|
-
|
8
|
+
Dynamic and static access control for your Rails (3+) application. Arrthorizer revolves around the concept of static roles (some kind of 'groups' the user can be a member of) and dynamic roles (detecting the relation the user has to the current context, like 'the writer of this blog post').
|
9
|
+
|
10
|
+
Arrthorizer is flexible and allows you to inject much of your own application logic into your authorization subsystem. It allows (that is, *requires*) you to determine which elements of a context are relevant for authorization and accepts your logic for determining whether a given user is part of a certain group.
|
11
|
+
|
12
|
+
Arrthorizer is [designed for ease of use and configurability](https://github.com/BUS-OGD/arrthorizer/wiki/Desired-and-required-features). Its Rails version (currently the *only* version) comes bundled with some useful generators and most of the configuration is done using a DSL in your controllers, along with a plain old YAML file.
|
7
13
|
|
8
14
|
## Installation
|
9
15
|
|
@@ -18,10 +24,22 @@ And then execute:
|
|
18
24
|
Or install it yourself as:
|
19
25
|
|
20
26
|
$ gem install arrthorizer
|
27
|
+
|
28
|
+
### Rails
|
29
|
+
|
30
|
+
After the above installation, run:
|
31
|
+
|
32
|
+
$ bin/rails g arrthorizer:install
|
21
33
|
|
22
34
|
## Usage
|
23
35
|
|
24
|
-
|
36
|
+
After using the `arrthorizer:install` generator, your `git diff` will tell you everything you need to know. *Read the comments* to understand what you need to do to make it work.
|
37
|
+
|
38
|
+
When new ContextRoles are required later on, [Arrthorizer provides a generator for that](https://github.com/BUS-OGD/arrthorizer/wiki/HOWTO:-Write-a-ContextRole), too:
|
39
|
+
|
40
|
+
$ bin/rails g arrthorizer:context_role {namespace_if_you_need_it/role_name}
|
41
|
+
|
42
|
+
This will generate a file containing the scaffold for the ContextRole and a couple of test cases for your test framework.
|
25
43
|
|
26
44
|
## Contributing
|
27
45
|
|
data/lib/arrthorizer.rb
CHANGED
@@ -3,6 +3,7 @@ module Arrthorizer
|
|
3
3
|
class ControllerAction
|
4
4
|
ControllerNotDefined = Class.new(Arrthorizer::ArrthorizerException)
|
5
5
|
ActionNotDefined = Class.new(Arrthorizer::ArrthorizerException)
|
6
|
+
ActionNotConfigured = Class.new(Arrthorizer::ArrthorizerException)
|
6
7
|
|
7
8
|
attr_accessor :privilege
|
8
9
|
attr_reader :controller_path, :action_name
|
@@ -31,6 +32,8 @@ module Arrthorizer
|
|
31
32
|
|
32
33
|
def self.fetch(key)
|
33
34
|
registry.fetch(key)
|
35
|
+
rescue Arrthorizer::Registry::NotFound
|
36
|
+
raise ActionNotConfigured, "No privileges granted for #{key}"
|
34
37
|
end
|
35
38
|
|
36
39
|
def self.register(controller_action)
|
@@ -6,6 +6,11 @@ module Arrthorizer
|
|
6
6
|
included do
|
7
7
|
protected
|
8
8
|
class_attribute :arrthorizer_configuration, instance_writer: false
|
9
|
+
class_attribute :arrthorizer_scope, instance_writer: false
|
10
|
+
|
11
|
+
def arrthorizer_scope
|
12
|
+
send(self.class.arrthorizer_scope || :current_user)
|
13
|
+
end
|
9
14
|
|
10
15
|
##
|
11
16
|
# This is a hook method that provides access to the context for a
|
@@ -23,9 +28,16 @@ module Arrthorizer
|
|
23
28
|
def authorize
|
24
29
|
action = Arrthorizer::Rails::ControllerAction.get_current(self)
|
25
30
|
roles = action.privilege.permitted_roles
|
31
|
+
scope = arrthorizer_scope
|
26
32
|
|
27
33
|
roles.any? do |role|
|
28
|
-
|
34
|
+
begin
|
35
|
+
role.applies_to_user?(scope, arrthorizer_context)
|
36
|
+
rescue StandardError
|
37
|
+
::Rails.logger.warn("Error occurred while evaluating #{role} for #{current_user}.\nCurrent context: #{arrthorizer_context.inspect}")
|
38
|
+
|
39
|
+
false
|
40
|
+
end
|
29
41
|
end || forbidden
|
30
42
|
end
|
31
43
|
|
@@ -39,6 +51,15 @@ module Arrthorizer
|
|
39
51
|
end
|
40
52
|
|
41
53
|
module ClassMethods
|
54
|
+
##
|
55
|
+
# This method tells Arrthorizer the name of the method that it is supposed
|
56
|
+
# to use to find the user who is currently attempting to use a certain
|
57
|
+
# controller action. This user is subsequently passed into all role
|
58
|
+
# verifications.
|
59
|
+
def authorization_scope(scope)
|
60
|
+
self.arrthorizer_scope = scope
|
61
|
+
end
|
62
|
+
|
42
63
|
##
|
43
64
|
# This method sets up Arrthorizer to verify that a user has the proper
|
44
65
|
# rights to access a # given controller action. Options can be provided
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
module Arrthorizer
|
4
|
+
module RSpec
|
5
|
+
autoload :Matchers, 'arrthorizer/rspec/matchers'
|
6
|
+
end
|
7
|
+
|
8
|
+
::RSpec.configure do |config|
|
9
|
+
config.include Arrthorizer::RSpec::Matchers::Roles, {
|
10
|
+
type: :role,
|
11
|
+
example_group: { file_path: %r(spec/roles) }
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
module Arrthorizer
|
4
|
+
module RSpec
|
5
|
+
module Matchers
|
6
|
+
module Roles
|
7
|
+
class AppliesToUser
|
8
|
+
def initialize(user)
|
9
|
+
@user = user
|
10
|
+
end
|
11
|
+
|
12
|
+
def matches?(role)
|
13
|
+
@role = role
|
14
|
+
|
15
|
+
role.applies_to_user?(user, context)
|
16
|
+
end
|
17
|
+
|
18
|
+
def failure_message
|
19
|
+
"Expected role #{@role.name} to apply in context #{context.inspect}\nfor user #{user.inspect}, but it does not apply!"
|
20
|
+
end
|
21
|
+
|
22
|
+
def negative_failure_message
|
23
|
+
"Expected role #{@role.name} not to apply in context #{context.inspect}\nfor user #{user.inspect}, but it applies!"
|
24
|
+
end
|
25
|
+
|
26
|
+
def with_context(hash)
|
27
|
+
@context = to_context(hash)
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
attr_accessor :context, :user
|
34
|
+
|
35
|
+
def to_context(context_hash)
|
36
|
+
Arrthorizer::Context.new(context_hash)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def apply_to_user(user, context = {})
|
41
|
+
AppliesToUser.new(user).with_context(context)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/arrthorizer/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
Description:
|
2
|
+
Generate a template for a new Arrthorizer::ContextRole
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate context_role forum/post_author
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
app/roles/forum/post_author.rb
|
9
|
+
|
10
|
+
and a unit test file for the new role, depending
|
11
|
+
on your framework:
|
12
|
+
rspec: spec/roles/forum/post_author_spec.rb
|
13
|
+
test_unit: test/roles/forum/post_author_test.rb
|
14
|
+
mini_test: test/roles/forum/post_author_test.rb
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% inner = capture do -%>
|
2
|
+
class <%= file_name.camelize %> < Arrthorizer::ContextRole
|
3
|
+
def applies_to_user?(user, context)
|
4
|
+
# TODO: insert logic here
|
5
|
+
false
|
6
|
+
end
|
7
|
+
end
|
8
|
+
<% end -%>
|
9
|
+
<% regular_class_path.reverse.map do |mod| -%>
|
10
|
+
<% inner = capture do -%>
|
11
|
+
module <%= mod.camelize %>
|
12
|
+
<%= indent(inner,2) -%>
|
13
|
+
end
|
14
|
+
<% end -%>
|
15
|
+
<% end -%>
|
16
|
+
<%= inner %>
|
@@ -13,10 +13,19 @@ module Arrthorizer
|
|
13
13
|
|
14
14
|
def activate_filter
|
15
15
|
insert_into_file 'app/controllers/application_controller.rb', filter_code, after: /class ApplicationController.*$/
|
16
|
+
insert_into_file 'app/controllers/application_controller.rb', scope_code, after: /class ApplicationController.*$/
|
16
17
|
insert_into_file 'app/controllers/application_controller.rb', context_preparation_code, before: /end$\s*\z/
|
17
18
|
end
|
18
19
|
|
19
20
|
protected
|
21
|
+
def scope_code
|
22
|
+
<<-SCOPE_CODE
|
23
|
+
# Tell Arrthorizer how to find the user who needs to be authorized to execute
|
24
|
+
# a given controller action
|
25
|
+
authorization_scope :current_user
|
26
|
+
SCOPE_CODE
|
27
|
+
end
|
28
|
+
|
20
29
|
def filter_code
|
21
30
|
<<-FILTER_CODE
|
22
31
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class <%= class_name %>Test < ActiveSupport::TestCase
|
4
|
+
def user
|
5
|
+
@user ||= OpenStruct.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def context_hash
|
9
|
+
@context_hash ||= {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def current_context
|
13
|
+
Arrthorizer::Context.new(context_hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
def role
|
17
|
+
<%= class_name %>
|
18
|
+
end
|
19
|
+
|
20
|
+
def make_role_apply!
|
21
|
+
# TODO: make the changes to the context_hash that make the role
|
22
|
+
# apply to the user
|
23
|
+
end
|
24
|
+
|
25
|
+
def make_role_not_apply!
|
26
|
+
# TODO: make the changes to the context_hash that make the role
|
27
|
+
# *not* apply to the user
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_returns_true_when_some_context
|
31
|
+
make_role_apply!
|
32
|
+
|
33
|
+
failure_message = "Expected #{role} to apply when context = #{current_context}"
|
34
|
+
assert role.applies_to_user?(user, current_context), failure_message
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_returns_false_when_some_other_context
|
38
|
+
make_role_not_apply!
|
39
|
+
|
40
|
+
failure_message = "Expected #{role} not_to apply when context = #{current_context}"
|
41
|
+
refute role.applies_to_user?(user, current_context), failure_message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_when_true_no_state_is_maintained_in_instance
|
45
|
+
make_role_apply!
|
46
|
+
|
47
|
+
role.applies_to_user?(user, current_context)
|
48
|
+
ivars = role.instance.instance_variables
|
49
|
+
|
50
|
+
failure_message = "Expected apply_to_user? not to change state for #{role} (on instance), but it did"
|
51
|
+
assert_empty ivars, failure_message
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_when_false_no_state_is_maintained_in_instance
|
55
|
+
make_role_not_apply!
|
56
|
+
|
57
|
+
failure_message = "Expected apply_to_user? not to change state for #{role} (on instance), but it did"
|
58
|
+
ivars = role.instance.instance_variables
|
59
|
+
|
60
|
+
assert_empty ivars, failure_message
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe <%= class_name %> do
|
4
|
+
subject(:role) { <%= class_name %> }
|
5
|
+
|
6
|
+
let(:user) { double(:user) }
|
7
|
+
|
8
|
+
let(:context_hash) { { } }
|
9
|
+
let(:current_context) { Arrthorizer::Context.new(context_hash) }
|
10
|
+
|
11
|
+
describe :applies_to_user? do
|
12
|
+
context "when some_condition" do
|
13
|
+
before :each do
|
14
|
+
# TODO: Add the required elements to the context_hash to make the ContextRole apply to the user
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns true" do
|
18
|
+
pending
|
19
|
+
|
20
|
+
expect(role.applies_to_user?(user, current_context)).to be_true
|
21
|
+
end
|
22
|
+
|
23
|
+
# This is an extremely important test - it safeguards against
|
24
|
+
# persisting data between requests.
|
25
|
+
specify "no state is maintained in the role object" do
|
26
|
+
role.applies_to_user?(user, current_context)
|
27
|
+
|
28
|
+
role.instance.instance_variables.should be_empty
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when some_other_condition" do
|
33
|
+
before :each do
|
34
|
+
# TODO: Add the required elements to the context_hash
|
35
|
+
# to make the ContextRole *not* apply to the user
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns false" do
|
39
|
+
pending
|
40
|
+
|
41
|
+
expect(role.applies_to_user?(user, current_context)).to be_false
|
42
|
+
end
|
43
|
+
|
44
|
+
# This is an extremely important test - it safeguards against
|
45
|
+
# persisting data between requests.
|
46
|
+
specify "no state is maintained in the role object" do
|
47
|
+
role.applies_to_user?(user, current_context)
|
48
|
+
|
49
|
+
role.instance.instance_variables.should be_empty
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class <%= class_name %>Test < ActiveSupport::TestCase
|
4
|
+
def user
|
5
|
+
@user ||= OpenStruct.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def context_hash
|
9
|
+
@context_hash ||= {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def current_context
|
13
|
+
Arrthorizer::Context.new(context_hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
def role
|
17
|
+
<%= class_name %>
|
18
|
+
end
|
19
|
+
|
20
|
+
def make_role_apply!
|
21
|
+
# TODO: make the changes to the context_hash that make the role
|
22
|
+
# apply to the user
|
23
|
+
end
|
24
|
+
|
25
|
+
def make_role_not_apply!
|
26
|
+
# TODO: make the changes to the context_hash that make the role
|
27
|
+
# *not* apply to the user
|
28
|
+
end
|
29
|
+
|
30
|
+
test "returns true when some context" do
|
31
|
+
make_role_apply!
|
32
|
+
|
33
|
+
failure_message = "Expected #{role} to apply when context = #{current_context}"
|
34
|
+
assert role.applies_to_user?(user, current_context), failure_message
|
35
|
+
end
|
36
|
+
|
37
|
+
test "returns false when some other context" do
|
38
|
+
make_role_not_apply!
|
39
|
+
|
40
|
+
failure_message = "Expected #{role} not_to apply when context = #{current_context}"
|
41
|
+
assert !role.applies_to_user?(user, current_context), failure_message
|
42
|
+
end
|
43
|
+
|
44
|
+
test "when true no state is maintained in role" do
|
45
|
+
make_role_apply!
|
46
|
+
|
47
|
+
role.applies_to_user?(user, current_context)
|
48
|
+
|
49
|
+
failure_message = "Expected apply_to_user? not to change state for #{role} (on instance), but it did"
|
50
|
+
assert_empty role.instance.instance_variables, failure_message
|
51
|
+
end
|
52
|
+
|
53
|
+
test "when false no state is maintained in role" do
|
54
|
+
make_role_not_apply!
|
55
|
+
|
56
|
+
role.applies_to_user?(user, current_context)
|
57
|
+
|
58
|
+
failure_message = "Expected apply_to_user? not to change state for #{role} (on instance), but it did"
|
59
|
+
assert_empty role.instance.instance_variables, failure_message
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arrthorizer::Rails::ControllerAction do
|
4
|
+
describe :get_current do
|
5
|
+
let(:controller) { double('controller') }
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
Arrthorizer::Rails::ControllerAction.stub(:key_for).with(controller).and_return("controller#action")
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when there is no configuration for the current action" do
|
12
|
+
let(:expected_error) { Arrthorizer::Rails::ControllerAction::ActionNotConfigured }
|
13
|
+
|
14
|
+
specify "an ActionNotConfigured exception is raised" do
|
15
|
+
expect {
|
16
|
+
Arrthorizer::Rails::ControllerAction.get_current(controller)
|
17
|
+
}.to raise_error(expected_error)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Arrthorizer::Rails::ControllerConcern do
|
4
|
+
describe :authorization_scope do
|
5
|
+
let(:controller) { SomeController.new }
|
6
|
+
|
7
|
+
context "when no scope is explicitly configured" do
|
8
|
+
specify "the default of :current_user is tried" do
|
9
|
+
expect(controller).to receive(:current_user)
|
10
|
+
|
11
|
+
controller.send(:arrthorizer_scope)
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when a different scope is explicitly configured" do
|
15
|
+
let(:controller_class) { Class.new(SomeController) }
|
16
|
+
let(:controller) { controller_class.new }
|
17
|
+
|
18
|
+
before :each do
|
19
|
+
controller_class.authorization_scope :some_other_method
|
20
|
+
end
|
21
|
+
|
22
|
+
specify "that scope is used for authorization" do
|
23
|
+
expect(controller).to receive(:some_other_method)
|
24
|
+
|
25
|
+
controller.send(:arrthorizer_scope)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -107,6 +107,44 @@ describe Arrthorizer::Rails::ControllerConcern do
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
context "but evaluating the role raises any kind of StandardError" do
|
112
|
+
before do
|
113
|
+
role.stub(:applies_to_user?).with(current_user, context).and_raise("Some exception")
|
114
|
+
end
|
115
|
+
|
116
|
+
specify "a warning is logged" do
|
117
|
+
# for testing purposes. We're testing a filter here, so no request exists, causing #status= to fail
|
118
|
+
controller.stub(:forbidden)
|
119
|
+
|
120
|
+
expect(::Rails.logger).to receive(:warn).with(an_instance_of(String))
|
121
|
+
|
122
|
+
controller.send(:authorize)
|
123
|
+
end
|
124
|
+
|
125
|
+
context "but more roles are provided access" do
|
126
|
+
let(:another_role){ Arrthorizer::Group.new("some other role") }
|
127
|
+
|
128
|
+
before :each do
|
129
|
+
another_role.stub(:applies_to_user?).and_return(true)
|
130
|
+
permitted_roles.add(another_role)
|
131
|
+
end
|
132
|
+
|
133
|
+
specify "those roles are checked next" do
|
134
|
+
expect(another_role).to receive(:applies_to_user?)
|
135
|
+
|
136
|
+
controller.send(:authorize)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "and no other roles are provided access" do
|
141
|
+
specify "a #forbidden handler is triggered" do
|
142
|
+
expect(controller).to receive(:forbidden)
|
143
|
+
|
144
|
+
controller.send(:authorize)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
110
148
|
end
|
111
149
|
end
|
112
150
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Arrthorizer::Rails::ControllerConfiguration do
|
4
|
+
let(:config) { Arrthorizer::Rails::ControllerConfiguration.new do end }
|
5
|
+
|
6
|
+
describe :for_action do
|
7
|
+
context "when multiple actions are provided" do
|
8
|
+
let(:actions) { [:show, :index] }
|
9
|
+
|
10
|
+
it "calls add_action_block with each of those actions" do
|
11
|
+
actions.each do |action|
|
12
|
+
expect(config).to receive(:add_action_block).with(action)
|
13
|
+
end
|
14
|
+
|
15
|
+
config.for_action *actions do
|
16
|
+
{}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arrthorizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -109,10 +109,21 @@ files:
|
|
109
109
|
- lib/arrthorizer/registry.rb
|
110
110
|
- lib/arrthorizer/role.rb
|
111
111
|
- lib/arrthorizer/roles.rb
|
112
|
+
- lib/arrthorizer/rspec.rb
|
113
|
+
- lib/arrthorizer/rspec/matchers.rb
|
112
114
|
- lib/arrthorizer/version.rb
|
115
|
+
- lib/generators/arrthorizer/context_role/USAGE
|
116
|
+
- lib/generators/arrthorizer/context_role/context_role_generator.rb
|
117
|
+
- lib/generators/arrthorizer/context_role/templates/role.rb
|
113
118
|
- lib/generators/arrthorizer/install/USAGE
|
114
119
|
- lib/generators/arrthorizer/install/install_generator.rb
|
115
120
|
- lib/generators/arrthorizer/install/templates/config.yml
|
121
|
+
- lib/generators/mini_test/context_role/context_role_generator.rb
|
122
|
+
- lib/generators/mini_test/context_role/templates/role_test.rb
|
123
|
+
- lib/generators/rspec/context_role/context_role_generator.rb
|
124
|
+
- lib/generators/rspec/context_role/templates/role_spec.rb
|
125
|
+
- lib/generators/test_unit/context_role/context_role_generator.rb
|
126
|
+
- lib/generators/test_unit/context_role/templates/role_test.rb
|
116
127
|
- spec/arrthorizer_exception/inner_spec.rb
|
117
128
|
- spec/context/equals_spec.rb
|
118
129
|
- spec/context/merge_spec.rb
|
@@ -156,13 +167,16 @@ files:
|
|
156
167
|
- spec/privilege/initialize_spec.rb
|
157
168
|
- spec/privilege/make_accessible_to_spec.rb
|
158
169
|
- spec/rails/.gitkeep
|
170
|
+
- spec/rails/controller_action/get_current_spec.rb
|
159
171
|
- spec/rails/controller_action/initialize_spec.rb
|
160
172
|
- spec/rails/controller_action/key_for_spec.rb
|
161
173
|
- spec/rails/controller_action/to_key_spec.rb
|
162
174
|
- spec/rails/controller_concern/arrthorizer_context_spec.rb
|
175
|
+
- spec/rails/controller_concern/authorization_scope_spec.rb
|
163
176
|
- spec/rails/controller_concern/authorize_spec.rb
|
164
177
|
- spec/rails/controller_concern/integration_spec.rb
|
165
178
|
- spec/rails/controller_concern/to_prepare_context_spec.rb
|
179
|
+
- spec/rails/controller_configuration/for_action_spec.rb
|
166
180
|
- spec/rails/controller_configuration/initialize_spec.rb
|
167
181
|
- spec/role/get_spec.rb
|
168
182
|
- spec/role/shared_examples/finding_the_right_role.rb
|
@@ -180,15 +194,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
194
|
- - ! '>='
|
181
195
|
- !ruby/object:Gem::Version
|
182
196
|
version: '0'
|
197
|
+
segments:
|
198
|
+
- 0
|
199
|
+
hash: -2335547421098657015
|
183
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
201
|
none: false
|
185
202
|
requirements:
|
186
203
|
- - ! '>='
|
187
204
|
- !ruby/object:Gem::Version
|
188
205
|
version: '0'
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
hash: -2335547421098657015
|
189
209
|
requirements: []
|
190
210
|
rubyforge_project:
|
191
|
-
rubygems_version: 1.8.
|
211
|
+
rubygems_version: 1.8.24
|
192
212
|
signing_key:
|
193
213
|
specification_version: 3
|
194
214
|
summary: Contextual authorization for your Rails (3+) application
|
@@ -236,13 +256,16 @@ test_files:
|
|
236
256
|
- spec/privilege/initialize_spec.rb
|
237
257
|
- spec/privilege/make_accessible_to_spec.rb
|
238
258
|
- spec/rails/.gitkeep
|
259
|
+
- spec/rails/controller_action/get_current_spec.rb
|
239
260
|
- spec/rails/controller_action/initialize_spec.rb
|
240
261
|
- spec/rails/controller_action/key_for_spec.rb
|
241
262
|
- spec/rails/controller_action/to_key_spec.rb
|
242
263
|
- spec/rails/controller_concern/arrthorizer_context_spec.rb
|
264
|
+
- spec/rails/controller_concern/authorization_scope_spec.rb
|
243
265
|
- spec/rails/controller_concern/authorize_spec.rb
|
244
266
|
- spec/rails/controller_concern/integration_spec.rb
|
245
267
|
- spec/rails/controller_concern/to_prepare_context_spec.rb
|
268
|
+
- spec/rails/controller_configuration/for_action_spec.rb
|
246
269
|
- spec/rails/controller_configuration/initialize_spec.rb
|
247
270
|
- spec/role/get_spec.rb
|
248
271
|
- spec/role/shared_examples/finding_the_right_role.rb
|