cantango 0.9.4.1 → 0.9.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +3 -3
- data/VERSION +1 -1
- data/cantango.gemspec +2 -2
- data/lib/cantango/ability_executor.rb +1 -0
- data/lib/cantango/api/user/ability.rb +2 -2
- data/lib/cantango/api/user/can.rb +3 -3
- data/lib/cantango/api/user/session.rb +0 -5
- data/lib/cantango/api/user_account/ability.rb +2 -2
- data/lib/cantango/model/scope.rb +0 -1
- data/lib/cantango/permit_engine.rb +1 -1
- data/lib/cantango/permits/executor.rb +2 -1
- data/lib/cantango/permits/permit.rb +1 -1
- data/lib/cantango/permits/role_group_permit.rb +3 -2
- data/lib/cantango/permits/role_permit.rb +3 -2
- data/lib/cantango/users/macros.rb +1 -1
- data/lib/cantango/users/user.rb +1 -1
- data/lib/generators/cantango/account_permit/templates/account_permit.erb +10 -0
- data/lib/generators/cantango/permit_generator.rb +1 -0
- data/lib/generators/cantango/role_permit/templates/role_group_permit.erb +10 -0
- data/lib/generators/cantango/role_permit/templates/role_permit.erb +10 -0
- data/lib/generators/cantango/user_permit/templates/user_permit.erb +10 -0
- data/spec/active_record/scenarios/engines/permission_engine/tango_permission_yml_spec.rb +1 -1
- data/spec/active_record/scenarios/engines/permit_engine/licenses_spec.rb +3 -3
- data/spec/active_record/scenarios/engines/permit_engine/role_groups_permits_spec.rb +3 -3
- data/spec/active_record/scenarios/guest_user_admin/admin_user_spec.rb +1 -1
- data/spec/active_record/scenarios/guest_user_admin/editor_spec.rb +1 -1
- data/spec/active_record/scenarios/guest_user_admin/guest_user_spec.rb +1 -1
- data/spec/active_record/scenarios/guest_user_admin/user_having_user_and_editor_roles_spec.rb +1 -1
- data/spec/active_record/scenarios/guest_user_admin/user_spec.rb +1 -1
- data/spec/active_record/scenarios/masquerading/masquerading_for_admin_account_spec.rb +5 -5
- data/spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb +2 -2
- data/spec/cantango/api/user/ability_api_spec.rb +6 -6
- data/spec/cantango/api/user/can_api_spec.rb +9 -9
- data/spec/cantango/api/user_account/ability_api_spec.rb +1 -1
- data/spec/cantango/permits/custom_permit_spec.rb +4 -14
- data/spec/integration/performance/helpers/ability_api.rb +3 -4
- metadata +33 -33
data/README.textile
CHANGED
@@ -35,9 +35,9 @@ Run bundler in a terminal/console from the folder of your Gemfile (root folder o
|
|
35
35
|
|
36
36
|
@$ bundle@
|
37
37
|
|
38
|
-
h2. Update Nov
|
38
|
+
h2. Update Nov 4, 2011
|
39
39
|
|
40
|
-
Version 0.9.4.
|
40
|
+
Version 0.9.4.2 has been released with the following features and improvements:
|
41
41
|
|
42
42
|
* Redesign of Cache and Ability execution
|
43
43
|
* Caching at the individual engine level that can be switched (configured) on/off
|
@@ -46,7 +46,7 @@ Version 0.9.4.1 has been released with the following featuring and improvements:
|
|
46
46
|
* Caching for the new User AC engine
|
47
47
|
* Ability to register your own Permit base classes simply by subclassing CanTango::Permit!
|
48
48
|
* This is useful if you want to go beyond the built in types, see the @custom_permit_spec.rb@ for an example
|
49
|
-
* Some bug fixes
|
49
|
+
* Some bug fixes!
|
50
50
|
|
51
51
|
The :user_ac engine is a port of the Permission system from the _Rails in Action_ book.
|
52
52
|
With this engine a user can have many permissions defined, where each such permission is a persisted Permission model instance that describes a 'can' action on a specific type of object.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.4.
|
1
|
+
0.9.4.2
|
data/cantango.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cantango}
|
8
|
-
s.version = "0.9.4.
|
8
|
+
s.version = "0.9.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Kristian Mandrup}, %q{Stanislaw Pankevich}]
|
12
|
-
s.date = %q{2011-11-
|
12
|
+
s.date = %q{2011-11-04}
|
13
13
|
s.description = %q{Define your permission rules as role- or role group specific permits.
|
14
14
|
Integrates well with multiple Devise user acounts.
|
15
15
|
Includes rules caching.
|
@@ -3,10 +3,10 @@ module CanTango
|
|
3
3
|
module User
|
4
4
|
module Ability
|
5
5
|
def user_ability user, options = {}
|
6
|
-
|
6
|
+
create_ability(user, ability_options.merge(options))
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def current_user_ability user_type = :user
|
10
10
|
user_ability get_ability_user(user_type)
|
11
11
|
end
|
12
12
|
|
@@ -5,17 +5,17 @@ module CanTango
|
|
5
5
|
include Ability
|
6
6
|
# Example: generated from types of accounts! (see below)
|
7
7
|
# def admin_can?(*args)
|
8
|
-
#
|
8
|
+
# current_user_ability(:admin).can?(*args)
|
9
9
|
# end
|
10
10
|
def self.included(base)
|
11
11
|
::CanTango.config.users.registered.each do |user|
|
12
12
|
base.class_eval %{
|
13
13
|
def #{user}_can? *args
|
14
|
-
|
14
|
+
current_user_ability(:#{user}).can?(*args)
|
15
15
|
end
|
16
16
|
|
17
17
|
def #{user}_cannot? *args
|
18
|
-
|
18
|
+
current_user_ability(:#{user}).cannot?(*args)
|
19
19
|
end
|
20
20
|
}
|
21
21
|
end
|
@@ -2,11 +2,6 @@ module CanTango
|
|
2
2
|
module Api
|
3
3
|
module User
|
4
4
|
module Session
|
5
|
-
# Example: generated from types of accounts! (see below)
|
6
|
-
# def admin_can?(*args)
|
7
|
-
# current_ability(:admin).can?(*args)
|
8
|
-
# end
|
9
|
-
|
10
5
|
def self.included(base)
|
11
6
|
::CanTango.config.users.registered.each do |user|
|
12
7
|
base.class_eval %{
|
@@ -3,12 +3,12 @@ module CanTango
|
|
3
3
|
module UserAccount
|
4
4
|
module Ability
|
5
5
|
def user_account_ability user_account, options = {}
|
6
|
-
@
|
6
|
+
@account_ability ||= create_ability(user_account, ability_options.merge(options))
|
7
7
|
end
|
8
8
|
alias_method :account_ability, :user_account_ability
|
9
9
|
|
10
10
|
def current_account_ability user_type = :user
|
11
|
-
|
11
|
+
user_account_ability get_ability_user_account
|
12
12
|
end
|
13
13
|
|
14
14
|
protected
|
data/lib/cantango/model/scope.rb
CHANGED
@@ -67,7 +67,7 @@ module CanTango
|
|
67
67
|
def key_method_names
|
68
68
|
permits.keys.map do |permit|
|
69
69
|
permit_class = CanTango.config.permits.available_permits[permit]
|
70
|
-
permit_class.hash_key
|
70
|
+
permit_class.hash_key if permit_class && permit_class.respond_to?(:hash_key)
|
71
71
|
end.compact
|
72
72
|
end
|
73
73
|
end
|
@@ -44,7 +44,8 @@ module CanTango
|
|
44
44
|
|
45
45
|
def key_method_names
|
46
46
|
permit_class = CanTango.config.permits.available_permits[permit_type]
|
47
|
-
permit_class.hash_key
|
47
|
+
key = permit_class.hash_key if permit_class && permit_class.respond_to?(:hash_key)
|
48
|
+
key ? [key] : []
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
@@ -50,13 +50,14 @@ module CanTango
|
|
50
50
|
in_role_group? subject
|
51
51
|
end
|
52
52
|
|
53
|
-
def hash_key
|
54
|
-
|
53
|
+
def self.hash_key
|
54
|
+
role_groups_list_meth
|
55
55
|
end
|
56
56
|
|
57
57
|
protected
|
58
58
|
|
59
59
|
include CanTango::Helpers::RoleMethods
|
60
|
+
extend CanTango::Helpers::RoleMethods
|
60
61
|
|
61
62
|
def in_role_group? subject
|
62
63
|
has_role_group?(subject) || role_groups_of(subject).include?(role)
|
@@ -49,13 +49,14 @@ module CanTango
|
|
49
49
|
in_role? subject
|
50
50
|
end
|
51
51
|
|
52
|
-
def hash_key
|
53
|
-
|
52
|
+
def self.hash_key
|
53
|
+
roles_list_meth
|
54
54
|
end
|
55
55
|
|
56
56
|
protected
|
57
57
|
|
58
58
|
include CanTango::Helpers::RoleMethods
|
59
|
+
extend CanTango::Helpers::RoleMethods
|
59
60
|
|
60
61
|
def in_role? subject
|
61
62
|
return subject.send(has_role_meth, role) if subject.respond_to? has_role_meth
|
@@ -9,7 +9,7 @@ class Module
|
|
9
9
|
self.send :include, CanTango::Users::UserAccount
|
10
10
|
self.send :include, CanTango::Users::Masquerade if options[:masquerade]
|
11
11
|
end
|
12
|
-
alias_method :tango_account, :tango_user_account
|
12
|
+
alias_method :tango_account, :tango_user_account
|
13
13
|
alias_method :cantango_account, :tango_user_account
|
14
14
|
|
15
15
|
def masquerader
|
data/lib/cantango/users/user.rb
CHANGED
@@ -10,4 +10,14 @@ class <%= account.to_s.camelize %>AccountPermit < CanTango::AccountPermit
|
|
10
10
|
<%= permit_logic.strip %>
|
11
11
|
<%= license_logic %>
|
12
12
|
end
|
13
|
+
|
14
|
+
module Cached
|
15
|
+
def permit_rules
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module NonCached
|
20
|
+
def permit_rules
|
21
|
+
end
|
22
|
+
end
|
13
23
|
end
|
@@ -10,5 +10,15 @@ class <%= permit_name.to_s.camelize %>RoleGroupPermit < CanTango::RoleGroupPermi
|
|
10
10
|
<%= rules_logic.strip %>
|
11
11
|
<%= license_logic %>
|
12
12
|
end
|
13
|
+
|
14
|
+
module Cached
|
15
|
+
def permit_rules
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module NonCached
|
20
|
+
def permit_rules
|
21
|
+
end
|
22
|
+
end
|
13
23
|
end
|
14
24
|
|
@@ -23,7 +23,7 @@ describe 'Cantango config: permissions.yml' do
|
|
23
23
|
}
|
24
24
|
|
25
25
|
let(:current_user) { @user }
|
26
|
-
let(:ability) {
|
26
|
+
let(:ability) { current_user_ability(:user) }
|
27
27
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
28
28
|
let(:specific_post) { Post.create(:body => "Nice!") }
|
29
29
|
|
@@ -16,12 +16,12 @@ describe 'Licenses usage' do
|
|
16
16
|
}
|
17
17
|
|
18
18
|
let(:current_user) { @user }
|
19
|
-
let(:ability) {
|
19
|
+
let(:ability) { current_user_ability(:user) }
|
20
20
|
|
21
21
|
it "should be allowed to read Song" do
|
22
22
|
ability.should be_allowed_to(:read, Song)
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should be allowed to write Tune" do
|
26
26
|
ability.should be_allowed_to(:write, Tune)
|
27
27
|
end
|
@@ -29,7 +29,7 @@ describe 'Licenses usage' do
|
|
29
29
|
it "should be allowed to manage Concerto" do
|
30
30
|
ability.should be_allowed_to(:read, Concerto)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should be allowed to write Tune" do
|
34
34
|
ability.should_not be_allowed_to(:manage, Improvisation)
|
35
35
|
end
|
@@ -15,12 +15,12 @@ describe 'RoleGroupPermit usage' do
|
|
15
15
|
}
|
16
16
|
|
17
17
|
let(:current_user) { @user }
|
18
|
-
let(:ability) {
|
18
|
+
let(:ability) { current_user_ability(:user) }
|
19
19
|
|
20
20
|
it "should be allowed to read Song" do
|
21
21
|
ability.should be_allowed_to(:read, Song)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it "should be allowed to write Tune" do
|
25
25
|
ability.should be_allowed_to(:write, Tune)
|
26
26
|
end
|
@@ -28,7 +28,7 @@ describe 'RoleGroupPermit usage' do
|
|
28
28
|
it "should be allowed to manage Concerto" do
|
29
29
|
ability.should be_allowed_to(:read, Concerto)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should be allowed to write Tune" do
|
33
33
|
ability.should_not be_allowed_to(:manage, Improvisation)
|
34
34
|
end
|
@@ -10,7 +10,7 @@ describe 'Scenario: users - :guest, :user, :admin' do
|
|
10
10
|
|
11
11
|
it_should_behave_like "Admin role" do
|
12
12
|
let(:current_admin) { @user }
|
13
|
-
let(:user) {
|
13
|
+
let(:user) { current_user_ability(:admin) }
|
14
14
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
15
15
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
16
16
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -10,7 +10,7 @@ describe 'Scenario: users - :guest, :user, :admin' do
|
|
10
10
|
|
11
11
|
it_should_behave_like "Editor role" do
|
12
12
|
let(:current_user) { @user }
|
13
|
-
let(:user) {
|
13
|
+
let(:user) { current_user_ability(:user) }
|
14
14
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
15
15
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
16
16
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
data/spec/active_record/scenarios/guest_user_admin/user_having_user_and_editor_roles_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe 'Scenario: users - :guest, :user, :admin' do
|
|
10
10
|
|
11
11
|
it_should_behave_like "User + Editor roles" do
|
12
12
|
let(:current_user) { @user }
|
13
|
-
let(:user) {
|
13
|
+
let(:user) { current_user_ability(:user) }
|
14
14
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
15
15
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
16
16
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -14,7 +14,7 @@ describe 'Scenario: users - :guest, :user, :admin' do
|
|
14
14
|
|
15
15
|
it_should_behave_like "User role" do
|
16
16
|
let(:current_user) { @user }
|
17
|
-
let(:user) {
|
17
|
+
let(:user) { current_user_ability(:user) }
|
18
18
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
19
19
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
20
20
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -13,26 +13,26 @@ describe 'Scenario: masquerading for admin account' do
|
|
13
13
|
before(:each) do
|
14
14
|
admin_account.masquerade_as user_profile
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it_should_behave_like "User role" do
|
18
18
|
let(:current_admin) { admin_account }
|
19
|
-
let(:user) {
|
19
|
+
let(:user) { current_user_ability(:admin) }
|
20
20
|
let(:own_article) { Article.create!(:user_id => user_profile.id) }
|
21
21
|
let(:own_post) { Post.create(:user_id => user_profile.id) }
|
22
22
|
let(:own_comment) { Comment.create(:user_id => user_profile.id) }
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
context "Masquerading as editor" do
|
27
27
|
before(:each) do
|
28
28
|
@user = User.create!(:role => "editor")
|
29
29
|
@admin = Admin.create!(:name => "kris")
|
30
30
|
@admin.masquerade_as @user
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it_should_behave_like "Editor role" do
|
34
34
|
let(:current_user) { @admin }
|
35
|
-
let(:user) {
|
35
|
+
let(:user) { current_user_ability(:user) }
|
36
36
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
37
37
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
38
38
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -13,7 +13,7 @@ describe 'Scenario: masquerading for admin user' do
|
|
13
13
|
|
14
14
|
it_should_behave_like "User role" do
|
15
15
|
let(:current_user) { @admin }
|
16
|
-
let(:user) {
|
16
|
+
let(:user) { current_user_ability(:user) }
|
17
17
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
18
18
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
19
19
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -29,7 +29,7 @@ describe 'Scenario: masquerading for admin user' do
|
|
29
29
|
|
30
30
|
it_should_behave_like "Editor role" do
|
31
31
|
let(:current_user) { @admin }
|
32
|
-
let(:user) {
|
32
|
+
let(:user) { current_user_ability(:user) }
|
33
33
|
let(:own_article) { Article.create!(:user_id => @user.id) }
|
34
34
|
let(:own_post) { Post.create(:user_id => @user.id) }
|
35
35
|
let(:own_comment) { Comment.create(:user_id => @user.id) }
|
@@ -37,19 +37,19 @@ describe CanTango::Api::User::Ability do
|
|
37
37
|
specify { subject.user_ability(subject.current_admin).should be_a CanTango::Ability }
|
38
38
|
end
|
39
39
|
|
40
|
-
describe '
|
41
|
-
specify { subject.
|
40
|
+
describe 'current_user_ability :user' do
|
41
|
+
specify { subject.current_user_ability(:user).should be_a CanTango::Ability }
|
42
42
|
|
43
43
|
it 'should set the :user user correctly on ability' do
|
44
|
-
subject.
|
44
|
+
subject.current_user_ability(:user).user.should == subject.current_user
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe '
|
49
|
-
specify { subject.
|
48
|
+
describe 'current_user_ability :admin' do
|
49
|
+
specify { subject.current_user_ability(:admin).should be_a CanTango::Ability }
|
50
50
|
|
51
51
|
it 'should set the :admin user correctly on ability' do
|
52
|
-
subject.
|
52
|
+
subject.current_user_ability(:admin).user.should == subject.current_admin
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -8,15 +8,15 @@ require 'cantango/api/current_users'
|
|
8
8
|
class User
|
9
9
|
include CanTango::Users::Masquerade
|
10
10
|
include_and_extend SimpleRoles
|
11
|
+
|
12
|
+
tango_user
|
11
13
|
end
|
12
14
|
|
13
15
|
class Admin < User
|
16
|
+
tango_user
|
14
17
|
end
|
15
18
|
|
16
19
|
CanTango.configure do |config|
|
17
|
-
config.users.register :user, User
|
18
|
-
config.users.register :admin, Admin
|
19
|
-
|
20
20
|
config.cache_engine.set :off
|
21
21
|
config.permit_engine.set :on
|
22
22
|
end
|
@@ -59,19 +59,19 @@ describe CanTango::Api::User::Can do
|
|
59
59
|
specify { subject.user_ability(subject.current_admin).should be_a CanTango::Ability }
|
60
60
|
end
|
61
61
|
|
62
|
-
describe '
|
63
|
-
specify { subject.
|
62
|
+
describe 'current_user_ability :user' do
|
63
|
+
specify { subject.current_user_ability(:user).should be_a CanTango::Ability }
|
64
64
|
|
65
65
|
it 'should set the :user user correctly on ability' do
|
66
|
-
subject.
|
66
|
+
subject.current_user_ability(:user).user.should == subject.current_user
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
describe '
|
71
|
-
specify { subject.
|
70
|
+
describe 'current_user_ability :admin' do
|
71
|
+
specify { subject.current_user_ability(:admin).should be_a CanTango::Ability }
|
72
72
|
|
73
73
|
it 'should set the :admin user correctly on ability' do
|
74
|
-
subject.
|
74
|
+
subject.current_user_ability(:admin).user.should == subject.current_admin
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -29,7 +29,7 @@ describe CanTango::Api::UserAccount::Ability do
|
|
29
29
|
specify { subject.user_account_ability(subject.current_admin_account).should be_a CanTango::Ability }
|
30
30
|
end
|
31
31
|
|
32
|
-
describe '
|
32
|
+
describe 'current_account_ability' do
|
33
33
|
specify { subject.current_account_ability(:user).should be_a CanTango::Ability }
|
34
34
|
specify { subject.current_account_ability(:admin).should be_a CanTango::Ability }
|
35
35
|
end
|
@@ -9,7 +9,6 @@ require 'cantango/rspec'
|
|
9
9
|
|
10
10
|
class MembershipPermit < CanTango::Permit
|
11
11
|
class Builder
|
12
|
-
|
13
12
|
end
|
14
13
|
|
15
14
|
class Finder
|
@@ -28,6 +27,10 @@ class MembershipPermit < CanTango::Permit
|
|
28
27
|
clazz.name.demodulize.gsub(/(.*)(MembershipPermit)/, '\1').underscore.to_sym
|
29
28
|
end
|
30
29
|
|
30
|
+
def self.hash_key
|
31
|
+
:memberships
|
32
|
+
end
|
33
|
+
|
31
34
|
def permit_name
|
32
35
|
self.class.membership_name self.class
|
33
36
|
end
|
@@ -40,19 +43,6 @@ class MembershipPermit < CanTango::Permit
|
|
40
43
|
super
|
41
44
|
end
|
42
45
|
|
43
|
-
# In a specific Role based Permit you can use
|
44
|
-
# def permit? user, options = {}
|
45
|
-
# ... permission logic follows
|
46
|
-
#
|
47
|
-
# This will call the Permit::Base#permit? instance method (the method below)
|
48
|
-
# It will only return true if the user matches the role of the Permit class and the
|
49
|
-
#
|
50
|
-
# If these confitions are not met, it will return false and thus the outer permit
|
51
|
-
# will not run the permission logic to follow
|
52
|
-
#
|
53
|
-
# Normally super for #permit? should not be called except for this case,
|
54
|
-
# or if subclassing another Permit than Permit::Base
|
55
|
-
#
|
56
46
|
def permit?
|
57
47
|
super
|
58
48
|
end
|
@@ -8,14 +8,13 @@ module CanTango
|
|
8
8
|
module Ability
|
9
9
|
def user_ability user, options = {}
|
10
10
|
stamper(:call_on_ability) {
|
11
|
-
@
|
11
|
+
@user_ability ||= ::CanTango::Ability.new(user, ability_options.merge(options))
|
12
12
|
}
|
13
|
-
@
|
13
|
+
@user_ability
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def current_user_ability user_type = :user
|
17
17
|
user_ability get_ability_user(user_type)
|
18
|
-
|
19
18
|
end
|
20
19
|
|
21
20
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cantango
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.4.
|
4
|
+
version: 0.9.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-04 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70325622683480 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70325622683480
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: cancan
|
28
|
-
requirement: &
|
28
|
+
requirement: &70325622682980 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70325622682980
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sugar-high
|
39
|
-
requirement: &
|
39
|
+
requirement: &70325622682480 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.6.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70325622682480
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: sweetloader
|
50
|
-
requirement: &
|
50
|
+
requirement: &70325622682000 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.1.0
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70325622682000
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: hashie
|
61
|
-
requirement: &
|
61
|
+
requirement: &70325622681500 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0.4'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70325622681500
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec-rails
|
72
|
-
requirement: &
|
72
|
+
requirement: &70325622681020 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.6.1
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70325622681020
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: forgery
|
83
|
-
requirement: &
|
83
|
+
requirement: &70325622680480 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0.3'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70325622680480
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: factory_girl
|
94
|
-
requirement: &
|
94
|
+
requirement: &70325622679760 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70325622679760
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: sqlite3
|
105
|
-
requirement: &
|
105
|
+
requirement: &70325622679100 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70325622679100
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: sourcify
|
116
|
-
requirement: &
|
116
|
+
requirement: &70325622678340 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *70325622678340
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: dkastner-moneta
|
127
|
-
requirement: &
|
127
|
+
requirement: &70325622677860 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ! '>='
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: '1.0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *70325622677860
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: rspec
|
138
|
-
requirement: &
|
138
|
+
requirement: &70325622677360 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
@@ -143,10 +143,10 @@ dependencies:
|
|
143
143
|
version: 2.4.0
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
|
-
version_requirements: *
|
146
|
+
version_requirements: *70325622677360
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: jeweler
|
149
|
-
requirement: &
|
149
|
+
requirement: &70325622670820 !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|
152
152
|
- - ! '>='
|
@@ -154,10 +154,10 @@ dependencies:
|
|
154
154
|
version: 1.6.4
|
155
155
|
type: :development
|
156
156
|
prerelease: false
|
157
|
-
version_requirements: *
|
157
|
+
version_requirements: *70325622670820
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: bundler
|
160
|
-
requirement: &
|
160
|
+
requirement: &70325622670340 !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
162
|
requirements:
|
163
163
|
- - ! '>='
|
@@ -165,10 +165,10 @@ dependencies:
|
|
165
165
|
version: 1.0.1
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
|
-
version_requirements: *
|
168
|
+
version_requirements: *70325622670340
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: rdoc
|
171
|
-
requirement: &
|
171
|
+
requirement: &70325622669860 !ruby/object:Gem::Requirement
|
172
172
|
none: false
|
173
173
|
requirements:
|
174
174
|
- - ! '>='
|
@@ -176,7 +176,7 @@ dependencies:
|
|
176
176
|
version: '0'
|
177
177
|
type: :development
|
178
178
|
prerelease: false
|
179
|
-
version_requirements: *
|
179
|
+
version_requirements: *70325622669860
|
180
180
|
description: ! 'Define your permission rules as role- or role group specific permits.
|
181
181
|
|
182
182
|
Integrates well with multiple Devise user acounts.
|
@@ -872,7 +872,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
872
872
|
version: '0'
|
873
873
|
segments:
|
874
874
|
- 0
|
875
|
-
hash: -
|
875
|
+
hash: -1005748233623511503
|
876
876
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
877
877
|
none: false
|
878
878
|
requirements:
|