# Link\_if\_authorized() undefined in UserEngines permission pag

**URL:** <https://www.ruby-forum.com/t/link-if-authorized-undefined-in-userengines-permission-pag/101929>\
**Category:** Engines\
**Created:** [February 7, 2006, 8:29am UTC](https://www.ruby-forum.com/t/link-if-authorized-undefined-in-userengines-permission-pag/101929 "2006-02-07T08:29:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sporkmonger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@sporkmonger](https://www.ruby-forum.com/u/sporkmonger)\
**Post date:** [February 7, 2006, 8:29am UTC](https://www.ruby-forum.com/t/link-if-authorized-undefined-in-userengines-permission-pag/101929/1 "2006-02-07T08:29:14Z")

</div>

Hi,

I have recent versions (as of 2/5/2006) LoginEngine and UserEngine  
installed and I can login in via admin, create users, etc. That part  
seems to be working. I’m having trouble setting permissions, roles, etc.  
When I go to [http://localhost:3000/role/list](http://localhost:3000/role/list) I get an exception:

* * *

Showing vendor/plugins/user\_engine/app/views/role/list.rhtml where  
line #18 raised:

undefined method `link\_if\_authorized’ for  
#\<#Class:0x408502e8:0x408501e4\>

Extracted source (around line #18):

## 15: \<% end %\> 16: 17: 18: \<%= link\_if\_authorized ‘Show’, {:action =\> ‘show’, :id =\> role}, :wrap\_in =\> “li” %\> 19: \<%= link\_if\_authorized ‘Edit’, {:action =\> ‘edit’, :id =\> role}, :wrap\_in =\> “li” %\> 20: \<% if authorized?(:action =\> ‘destroy’) && (not UserEngine.config([:guest\_role\_name, :user\_role\_name, :admin\_role\_name]).include?(role.name)) %\> 21: \<%= button\_to ‘Destroy’, :action =\> ‘destroy’, :id =\> role %\>\<% end %\>

which essentially means that the application can’t find  
link\_if\_authorized(). This happens with user/list and permission/list so  
I think this is a generic problem for the admin pages/controllers.

The big-picture question: What’s the right way to get into the  
permissions system (user/list, permission/list, role/list, etc.)? I’ve  
done this before by reverse-engineering the controllers because I  
couldn’t find any documentation on UserEngine administration. user/home  
is blank by design; is there a right way (or a wrong way) to get to the  
permissions pages?

Smaller-picture question: if this is a generic issue for the permission  
system, where do I have to poke my application so it can find  
link\_if\_authorized()?

I’ve done ‘rake engine\_migrate’, ‘rake bootstrap’, and ‘rake  
sync\_permissions’; the users.role column is NULL for every user, and  
users\_roles for three users (user\_id == 1 is admin) looks like:

±--------±--------+  
| user\_id | role\_id |  
±--------±--------+  
| 1 | 3 |  
| 1 | 2 |  
| 2 | 3 |  
| 3 | 3 |  
±--------±--------+

Anything else I should be looking at to chase this down?

Thanks much,

– Bob

---

<div class="post-metadata">

**Author:** ![sporkmonger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@sporkmonger](https://www.ruby-forum.com/u/sporkmonger)\
**Post date:** [February 9, 2006, 3:54am UTC](https://www.ruby-forum.com/t/link-if-authorized-undefined-in-userengines-permission-pag/101929/2 "2006-02-09T03:54:37Z")

</div>

Hi,

I know, bad form to follow up on one’s own posts, but the simple  
(stupid) resolution was to follow all the installation instructions and  
add change app/helpers/application\_helper.rb to look like:

module ApplicationHelper  
include LoginEngine  
include UserEngine  
end

I’m just adding this so the solution is obvious if someone searches the  
archives for a similar issue. In retrospect, the symptom is obvious  
enough.

– Bob

Bob A. wrote:

> I have recent versions (as of 2/5/2006) LoginEngine and UserEngine  
> installed and I can login in via admin, create users, etc. That part  
> seems to be working. I’m having trouble setting permissions, roles, etc.  
> When I go to [http://localhost:3000/role/list](http://localhost:3000/role/list) I get an exception:
> 
> * * *
> 
> Showing vendor/plugins/user\_engine/app/views/role/list.rhtml where  
> line #18 raised:
> 
> undefined method `link\_if\_authorized’ for #\<#Class:0x408502e8:0x408501e4\>  
> …

---

<div class="post-metadata">

**Author:** ![sporkmonger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@sporkmonger](https://www.ruby-forum.com/u/sporkmonger)\
**Post date:** [April 3, 2006, 11:34am UTC](https://www.ruby-forum.com/t/link-if-authorized-undefined-in-userengines-permission-pag/101929/3 "2006-04-03T11:34:40Z")

</div>

> I’m just adding this so the solution is obvious if someone searches the  
> archives for a similar issue. In retrospect, the symptom is obvious  
> enough.

You’ll be surprised how much help a simple post to a simple problem can  
be to a frazzled hacker in the middle of the night… thanks.
