Forum: Ruby on Rails Problem with ACL plugin system

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ChrisT (Guest)
on 2006-03-22 13:35
(Received via mailing list)
Don't know if anyone else has experienced this but I'm having a problem
with the access_denied method in Ezra's ACL access control plugin. It's
working fine (in conjunction with acts_as_authenticated) until it comes
across a user it denies access to, in which case it throws the following
error:

    NoMethodError in Admin#index

    protected method `access_denied' called for
#<AdminController:0x408fc9a8>

    RAILS_ROOT: script/../config/..
    Application Trace | Framework Trace | Full Trace


./script/../config/../vendor/plugins/acl_system/lib/caboose/access_control.rb:24:in
`access_control'

The prob seems to be in the following code block:

23            if c.respond_to?(:access_denied)
24            c.access_denied
25            else
26              c.send(:render_text, "You have insufficient permissions
to access #{c.controller_name}/#{c.action_name}")
27            end

If I comment out everything except line 26, it behaves as expected. I'm
still pretty noobish, but can't work out why 24 should throw an error
when 23 checks that the method exists (and a debug of the controller
methods confirms that). Any ideas?
Thanks in advance

Chris T
Chris T (Guest)
on 2006-03-22 15:24
OK. If I add an access_denied method to the controller it works but only
if it is not protected. If it's protected (which I think it should be)
or not there at all it throws up the no method error. Running 1.1RC1, by
the way.

ChrisT wrote:
> Don't know if anyone else has experienced this but I'm having a problem
> with the access_denied method in Ezra's ACL access control plugin. It's
> working fine (in conjunction with acts_as_authenticated) until it comes
> across a user it denies access to, in which case it throws the following
> error:
>
>     NoMethodError in Admin#index
>
>     protected method `access_denied' called for
> #<AdminController:0x408fc9a8>
>
>     RAILS_ROOT: script/../config/..
>     Application Trace | Framework Trace | Full Trace
>
>
> ./script/../config/../vendor/plugins/acl_system/lib/caboose/access_control.rb:24:in
> `access_control'
>
> The prob seems to be in the following code block:
>
> 23            if c.respond_to?(:access_denied)
> 24            c.access_denied
> 25            else
> 26              c.send(:render_text, "You have insufficient permissions
> to access #{c.controller_name}/#{c.action_name}")
> 27            end
>
> If I comment out everything except line 26, it behaves as expected. I'm
> still pretty noobish, but can't work out why 24 should throw an error
> when 23 checks that the method exists (and a debug of the controller
> methods confirms that). Any ideas?
> Thanks in advance
>
> Chris T
Ezra Z. (Guest)
on 2006-03-22 21:46
(Received via mailing list)
Hey Chris-

	I have updated this plugin to add some more features. A few things
have changed so please try this new version. Make sure you read the
readme so you can see what has changed.

http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2/
http://opensvn.csie.org/ezra/rails/plugins/dev/acl...


	You will see that the callback methods are now permission_granted
and permission_denied. Other then that a few bugs are fixed. The
reason behind this was that acts_as_auth already defines an
access_denied method that was conflicting with the method in my
plugin. Please use the new version.

Cheers-
-Ezra

On Mar 22, 2006, at 5:24 AM, Chris T wrote:

>> with the access_denied method in Ezra's ACL access control plugin.
>> #<AdminController:0x408fc9a8>
>>
>> still pretty noobish, but can't work out why 24 should throw an error
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid
Chris T. (Guest)
on 2006-03-22 22:34
(Received via mailing list)
I did wonder if the naming of the method might be the problem. I'll try
it as soon as I've just finished this bit of coding. Thanks for
providing the plug-in. Great work

Chris
p.s. How's Rubuntu going?
ChrisT (Guest)
on 2006-03-23 12:44
(Received via mailing list)
Ezra
Yup. That solved it. Thanks again.
Chris
This topic is locked and can not be replied to.