popel-active_acl_plus 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +61 -0
- data/VERSION.yml +1 -1
- data/app/models/active_acl/acl.rb +44 -0
- data/app/models/active_acl/acl_section.rb +22 -0
- data/app/models/active_acl/controller_action.rb +30 -0
- data/app/models/active_acl/controller_group.rb +21 -0
- data/app/models/active_acl/privilege.rb +26 -0
- data/app/models/active_acl/requester_group_link.rb +12 -0
- data/app/models/active_acl/requester_link.rb +12 -0
- data/app/models/active_acl/target_group_link.rb +12 -0
- data/app/models/active_acl/target_link.rb +12 -0
- data/db/migrate/001_base_table_setup.rb +114 -0
- data/lib/active_acl.rb +12 -6
- data/lib/active_acl/acts_as_access_group.rb +2 -2
- data/lib/active_acl/acts_as_access_object.rb +4 -4
- data/lib/active_acl/base.rb +8 -3
- data/lib/active_acl/cache/memcache_adapter.rb +1 -0
- data/lib/active_acl/handler/object_handler.rb +1 -1
- metadata +17 -262
data/CHANGELOG
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
ActiveAclPlus a rails authorization system (one of many)
|
2
|
+
|
3
|
+
Version 0.4.5
|
4
|
+
- reload should have options
|
5
|
+
- fixed polimorphic assocs
|
6
|
+
|
7
|
+
Version 0.4.4
|
8
|
+
- Bumped Version for Github
|
9
|
+
|
10
|
+
Version 0.4.3
|
11
|
+
- fixed 2d bug
|
12
|
+
- renamed grant_permission! to grant_privilege! (whops)
|
13
|
+
- fixed some issues with grant_privilege!
|
14
|
+
- NOTE: grant_privilege! is wip, so the API may change a lot, sorry!
|
15
|
+
- fixing STI
|
16
|
+
|
17
|
+
Version 0.4.2
|
18
|
+
|
19
|
+
Version 0.4.1
|
20
|
+
|
21
|
+
Version 0.4.0 - 2008/03/08
|
22
|
+
- complete rewrite of the SQL generation
|
23
|
+
- abstraction of the grouping
|
24
|
+
- added #grant_permission
|
25
|
+
- dropped test, moving to rspec
|
26
|
+
- allows ungrouped requesters/targets
|
27
|
+
- propper namespace handling of options (THANKS http://github.com/garytaylor)
|
28
|
+
|
29
|
+
Version 0.3.1 - 2008/12/11
|
30
|
+
- forgot active_acl.rb in gem
|
31
|
+
- fixed generator
|
32
|
+
|
33
|
+
Version 0.3.0 - 2008/12/07
|
34
|
+
- Renamed Project to ActiveACLPlus
|
35
|
+
- code cleanup
|
36
|
+
- new repository on github with new maintainer
|
37
|
+
- no dependency on plugin_migrations
|
38
|
+
- runs with Rails 2.1
|
39
|
+
|
40
|
+
Version 0.2.1 - December 2nd, 2006
|
41
|
+
- fixed bug in polymorph creation
|
42
|
+
- test suite uses sqlite3 as a default
|
43
|
+
- updated documentation
|
44
|
+
|
45
|
+
Version 0.2.0 - November 28th, 2006
|
46
|
+
- fixed bug with autogenerated mysql indexes too long
|
47
|
+
- API change from Permission model to Privilege model
|
48
|
+
- refactored to gem comaptible format
|
49
|
+
- refactored tests and removed them from the main distribution
|
50
|
+
- testing now mysql, postgres and sqlite3
|
51
|
+
- added dependency on loaded_plugins and plugin_migrations from pluginaweek.com
|
52
|
+
- controller group schema changed to contain parent column
|
53
|
+
- gem is now available
|
54
|
+
|
55
|
+
Version 0.1.1 - November 14th, 2006
|
56
|
+
- changed SQL target query to use LIMIT to help the query planner
|
57
|
+
- added LGPL license
|
58
|
+
- set Acl.allow default to true
|
59
|
+
|
60
|
+
Version 0.1.0 - November 14th, 2006
|
61
|
+
- initial release, no changes yet
|
data/VERSION.yml
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# This model is the "glue" :-). Every permission assignment uses an Acl
|
2
|
+
# model object, assigns objects, groups and privileges and setting
|
3
|
+
# 'allow' to "true" or "false" to grant or deny access.
|
4
|
+
|
5
|
+
# These methods are added by the acts_as_access_object/group:
|
6
|
+
# requesters
|
7
|
+
# targets
|
8
|
+
# requester_groups
|
9
|
+
# target_groups
|
10
|
+
|
11
|
+
module ActiveAcl
|
12
|
+
class Acl < ActiveRecord::Base
|
13
|
+
set_table_name ActiveAcl::OPTIONS[:acls_table]
|
14
|
+
|
15
|
+
belongs_to :section, :class_name => 'ActiveAcl::AclSection', :foreign_key => 'section_id'
|
16
|
+
has_and_belongs_to_many :privileges, :uniq => true, :join_table => ActiveAcl::OPTIONS[:acls_privileges_table], :class_name => 'ActiveAcl::Privilege'
|
17
|
+
|
18
|
+
has_many :target_links, :dependent => :delete_all, :class_name => 'ActiveAcl::TargetLink'
|
19
|
+
has_many :requester_links, :dependent => :delete_all,:class_name => 'ActiveAcl::RequesterLink'
|
20
|
+
|
21
|
+
has_many :requester_group_links, :dependent => :delete_all,:class_name => 'ActiveAcl::RequesterGroupLink'
|
22
|
+
has_many :target_group_links, :dependent => :delete_all,:class_name => 'ActiveAcl::TargetGroupLink'
|
23
|
+
|
24
|
+
validates_uniqueness_of :iname
|
25
|
+
validates_presence_of :iname
|
26
|
+
|
27
|
+
def self.reloadable? #:nodoc:
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
|
31
|
+
# used as instance description in admin screen
|
32
|
+
def active_acl_description
|
33
|
+
if iname
|
34
|
+
if section
|
35
|
+
'/' + section.description + '/' + iname
|
36
|
+
else
|
37
|
+
return iname
|
38
|
+
end
|
39
|
+
else
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Groups Acl model objects into different sections to provide better
|
2
|
+
# overview in the admin screens. Has no meaning in permission resolution.
|
3
|
+
module ActiveAcl
|
4
|
+
class AclSection < ActiveRecord::Base
|
5
|
+
set_table_name ActiveAcl::OPTIONS[:acl_sections_table]
|
6
|
+
|
7
|
+
has_many :members, :class_name => 'ActiveAcl::Acl', :foreign_key => 'section_id'
|
8
|
+
|
9
|
+
validates_presence_of :iname
|
10
|
+
validates_uniqueness_of :iname
|
11
|
+
|
12
|
+
# Make shure there are no associated acls before destroying a section
|
13
|
+
def before_destroy #:nodoc:
|
14
|
+
if members.empty?
|
15
|
+
true
|
16
|
+
else
|
17
|
+
errors.add_to_base("Can't delete a section with associated ACLs")
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# This model is a DB representation of actions on an ActionController::Base
|
2
|
+
# controller and is grouped by ActiveAcl::ControllerGroup.
|
3
|
+
class ActiveAcl::ControllerAction < ActiveRecord::Base
|
4
|
+
set_table_name ActiveAcl::OPTIONS[:controller_actions_table]
|
5
|
+
privilege_const_set('EXECUTE')
|
6
|
+
|
7
|
+
belongs_to :controller_group, :class_name => 'ActiveAcl::ControllerGroup'
|
8
|
+
acts_as_access_object :grouped_by => :"active_acl/controller_group"
|
9
|
+
validates_presence_of :action, :controller, :controller_group
|
10
|
+
|
11
|
+
# Returns the instance representation in the admin screens.
|
12
|
+
def active_acl_description
|
13
|
+
if action
|
14
|
+
if controller
|
15
|
+
return '/' + controller + '/' + action
|
16
|
+
else
|
17
|
+
return action
|
18
|
+
end
|
19
|
+
else
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the class representation in the admin screens.
|
25
|
+
def self.active_acl_description
|
26
|
+
return 'Action'
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This model is used for grouping ActiveAcl::ControllerAction models.
|
2
|
+
class ActiveAcl::ControllerGroup < ActiveRecord::Base
|
3
|
+
set_table_name ActiveAcl::OPTIONS[:controller_groups_table]
|
4
|
+
acts_as_nested_set
|
5
|
+
has_many :controller_actions,:class_name => 'ActiveAcl::ControllerAction'
|
6
|
+
acts_as_access_group :type => ActiveAcl::Acts::AccessGroup::NestedSet
|
7
|
+
|
8
|
+
validates_presence_of :description
|
9
|
+
|
10
|
+
# Returns the instance representation in the admin screens.
|
11
|
+
def active_acl_description
|
12
|
+
return description
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns the class representation in the admin screens.
|
16
|
+
def self.active_acl_description
|
17
|
+
return 'ControllerGroup'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# The basic "privilege" object, like Forum::VIEW might be the privilege to
|
2
|
+
# view a forum. Check the README for a detailed description on usage.
|
3
|
+
module ActiveAcl
|
4
|
+
class Privilege < ActiveRecord::Base
|
5
|
+
set_table_name ActiveAcl::OPTIONS[:privileges_table]
|
6
|
+
|
7
|
+
has_and_belongs_to_many :acls, :uniq => true, :join_table => ActiveAcl::OPTIONS[:acls_privileges_table],:class_name => 'ActiveAcl::Acl'
|
8
|
+
|
9
|
+
validates_presence_of :section, :value
|
10
|
+
validates_uniqueness_of :value, :scope => :section
|
11
|
+
|
12
|
+
# Returns the instance representation in the admin screens.
|
13
|
+
# Uses active_acl_description from class if present.
|
14
|
+
def active_acl_description
|
15
|
+
begin
|
16
|
+
section.constantize.active_acl_description
|
17
|
+
rescue
|
18
|
+
section
|
19
|
+
end + '/' + value
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.reloadable? #:nodoc:
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActiveAcl
|
2
|
+
class RequesterGroupLink < ActiveRecord::Base
|
3
|
+
set_table_name ActiveAcl::OPTIONS[:requester_group_links_table]
|
4
|
+
|
5
|
+
belongs_to :acl, :class_name => "ActiveAcl::Acl"
|
6
|
+
belongs_to :requester_group, :polymorphic => true
|
7
|
+
|
8
|
+
def self.reloadable? #:nodoc:
|
9
|
+
return false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActiveAcl
|
2
|
+
class RequesterLink < ActiveRecord::Base
|
3
|
+
set_table_name ActiveAcl::OPTIONS[:requester_links_table]
|
4
|
+
|
5
|
+
belongs_to :acl, :class_name => "ActiveAcl::Acl"
|
6
|
+
belongs_to :requester, :polymorphic => true
|
7
|
+
|
8
|
+
def self.reloadable? #:nodoc:
|
9
|
+
return false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActiveAcl
|
2
|
+
class TargetGroupLink < ActiveRecord::Base
|
3
|
+
set_table_name ActiveAcl::OPTIONS[:target_group_links_table]
|
4
|
+
|
5
|
+
belongs_to :acl, :class_name => "ActiveAcl::Acl"
|
6
|
+
belongs_to :target_group, :polymorphic => true
|
7
|
+
|
8
|
+
def self.reloadable? #:nodoc:
|
9
|
+
return false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActiveAcl
|
2
|
+
class TargetLink < ActiveRecord::Base
|
3
|
+
set_table_name ActiveAcl::OPTIONS[:target_links_table]
|
4
|
+
|
5
|
+
belongs_to :acl, :class_name => "ActiveAcl::Acl"
|
6
|
+
belongs_to :target, :polymorphic => true
|
7
|
+
|
8
|
+
def self.reloadable? #:nodoc:
|
9
|
+
return false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
class BaseTableSetup < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ActiveAcl::OPTIONS[:acls_table] do |t|
|
4
|
+
t.column :section_id, :int
|
5
|
+
t.column :iname, :string,:null => false
|
6
|
+
t.column :allow, :boolean, :null => false, :default => true
|
7
|
+
t.column :enabled, :boolean, :null => false, :default => true
|
8
|
+
t.column :description, :text, :null => true
|
9
|
+
t.column :updated_at, :datetime, :null => false
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index ActiveAcl::OPTIONS[:acls_table], :enabled
|
13
|
+
add_index ActiveAcl::OPTIONS[:acls_table], :section_id
|
14
|
+
add_index ActiveAcl::OPTIONS[:acls_table], :updated_at
|
15
|
+
add_index ActiveAcl::OPTIONS[:acls_table], :iname, :unique
|
16
|
+
|
17
|
+
|
18
|
+
create_table ActiveAcl::OPTIONS[:acl_sections_table] do |t|
|
19
|
+
t.column :iname, :string, :null => false
|
20
|
+
t.column :description, :text, :null => true
|
21
|
+
end
|
22
|
+
|
23
|
+
add_index ActiveAcl::OPTIONS[:acl_sections_table], :iname, :unique
|
24
|
+
|
25
|
+
create_table ActiveAcl::OPTIONS[:privileges_table] do |t|
|
26
|
+
t.column :section, :string, :limit => 230, :null => false
|
27
|
+
t.column :value, :string, :limit => 230, :null => false
|
28
|
+
t.column :description, :string, :limit => 230, :null => true
|
29
|
+
end
|
30
|
+
|
31
|
+
add_index ActiveAcl::OPTIONS[:privileges_table], [:section, :value], :unique
|
32
|
+
|
33
|
+
create_table ActiveAcl::OPTIONS[:acls_privileges_table], :id => false do |t|
|
34
|
+
t.column :acl_id, :int, :null => false
|
35
|
+
t.column :privilege_id, :int, :null => false
|
36
|
+
end
|
37
|
+
|
38
|
+
add_index ActiveAcl::OPTIONS[:acls_privileges_table], [:acl_id, :privilege_id], :unique
|
39
|
+
|
40
|
+
create_table ActiveAcl::OPTIONS[:requester_links_table] do |t|
|
41
|
+
t.column :acl_id, :int, :null => false
|
42
|
+
t.column :requester_id, :int, :null => false
|
43
|
+
t.column :requester_type, :string, :null => false
|
44
|
+
end
|
45
|
+
|
46
|
+
add_index ActiveAcl::OPTIONS[:requester_links_table], [:acl_id, :requester_id, :requester_type], :unique => true, :name => 'requester_links_join_index_1'
|
47
|
+
add_index ActiveAcl::OPTIONS[:requester_links_table], [:requester_type, :requester_id], :name => 'requester_links_join_index_2'
|
48
|
+
add_index ActiveAcl::OPTIONS[:requester_links_table], [:requester_id]
|
49
|
+
|
50
|
+
create_table ActiveAcl::OPTIONS[:requester_group_links_table] do |t|
|
51
|
+
t.column :acl_id, :int, :null => false
|
52
|
+
t.column :requester_group_id, :int, :null => false
|
53
|
+
t.column :requester_group_type, :string, :null => false
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index ActiveAcl::OPTIONS[:requester_group_links_table], [:acl_id, :requester_group_id, :requester_group_type], :unique => true, :name => 'requester_group_links_join_index_1'
|
57
|
+
add_index ActiveAcl::OPTIONS[:requester_group_links_table], [:requester_group_type, :requester_group_id], :name => 'requester_group_links_join_index2'
|
58
|
+
|
59
|
+
create_table ActiveAcl::OPTIONS[:target_group_links_table] do |t|
|
60
|
+
t.column :acl_id, :int, :null => false
|
61
|
+
t.column :target_group_id, :int, :null => false
|
62
|
+
t.column :target_group_type, :string, :null => false
|
63
|
+
end
|
64
|
+
|
65
|
+
add_index ActiveAcl::OPTIONS[:target_group_links_table], [:acl_id, :target_group_id, :target_group_type], :unique => true, :name => 'target_group_links_join_index_1'
|
66
|
+
add_index ActiveAcl::OPTIONS[:target_group_links_table], [:target_group_type, :target_group_id], :name => 'target_group_links_join_index_2'
|
67
|
+
|
68
|
+
create_table ActiveAcl::OPTIONS[:target_links_table] do |t|
|
69
|
+
t.column :acl_id, :int, :null => false
|
70
|
+
t.column :target_id, :int, :null => false
|
71
|
+
t.column :target_type, :string, :null => false
|
72
|
+
end
|
73
|
+
|
74
|
+
add_index ActiveAcl::OPTIONS[:target_links_table], [:acl_id, :target_id, :target_type], :unique => true, :name => 'target_links_join_index_1'
|
75
|
+
add_index ActiveAcl::OPTIONS[:target_links_table], [:target_type, :target_id], :name => 'target_links_join_index_2'
|
76
|
+
add_index ActiveAcl::OPTIONS[:target_links_table], [:target_id]
|
77
|
+
|
78
|
+
create_table ActiveAcl::OPTIONS[:controller_actions_table] do |t|
|
79
|
+
t.column :controller, :string, :null => false
|
80
|
+
t.column :action, :string, :null => false
|
81
|
+
t.column :controller_group_id, :integer, :null => false
|
82
|
+
end
|
83
|
+
|
84
|
+
add_index ActiveAcl::OPTIONS[:controller_actions_table], [:controller, :action], :unique
|
85
|
+
|
86
|
+
create_table ActiveAcl::OPTIONS[:controller_groups_table] do |t|
|
87
|
+
t.column :description, :string, :null => false
|
88
|
+
t.column :lft, :integer
|
89
|
+
t.column :rgt, :integer
|
90
|
+
t.column :parent_id, :integer
|
91
|
+
end
|
92
|
+
|
93
|
+
add_index ActiveAcl::OPTIONS[:controller_groups_table], :description
|
94
|
+
add_index ActiveAcl::OPTIONS[:controller_groups_table], :lft
|
95
|
+
add_index ActiveAcl::OPTIONS[:controller_groups_table], :rgt
|
96
|
+
add_index ActiveAcl::OPTIONS[:controller_groups_table], :parent_id
|
97
|
+
|
98
|
+
# create root node
|
99
|
+
execute("INSERT INTO #{ActiveAcl::OPTIONS[:controller_groups_table]}(description, lft, rgt) VALUES ('controllers', 1, 2)")
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.down
|
103
|
+
drop_table ActiveAcl::OPTIONS[:acls_table]
|
104
|
+
drop_table ActiveAcl::OPTIONS[:acl_sections_table]
|
105
|
+
drop_table ActiveAcl::OPTIONS[:privileges_table]
|
106
|
+
drop_table ActiveAcl::OPTIONS[:acls_privileges_table]
|
107
|
+
drop_table ActiveAcl::OPTIONS[:requester_links_table]
|
108
|
+
drop_table ActiveAcl::OPTIONS[:target_links_table]
|
109
|
+
drop_table ActiveAcl::OPTIONS[:requester_group_links_table]
|
110
|
+
drop_table ActiveAcl::OPTIONS[:target_group_links_table]
|
111
|
+
drop_table ActiveAcl::OPTIONS[:controller_actions_table]
|
112
|
+
drop_table ActiveAcl::OPTIONS[:controller_groups_table]
|
113
|
+
end
|
114
|
+
end
|
data/lib/active_acl.rb
CHANGED
@@ -22,11 +22,17 @@ require 'active_acl/acts_as_access_group'
|
|
22
22
|
require 'active_acl/load_files_from'
|
23
23
|
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
$:.unshift File.join(File.dirname(__FILE__),'../app/models/')
|
26
|
+
|
27
27
|
begin
|
28
|
-
|
29
|
-
|
28
|
+
['privilege','acl_section','privilege','requester_link','target_link',
|
29
|
+
'acl_section','requester_group_link','target_group_link','acl',
|
30
|
+
'controller_group','controller_action'].each do |model|
|
31
|
+
require "active_acl/#{model}"
|
32
|
+
end
|
30
33
|
rescue StandardError => e
|
31
|
-
puts "
|
32
|
-
end
|
34
|
+
puts "[ERROR] ActiveAcl: #{e.message}. Migrating?"
|
35
|
+
end
|
36
|
+
|
37
|
+
$:.shift
|
38
|
+
|
@@ -24,11 +24,11 @@ module ActiveAcl #:nodoc:
|
|
24
24
|
extend SingletonMethods
|
25
25
|
|
26
26
|
ActiveAcl::Acl.instance_eval do
|
27
|
-
has_many_polymorphs :requester_groups, {:from => ActiveAcl.
|
27
|
+
has_many_polymorphs :requester_groups, {:from => ActiveAcl.from_group_classes,
|
28
28
|
:through => :"active_acl/requester_group_links",
|
29
29
|
:rename_individual_collections => true}
|
30
30
|
|
31
|
-
has_many_polymorphs :target_groups, {:from => ActiveAcl.
|
31
|
+
has_many_polymorphs :target_groups, {:from => ActiveAcl.from_group_classes,
|
32
32
|
:through => :"active_acl/target_group_links",
|
33
33
|
:rename_individual_collections => true}
|
34
34
|
end
|
@@ -38,11 +38,11 @@ module ActiveAcl #:nodoc:
|
|
38
38
|
include ActiveAcl::Acts::Grant
|
39
39
|
|
40
40
|
ActiveAcl::Acl.instance_eval do
|
41
|
-
has_many_polymorphs :requesters, {:from => ActiveAcl.
|
41
|
+
has_many_polymorphs :requesters, {:from => ActiveAcl.from_access_classes,
|
42
42
|
:through => :"active_acl/requester_links",
|
43
43
|
:rename_individual_collections => true}
|
44
44
|
|
45
|
-
has_many_polymorphs :targets, {:from => ActiveAcl.
|
45
|
+
has_many_polymorphs :targets, {:from => ActiveAcl.from_access_classes,
|
46
46
|
:through => :"active_acl/target_links",
|
47
47
|
:rename_individual_collections => true}
|
48
48
|
end
|
@@ -53,9 +53,9 @@ module ActiveAcl #:nodoc:
|
|
53
53
|
alias :reload_before_active_acl :reload
|
54
54
|
|
55
55
|
# Redefines reload, making shure privilege caches are cleared on reload
|
56
|
-
def reload #:nodoc:
|
56
|
+
def reload(options={}) #:nodoc:
|
57
57
|
active_acl_clear_cache!
|
58
|
-
reload_before_active_acl
|
58
|
+
reload_before_active_acl(options)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/active_acl/base.rb
CHANGED
@@ -21,9 +21,14 @@ module ActiveAcl
|
|
21
21
|
def self.is_access_object?(klass)
|
22
22
|
!!ACCESS_CLASSES[klass.base_class.name]
|
23
23
|
end
|
24
|
-
def self.
|
25
|
-
ACCESS_CLASSES.keys.collect do |
|
26
|
-
|
24
|
+
def self.from_access_classes
|
25
|
+
ACCESS_CLASSES.keys.collect do |class_name|
|
26
|
+
class_name.underscore.pluralize.to_sym
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def self.from_group_classes
|
30
|
+
GROUP_CLASSES.keys.collect do |class_name|
|
31
|
+
class_name.underscore.pluralize.to_sym
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
# require is enough to activate the memcache. Before using the memcache, make sure to set MemcacheAdapter.cache.
|
5
5
|
#
|
6
6
|
# In environment.rb:
|
7
|
+
# require 'memcache'
|
7
8
|
# require 'active_acl/cache/memcache_adapter'
|
8
9
|
# ActiveAcl::Cache::MemcacheAdapter.cache = MemCache.new('localhost:11211', :namespace => 'my_namespace')
|
9
10
|
# you can also set the time to leave:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: popel-active_acl_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Schrammel
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-03-
|
13
|
+
date: 2009-03-28 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -24,6 +24,7 @@ extensions: []
|
|
24
24
|
extra_rdoc_files:
|
25
25
|
- README.rdoc
|
26
26
|
- LICENSE
|
27
|
+
- CHANGELOG
|
27
28
|
files:
|
28
29
|
- README.rdoc
|
29
30
|
- VERSION.yml
|
@@ -46,267 +47,21 @@ files:
|
|
46
47
|
- lib/active_acl/base.rb
|
47
48
|
- lib/active_acl/acts_as_access_object.rb
|
48
49
|
- lib/active_acl.rb
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
- test/unit/acts_as_access_group_test.rb
|
63
|
-
- test/unit/privilege_test.rb
|
64
|
-
- test/fixtures
|
65
|
-
- test/fixtures/acl_sections.yml
|
66
|
-
- test/fixtures/forums.yml
|
67
|
-
- test/fixtures/users.yml
|
68
|
-
- test/fixtures/user_groups.yml
|
69
|
-
- test/fixtures/user_groups_users.yml
|
70
|
-
- test/fixtures/categories.yml
|
71
|
-
- test/fixtures/acls.yml
|
72
|
-
- test/fixtures/controller_actions.yml
|
73
|
-
- test/fixtures/controller_groups.yml
|
74
|
-
- test/fixtures/privileges.yml
|
75
|
-
- test/fixtures/requester_group_links.yml
|
76
|
-
- test/fixtures/requester_links.yml
|
77
|
-
- test/fixtures/target_group_links.yml
|
78
|
-
- test/fixtures/target_links.yml
|
79
|
-
- test/rails_root
|
80
|
-
- test/rails_root/app
|
81
|
-
- test/rails_root/app/controllers
|
82
|
-
- test/rails_root/app/controllers/application.rb
|
83
|
-
- test/rails_root/app/controllers/action_test_controller.rb
|
84
|
-
- test/rails_root/app/helpers
|
85
|
-
- test/rails_root/app/helpers/application_helper.rb
|
86
|
-
- test/rails_root/app/models
|
87
|
-
- test/rails_root/app/models/category.rb
|
88
|
-
- test/rails_root/app/models/forum.rb
|
89
|
-
- test/rails_root/app/models/paying_member.rb
|
90
|
-
- test/rails_root/app/models/sti_forum.rb
|
91
|
-
- test/rails_root/app/models/user.rb
|
92
|
-
- test/rails_root/app/models/user_group.rb
|
93
|
-
- test/rails_root/app/views
|
94
|
-
- test/rails_root/app/views/layouts
|
95
|
-
- test/rails_root/config
|
96
|
-
- test/rails_root/config/environments
|
97
|
-
- test/rails_root/config/environments/mysql.rb
|
98
|
-
- test/rails_root/config/environments/postgresql.rb
|
99
|
-
- test/rails_root/config/environments/sqlite3.rb
|
100
|
-
- test/rails_root/config/initializers
|
101
|
-
- test/rails_root/config/initializers/inflections.rb
|
102
|
-
- test/rails_root/config/initializers/mime_types.rb
|
103
|
-
- test/rails_root/config/initializers/new_rails_defaults.rb
|
104
|
-
- test/rails_root/config/database.example
|
105
|
-
- test/rails_root/config/routes.rb
|
106
|
-
- test/rails_root/config/boot.rb
|
107
|
-
- test/rails_root/config/environment_old.rb
|
108
|
-
- test/rails_root/config/environment.rb
|
109
|
-
- test/rails_root/config/database.yml
|
110
|
-
- test/rails_root/db
|
111
|
-
- test/rails_root/db/migrate
|
112
|
-
- test/rails_root/db/migrate/002_create_base_tables.rb
|
113
|
-
- test/rails_root/db/schema.rb
|
114
|
-
- test/rails_root/db/test.sqlite3
|
115
|
-
- test/rails_root/lib
|
116
|
-
- test/rails_root/lib/tasks
|
117
|
-
- test/rails_root/log
|
118
|
-
- test/rails_root/log/sqlite3.log
|
119
|
-
- test/rails_root/public
|
120
|
-
- test/rails_root/public/old
|
121
|
-
- test/rails_root/public/old/stylesheets
|
122
|
-
- test/rails_root/public/old/javascripts
|
123
|
-
- test/rails_root/public/old/javascripts/prototype.js
|
124
|
-
- test/rails_root/public/old/javascripts/effects.js
|
125
|
-
- test/rails_root/public/old/javascripts/dragdrop.js
|
126
|
-
- test/rails_root/public/old/javascripts/controls.js
|
127
|
-
- test/rails_root/public/old/javascripts/application.js
|
128
|
-
- test/rails_root/public/old/images
|
129
|
-
- test/rails_root/public/old/images/rails.png
|
130
|
-
- test/rails_root/public/old/robots.txt
|
131
|
-
- test/rails_root/public/old/index.html
|
132
|
-
- test/rails_root/public/old/favicon.ico
|
133
|
-
- test/rails_root/public/old/dispatch.fcgi
|
134
|
-
- test/rails_root/public/old/dispatch.cgi
|
135
|
-
- test/rails_root/public/old/500.html
|
136
|
-
- test/rails_root/public/old/422.html
|
137
|
-
- test/rails_root/public/old/404.html
|
138
|
-
- test/rails_root/public/old/dispatch.rb
|
139
|
-
- test/rails_root/script
|
140
|
-
- test/rails_root/script/performance
|
141
|
-
- test/rails_root/script/performance/benchmarker
|
142
|
-
- test/rails_root/script/performance/profiler
|
143
|
-
- test/rails_root/script/performance/request
|
144
|
-
- test/rails_root/script/process
|
145
|
-
- test/rails_root/script/process/reaper
|
146
|
-
- test/rails_root/script/process/spawner
|
147
|
-
- test/rails_root/script/process/inspector
|
148
|
-
- test/rails_root/script/about
|
149
|
-
- test/rails_root/script/console
|
150
|
-
- test/rails_root/script/dbconsole
|
151
|
-
- test/rails_root/script/destroy
|
152
|
-
- test/rails_root/script/generate
|
153
|
-
- test/rails_root/script/runner
|
154
|
-
- test/rails_root/script/server
|
155
|
-
- test/rails_root/script/plugin
|
156
|
-
- test/rails_root/test
|
157
|
-
- test/rails_root/test/fixtures
|
158
|
-
- test/rails_root/test/functional
|
159
|
-
- test/rails_root/test/integration
|
160
|
-
- test/rails_root/test/unit
|
161
|
-
- test/rails_root/test/test_helper.rb
|
162
|
-
- test/rails_root/vendor
|
163
|
-
- test/rails_root/vendor/plugins
|
164
|
-
- test/rails_root/vendor/plugins/active_acl
|
165
|
-
- test/rails_root/vendor/plugins/active_acl/init.rb
|
166
|
-
- test/rails_root/vendor/plugins/awesome_nested_set
|
167
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib
|
168
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set
|
169
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/compatability.rb
|
170
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/helper.rb
|
171
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/named_scope.rb
|
172
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
|
173
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/rails
|
174
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/rails/init.rb
|
175
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test
|
176
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set
|
177
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set/helper_test.rb
|
178
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/db
|
179
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/db/schema.rb
|
180
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/db/database.yml
|
181
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures
|
182
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/category.rb
|
183
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/categories.yml
|
184
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/departments.yml
|
185
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/notes.yml
|
186
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set_test.rb
|
187
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/test/test_helper.rb
|
188
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/MIT-LICENSE
|
189
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/README.rdoc
|
190
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/Rakefile
|
191
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/awesome_nested_set.gemspec
|
192
|
-
- test/rails_root/vendor/plugins/awesome_nested_set/init.rb
|
193
|
-
- test/rails_root/tmp
|
194
|
-
- test/rails_root/tmp/sessions
|
195
|
-
- test/rails_root/tmp/sockets
|
196
|
-
- test/rails_root/tmp/cache
|
197
|
-
- test/rails_root/tmp/pids
|
198
|
-
- test/rails_root/Rakefile
|
199
|
-
- test/rails_root/README
|
200
|
-
- test/functional
|
201
|
-
- test/functional/controller_action_test.rb
|
202
|
-
- test/test_helper.rb
|
203
|
-
- test/unit_tests.rb
|
204
|
-
- test/all_tests.rb
|
205
|
-
- test/test_fixtures.rb
|
206
|
-
- test/load_fixtures.rb
|
207
|
-
- test/functional_tests.rb
|
208
|
-
- test/README.rdoc
|
209
|
-
- spec/README.rdoc
|
210
|
-
- spec/models
|
211
|
-
- spec/models/base_spec.rb
|
212
|
-
- spec/models/grant_spec.rb
|
213
|
-
- spec/models/has_privilege_g_g_spec.rb
|
214
|
-
- spec/models/has_privilege_g_spec.rb
|
215
|
-
- spec/models/has_privilege_g_ug_spec.rb
|
216
|
-
- spec/models/has_privilege_ug_g_spec.rb
|
217
|
-
- spec/models/has_privilege_ug_spec.rb
|
218
|
-
- spec/models/has_privilege_ug_ug_spec.rb
|
219
|
-
- spec/models/method_added_spec.rb
|
220
|
-
- spec/models/privilege_spec.rb
|
221
|
-
- spec/rails_root
|
222
|
-
- spec/rails_root/Rakefile
|
223
|
-
- spec/rails_root/app
|
224
|
-
- spec/rails_root/app/controllers
|
225
|
-
- spec/rails_root/app/controllers/action_test_controller.rb
|
226
|
-
- spec/rails_root/app/controllers/application.rb
|
227
|
-
- spec/rails_root/app/helpers
|
228
|
-
- spec/rails_root/app/helpers/application_helper.rb
|
229
|
-
- spec/rails_root/app/models
|
230
|
-
- spec/rails_root/app/models/category.rb
|
231
|
-
- spec/rails_root/app/models/company.rb
|
232
|
-
- spec/rails_root/app/models/forum.rb
|
233
|
-
- spec/rails_root/app/models/page.rb
|
234
|
-
- spec/rails_root/app/models/paying_member.rb
|
235
|
-
- spec/rails_root/app/models/sti_forum.rb
|
236
|
-
- spec/rails_root/app/models/user.rb
|
237
|
-
- spec/rails_root/app/models/user_group.rb
|
238
|
-
- spec/rails_root/app/models/person.rb
|
239
|
-
- spec/rails_root/app/models/family.rb
|
240
|
-
- spec/rails_root/config
|
241
|
-
- spec/rails_root/config/boot.rb
|
242
|
-
- spec/rails_root/config/database.yml
|
243
|
-
- spec/rails_root/config/environment.rb
|
244
|
-
- spec/rails_root/config/environments
|
245
|
-
- spec/rails_root/config/environments/development.rb
|
246
|
-
- spec/rails_root/config/environments/mysql.rb
|
247
|
-
- spec/rails_root/config/environments/postgresql.rb
|
248
|
-
- spec/rails_root/config/environments/sqlite3.rb
|
249
|
-
- spec/rails_root/config/initializers
|
250
|
-
- spec/rails_root/config/initializers/inflections.rb
|
251
|
-
- spec/rails_root/config/initializers/mime_types.rb
|
252
|
-
- spec/rails_root/config/initializers/new_rails_defaults.rb
|
253
|
-
- spec/rails_root/config/routes.rb
|
254
|
-
- spec/rails_root/db
|
255
|
-
- spec/rails_root/db/migrate
|
256
|
-
- spec/rails_root/db/migrate/002_create_base_tables.rb
|
257
|
-
- spec/rails_root/db/schema.rb
|
258
|
-
- spec/rails_root/db/test.sqlite3
|
259
|
-
- spec/rails_root/script
|
260
|
-
- spec/rails_root/script/about
|
261
|
-
- spec/rails_root/script/console
|
262
|
-
- spec/rails_root/script/dbconsole
|
263
|
-
- spec/rails_root/script/destroy
|
264
|
-
- spec/rails_root/script/generate
|
265
|
-
- spec/rails_root/script/performance
|
266
|
-
- spec/rails_root/script/performance/benchmarker
|
267
|
-
- spec/rails_root/script/performance/profiler
|
268
|
-
- spec/rails_root/script/performance/request
|
269
|
-
- spec/rails_root/script/plugin
|
270
|
-
- spec/rails_root/script/process
|
271
|
-
- spec/rails_root/script/process/inspector
|
272
|
-
- spec/rails_root/script/process/reaper
|
273
|
-
- spec/rails_root/script/process/spawner
|
274
|
-
- spec/rails_root/script/server
|
275
|
-
- spec/rails_root/vendor
|
276
|
-
- spec/rails_root/vendor/plugins
|
277
|
-
- spec/rails_root/vendor/plugins/active_acl
|
278
|
-
- spec/rails_root/vendor/plugins/active_acl/init.rb
|
279
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set
|
280
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/MIT-LICENSE
|
281
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/README.rdoc
|
282
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/Rakefile
|
283
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/awesome_nested_set.gemspec
|
284
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/init.rb
|
285
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib
|
286
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
|
287
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set
|
288
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/compatability.rb
|
289
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/helper.rb
|
290
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/named_scope.rb
|
291
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/rails
|
292
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/rails/init.rb
|
293
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test
|
294
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set
|
295
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set/helper_test.rb
|
296
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set_test.rb
|
297
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/db
|
298
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/db/database.yml
|
299
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/db/schema.rb
|
300
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures
|
301
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/categories.yml
|
302
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/category.rb
|
303
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/departments.yml
|
304
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/notes.yml
|
305
|
-
- spec/rails_root/vendor/plugins/awesome_nested_set/test/test_helper.rb
|
306
|
-
- spec/rails_root/log
|
307
|
-
- spec/rails_root/log/sqlite3.log
|
308
|
-
- spec/spec_helper.rb
|
50
|
+
- app/models
|
51
|
+
- app/models/active_acl
|
52
|
+
- app/models/active_acl/acl_section.rb
|
53
|
+
- app/models/active_acl/controller_group.rb
|
54
|
+
- app/models/active_acl/privilege.rb
|
55
|
+
- app/models/active_acl/requester_group_link.rb
|
56
|
+
- app/models/active_acl/requester_link.rb
|
57
|
+
- app/models/active_acl/target_group_link.rb
|
58
|
+
- app/models/active_acl/target_link.rb
|
59
|
+
- app/models/active_acl/controller_action.rb
|
60
|
+
- app/models/active_acl/acl.rb
|
61
|
+
- db/migrate
|
62
|
+
- db/migrate/001_base_table_setup.rb
|
309
63
|
- LICENSE
|
64
|
+
- CHANGELOG
|
310
65
|
has_rdoc: true
|
311
66
|
homepage: http://activeaclplus.rubyforge.org/
|
312
67
|
post_install_message:
|