Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lot of fixes (stupid errors)

  • Loading branch information...
commit 99d479d741506ed8ed63adad75546d3bd263ca71 1 parent 0cbec02
Peter Schrammel authored
8 CHANGELOG
View
@@ -1,6 +1,12 @@
ActiveAclPlus a rails authorization system (one of many)
-Version 0.4.3 (wip)
+Version 0.4.5
+- reload should have options
+
+Version 0.4.4
+- Bumped Version for Github
+
+Version 0.4.3
- fixed 2d bug
- renamed grant_permission! to grant_privilege! (whops)
- fixed some issues with grant_privilege!
6 Rakefile
View
@@ -22,11 +22,9 @@ begin
s.rubyforge_project = RUBY_FORGE_PROJECT
s.summary = "A new Version of ActiveAclPlus is available."
s.homepage = "http://activeaclplus.rubyforge.org/"
-# s.extra_rdoc_files = ["README.rdoc","LICENSE","CHANGELOG"]
+ s.extra_rdoc_files = ["README.rdoc","LICENSE","CHANGELOG"]
s.rdoc_options = [ "--title", "Active Acl Plus", "--main", "README.rdoc"]
-
-# s.add_dependency "rails", ">= 2.1.0"
-
+ s.files = FileList["[A-Z]*.*","{lib,app,db}/**/*"]
end
rescue LoadError
puts "Jeweler not available."
4 active_acl_plus.gemspec
View
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
s.date = %q{2009-03-23}
s.description = %q{A flexible, fast and easy to use generic access control system.}
s.email = ["peter.schrammel@gmx.de"]
- s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
- s.files = ["README.rdoc", "VERSION.yml", "lib/active_acl", "lib/active_acl/db", "lib/active_acl/db/mysql_adapter.rb", "lib/active_acl/db/active_record_adapter.rb", "lib/active_acl/cache", "lib/active_acl/cache/no_cache_adapter.rb", "lib/active_acl/cache/memcache_adapter.rb", "lib/active_acl/handler", "lib/active_acl/handler/object_handler.rb", "lib/active_acl/handler/nested_set.rb", "lib/active_acl/load_files_from.rb", "lib/active_acl/options.rb", "lib/active_acl/load_controller_actions.rb", "lib/active_acl/privilege_const_set.rb", "lib/active_acl/acts_as_access_group.rb", "lib/active_acl/grant.rb", "lib/active_acl/base.rb", "lib/active_acl/acts_as_access_object.rb", "lib/active_acl.rb", "test/unit", "test/unit/cache", "test/unit/cache/no_cache_adapter_test.rb", "test/unit/cache/memcache_adapter_test.rb", "test/unit/db", "test/unit/db/my_sql_adapter_test.rb", "test/unit/db/active_record_adapter_test.rb", "test/unit/acl_test.rb", "test/unit/controller_group_test.rb", "test/unit/controller_action_test.rb", "test/unit/method_added_test.rb", "test/unit/acl_section_test.rb", "test/unit/acts_as_access_object_test.rb", "test/unit/acts_as_access_group_test.rb", "test/unit/privilege_test.rb", "test/fixtures", "test/fixtures/acl_sections.yml", "test/fixtures/forums.yml", "test/fixtures/users.yml", "test/fixtures/user_groups.yml", "test/fixtures/user_groups_users.yml", "test/fixtures/categories.yml", "test/fixtures/acls.yml", "test/fixtures/controller_actions.yml", "test/fixtures/controller_groups.yml", "test/fixtures/privileges.yml", "test/fixtures/requester_group_links.yml", "test/fixtures/requester_links.yml", "test/fixtures/target_group_links.yml", "test/fixtures/target_links.yml", "test/rails_root", "test/rails_root/app", "test/rails_root/app/controllers", "test/rails_root/app/controllers/application.rb", "test/rails_root/app/controllers/action_test_controller.rb", "test/rails_root/app/helpers", "test/rails_root/app/helpers/application_helper.rb", "test/rails_root/app/models", "test/rails_root/app/models/category.rb", "test/rails_root/app/models/forum.rb", "test/rails_root/app/models/paying_member.rb", "test/rails_root/app/models/sti_forum.rb", "test/rails_root/app/models/user.rb", "test/rails_root/app/models/user_group.rb", "test/rails_root/app/views", "test/rails_root/app/views/layouts", "test/rails_root/config", "test/rails_root/config/environments", "test/rails_root/config/environments/mysql.rb", "test/rails_root/config/environments/postgresql.rb", "test/rails_root/config/environments/sqlite3.rb", "test/rails_root/config/initializers", "test/rails_root/config/initializers/inflections.rb", "test/rails_root/config/initializers/mime_types.rb", "test/rails_root/config/initializers/new_rails_defaults.rb", "test/rails_root/config/database.example", "test/rails_root/config/routes.rb", "test/rails_root/config/boot.rb", "test/rails_root/config/environment_old.rb", "test/rails_root/config/environment.rb", "test/rails_root/config/database.yml", "test/rails_root/db", "test/rails_root/db/migrate", "test/rails_root/db/migrate/002_create_base_tables.rb", "test/rails_root/db/schema.rb", "test/rails_root/db/test.sqlite3", "test/rails_root/lib", "test/rails_root/lib/tasks", "test/rails_root/log", "test/rails_root/log/sqlite3.log", "test/rails_root/public", "test/rails_root/public/old", "test/rails_root/public/old/stylesheets", "test/rails_root/public/old/javascripts", "test/rails_root/public/old/javascripts/prototype.js", "test/rails_root/public/old/javascripts/effects.js", "test/rails_root/public/old/javascripts/dragdrop.js", "test/rails_root/public/old/javascripts/controls.js", "test/rails_root/public/old/javascripts/application.js", "test/rails_root/public/old/images", "test/rails_root/public/old/images/rails.png", "test/rails_root/public/old/robots.txt", "test/rails_root/public/old/index.html", "test/rails_root/public/old/favicon.ico", "test/rails_root/public/old/dispatch.fcgi", "test/rails_root/public/old/dispatch.cgi", "test/rails_root/public/old/500.html", "test/rails_root/public/old/422.html", "test/rails_root/public/old/404.html", "test/rails_root/public/old/dispatch.rb", "test/rails_root/script", "test/rails_root/script/performance", "test/rails_root/script/performance/benchmarker", "test/rails_root/script/performance/profiler", "test/rails_root/script/performance/request", "test/rails_root/script/process", "test/rails_root/script/process/reaper", "test/rails_root/script/process/spawner", "test/rails_root/script/process/inspector", "test/rails_root/script/about", "test/rails_root/script/console", "test/rails_root/script/dbconsole", "test/rails_root/script/destroy", "test/rails_root/script/generate", "test/rails_root/script/runner", "test/rails_root/script/server", "test/rails_root/script/plugin", "test/rails_root/test", "test/rails_root/test/fixtures", "test/rails_root/test/functional", "test/rails_root/test/integration", "test/rails_root/test/unit", "test/rails_root/test/test_helper.rb", "test/rails_root/vendor", "test/rails_root/vendor/plugins", "test/rails_root/vendor/plugins/active_acl", "test/rails_root/vendor/plugins/active_acl/init.rb", "test/rails_root/vendor/plugins/awesome_nested_set", "test/rails_root/vendor/plugins/awesome_nested_set/lib", "test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set", "test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/compatability.rb", "test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/helper.rb", "test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/named_scope.rb", "test/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb", "test/rails_root/vendor/plugins/awesome_nested_set/rails", "test/rails_root/vendor/plugins/awesome_nested_set/rails/init.rb", "test/rails_root/vendor/plugins/awesome_nested_set/test", "test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set", "test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set/helper_test.rb", "test/rails_root/vendor/plugins/awesome_nested_set/test/db", "test/rails_root/vendor/plugins/awesome_nested_set/test/db/schema.rb", "test/rails_root/vendor/plugins/awesome_nested_set/test/db/database.yml", "test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures", "test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/category.rb", "test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/categories.yml", "test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/departments.yml", "test/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/notes.yml", "test/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set_test.rb", "test/rails_root/vendor/plugins/awesome_nested_set/test/test_helper.rb", "test/rails_root/vendor/plugins/awesome_nested_set/MIT-LICENSE", "test/rails_root/vendor/plugins/awesome_nested_set/README.rdoc", "test/rails_root/vendor/plugins/awesome_nested_set/Rakefile", "test/rails_root/vendor/plugins/awesome_nested_set/awesome_nested_set.gemspec", "test/rails_root/vendor/plugins/awesome_nested_set/init.rb", "test/rails_root/tmp", "test/rails_root/tmp/sessions", "test/rails_root/tmp/sockets", "test/rails_root/tmp/cache", "test/rails_root/tmp/pids", "test/rails_root/Rakefile", "test/rails_root/README", "test/functional", "test/functional/controller_action_test.rb", "test/test_helper.rb", "test/unit_tests.rb", "test/all_tests.rb", "test/test_fixtures.rb", "test/load_fixtures.rb", "test/functional_tests.rb", "test/README.rdoc", "spec/README.rdoc", "spec/models", "spec/models/base_spec.rb", "spec/models/grant_spec.rb", "spec/models/has_privilege_g_g_spec.rb", "spec/models/has_privilege_g_spec.rb", "spec/models/has_privilege_g_ug_spec.rb", "spec/models/has_privilege_ug_g_spec.rb", "spec/models/has_privilege_ug_spec.rb", "spec/models/has_privilege_ug_ug_spec.rb", "spec/models/method_added_spec.rb", "spec/models/privilege_spec.rb", "spec/rails_root", "spec/rails_root/Rakefile", "spec/rails_root/app", "spec/rails_root/app/controllers", "spec/rails_root/app/controllers/action_test_controller.rb", "spec/rails_root/app/controllers/application.rb", "spec/rails_root/app/helpers", "spec/rails_root/app/helpers/application_helper.rb", "spec/rails_root/app/models", "spec/rails_root/app/models/category.rb", "spec/rails_root/app/models/company.rb", "spec/rails_root/app/models/forum.rb", "spec/rails_root/app/models/page.rb", "spec/rails_root/app/models/paying_member.rb", "spec/rails_root/app/models/sti_forum.rb", "spec/rails_root/app/models/user.rb", "spec/rails_root/app/models/user_group.rb", "spec/rails_root/app/models/person.rb", "spec/rails_root/app/models/family.rb", "spec/rails_root/config", "spec/rails_root/config/boot.rb", "spec/rails_root/config/database.yml", "spec/rails_root/config/environment.rb", "spec/rails_root/config/environments", "spec/rails_root/config/environments/development.rb", "spec/rails_root/config/environments/mysql.rb", "spec/rails_root/config/environments/postgresql.rb", "spec/rails_root/config/environments/sqlite3.rb", "spec/rails_root/config/initializers", "spec/rails_root/config/initializers/inflections.rb", "spec/rails_root/config/initializers/mime_types.rb", "spec/rails_root/config/initializers/new_rails_defaults.rb", "spec/rails_root/config/routes.rb", "spec/rails_root/db", "spec/rails_root/db/migrate", "spec/rails_root/db/migrate/002_create_base_tables.rb", "spec/rails_root/db/schema.rb", "spec/rails_root/db/test.sqlite3", "spec/rails_root/script", "spec/rails_root/script/about", "spec/rails_root/script/console", "spec/rails_root/script/dbconsole", "spec/rails_root/script/destroy", "spec/rails_root/script/generate", "spec/rails_root/script/performance", "spec/rails_root/script/performance/benchmarker", "spec/rails_root/script/performance/profiler", "spec/rails_root/script/performance/request", "spec/rails_root/script/plugin", "spec/rails_root/script/process", "spec/rails_root/script/process/inspector", "spec/rails_root/script/process/reaper", "spec/rails_root/script/process/spawner", "spec/rails_root/script/server", "spec/rails_root/vendor", "spec/rails_root/vendor/plugins", "spec/rails_root/vendor/plugins/active_acl", "spec/rails_root/vendor/plugins/active_acl/init.rb", "spec/rails_root/vendor/plugins/awesome_nested_set", "spec/rails_root/vendor/plugins/awesome_nested_set/MIT-LICENSE", "spec/rails_root/vendor/plugins/awesome_nested_set/README.rdoc", "spec/rails_root/vendor/plugins/awesome_nested_set/Rakefile", "spec/rails_root/vendor/plugins/awesome_nested_set/awesome_nested_set.gemspec", "spec/rails_root/vendor/plugins/awesome_nested_set/init.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/lib", "spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set", "spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/compatability.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/helper.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set/named_scope.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/rails", "spec/rails_root/vendor/plugins/awesome_nested_set/rails/init.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/test", "spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set", "spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set/helper_test.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/test/awesome_nested_set_test.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/test/db", "spec/rails_root/vendor/plugins/awesome_nested_set/test/db/database.yml", "spec/rails_root/vendor/plugins/awesome_nested_set/test/db/schema.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures", "spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/categories.yml", "spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/category.rb", "spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/departments.yml", "spec/rails_root/vendor/plugins/awesome_nested_set/test/fixtures/notes.yml", "spec/rails_root/vendor/plugins/awesome_nested_set/test/test_helper.rb", "spec/rails_root/log", "spec/rails_root/log/sqlite3.log", "spec/spec_helper.rb", "LICENSE"]
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE", "CHANGELOG"]
+ s.files = ["README.rdoc", "VERSION.yml", "lib/active_acl", "lib/active_acl/db", "lib/active_acl/db/mysql_adapter.rb", "lib/active_acl/db/active_record_adapter.rb", "lib/active_acl/cache", "lib/active_acl/cache/no_cache_adapter.rb", "lib/active_acl/cache/memcache_adapter.rb", "lib/active_acl/handler", "lib/active_acl/handler/object_handler.rb", "lib/active_acl/handler/nested_set.rb", "lib/active_acl/load_files_from.rb", "lib/active_acl/options.rb", "lib/active_acl/load_controller_actions.rb", "lib/active_acl/privilege_const_set.rb", "lib/active_acl/acts_as_access_group.rb", "lib/active_acl/grant.rb", "lib/active_acl/base.rb", "lib/active_acl/acts_as_access_object.rb", "lib/active_acl.rb", "app/models", "app/models/active_acl", "app/models/active_acl/acl_section.rb", "app/models/active_acl/controller_group.rb", "app/models/active_acl/privilege.rb", "app/models/active_acl/requester_group_link.rb", "app/models/active_acl/requester_link.rb", "app/models/active_acl/target_group_link.rb", "app/models/active_acl/target_link.rb", "app/models/active_acl/controller_action.rb", "app/models/active_acl/acl.rb", "db/migrate", "db/migrate/001_base_table_setup.rb", "LICENSE", "CHANGELOG"]
s.has_rdoc = true
s.homepage = %q{http://activeaclplus.rubyforge.org/}
s.rdoc_options = ["--title", "Active Acl Plus", "--main", "README.rdoc", "--inline-source", "--charset=UTF-8"]
18 lib/active_acl.rb
View
@@ -22,11 +22,17 @@ module ActiveAcl
require 'active_acl/load_files_from'
-# call class so its loaded and registered as access object
-# wrap in rescue block so migrations don't fail
+$:.unshift File.join(File.dirname(__FILE__),'../app/models/')
+
begin
- ActiveAcl::ControllerAction
- ActiveAcl::ControllerGroup
+['privilege','acl_section','privilege','requester_link','target_link',
+'acl_section','requester_group_link','target_group_link','acl',
+'controller_group','controller_action'].each do |model|
+ require "active_acl/#{model}"
+ end
rescue StandardError => e
- puts "Error #{e.message} #{e.backtrace.join("\n")}(need migrations?)"
-end
+ puts "[ERROR] ActiveAcl: #{e.message}. Migrating?"
+end
+
+$:.shift
+
4 lib/active_acl/acts_as_access_group.rb
View
@@ -24,11 +24,11 @@ def acts_as_access_group(options = {})
extend SingletonMethods
ActiveAcl::Acl.instance_eval do
- has_many_polymorphs :requester_groups, {:from => ActiveAcl.from_classes,
+ has_many_polymorphs :requester_groups, {:from => ActiveAcl.from_group_classes,
:through => :"active_acl/requester_group_links",
:rename_individual_collections => true}
- has_many_polymorphs :target_groups, {:from => ActiveAcl.from_classes,
+ has_many_polymorphs :target_groups, {:from => ActiveAcl.from_group_classes,
:through => :"active_acl/target_group_links",
:rename_individual_collections => true}
end
8 lib/active_acl/acts_as_access_object.rb
View
@@ -38,11 +38,11 @@ def acts_as_access_object(options = {})
include ActiveAcl::Acts::Grant
ActiveAcl::Acl.instance_eval do
- has_many_polymorphs :requesters, {:from => ActiveAcl.from_classes,
+ has_many_polymorphs :requesters, {:from => ActiveAcl.from_access_classes,
:through => :"active_acl/requester_links",
:rename_individual_collections => true}
- has_many_polymorphs :targets, {:from => ActiveAcl.from_classes,
+ has_many_polymorphs :targets, {:from => ActiveAcl.from_access_classes,
:through => :"active_acl/target_links",
:rename_individual_collections => true}
end
@@ -53,9 +53,9 @@ def acts_as_access_object(options = {})
alias :reload_before_active_acl :reload
# Redefines reload, making shure privilege caches are cleared on reload
- def reload #:nodoc:
+ def reload(options={}) #:nodoc:
active_acl_clear_cache!
- reload_before_active_acl
+ reload_before_active_acl(options)
end
end
end
11 lib/active_acl/base.rb
View
@@ -21,9 +21,14 @@ def self.is_access_group?(klass)
def self.is_access_object?(klass)
!!ACCESS_CLASSES[klass.base_class.name]
end
- def self.from_classes
- ACCESS_CLASSES.keys.collect do |x|
- x.split('::').join('/').underscore.pluralize.to_sym
+ def self.from_access_classes
+ ACCESS_CLASSES.keys.collect do |class_name|
+ class_name.underscore.pluralize.to_sym
+ end
+ end
+ def self.from_group_classes
+ GROUP_CLASSES.keys.collect do |class_name|
+ class_name.underscore.pluralize.to_sym
end
end
end
1  lib/active_acl/cache/memcache_adapter.rb
View
@@ -4,6 +4,7 @@
# require is enough to activate the memcache. Before using the memcache, make sure to set MemcacheAdapter.cache.
#
# In environment.rb:
+# require 'memcache'
# require 'active_acl/cache/memcache_adapter'
# ActiveAcl::Cache::MemcacheAdapter.cache = MemCache.new('localhost:11211', :namespace => 'my_namespace')
# you can also set the time to leave:
2  lib/active_acl/handler/object_handler.rb
View
@@ -79,7 +79,7 @@ def has_privilege?(requester,privilege,target=nil)
end
#replacing the vars in the SQL
- sql=sql.gsub(/%{[^}]+}/) do |var|
+ sql=sql.gsub(/%\{[^\}]+\}/) do |var|
vars[var[2..-2]] || var
end
Please sign in to comment.
Something went wrong with that request. Please try again.