Link_if_authorized() undefined in UserEngines permission pag


#1

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 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


#2

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 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>


#3

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.