stffn / declarative_authorization

An unmaintained authorization plugin for Rails. Please fork to support current versions of Rails
MIT License
1.24k stars 230 forks source link

jruby and authorization.rb #136

Closed tuominen closed 12 years ago

tuominen commented 12 years ago

Hi,

Has anyone used this successfully on JRuby? I am trying, but it seems to ignore the rules configuration file altogether.

I get "No matching rules found for new for #<Authorization::AnonymousUser:0x1aaf84c @role_symbols=[:guest]> (roles [:guest], privileges [:new], context :user_sessions)"

and "No matching rules found for destroy for #<User id: 1, ... ...> (roles [:default], privileges [:destroy], context :user_sessions) REGARDLESS if config/authorization_rules.rb exists or not. Here are the rules btw:

authorization do

Permissions for unauthenticated users

role :guest do has_permission_on :user_sessions, :to => :create end

Base permissions for authenticated users

role :default do has_permission_on :user_sessions, :to => :delete end end

privileges do

builtin

privilege :manage, :includes => [:create, :read, :update, :delete] privilege :read, :includes => [:index, :show] privilege :create, :includes => :new privilege :update, :includes => :edit privilege :delete, :includes => :destroy end

In other projects with CRuby all has been well. I am just blind or how can I not see what's wrong here?

jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (OpenJDK Client VM 1.6.0_24) [linux-i386-java] Rails 3.2.2 declarative_authorization (0.5.5)

EDIT: ....aaand now it works after purging and reinstalling gems for jruby in rvm. Sorry for the noise.

BR, Tatu