# Problem with ACL plugin system

**URL:** <https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243>\
**Category:** Rails\
**Created:** [March 22, 2006, 12:35pm UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243 "2006-03-22T12:35:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 22, 2006, 12:35pm UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243/1 "2006-03-22T12:35:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 22, 2006, 2:24pm UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243/2 "2006-03-22T14:24:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 22, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243/3 "2006-03-22T20:46:05Z")

</div>

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_system2/)  
[http://opensvn.csie.org/ezra/rails/plugins/dev/acl\_system2/README](http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2/README)

```
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](http://lists.rubyonrails.org/mailman/listinfo/rails)

-Ezra Z.  
Yakima Herald-Republic  
WebMaster

> **[yakimaherald.com | Yakima, Washington - We Tell Your Stories](https://www.yakimaherald.com/)**

509-577-7732  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 22, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243/4 "2006-03-22T21:34:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 23, 2006, 11:44am UTC](https://www.ruby-forum.com/t/problem-with-acl-plugin-system/85243/5 "2006-03-23T11:44:53Z")

</div>

Ezra  
Yup. That solved it. Thanks again.  
Chris
