Bharat R. wrote:
Are you sure that:
- You have these roles defined in the roles table? and;
- There is an entry for row_id and user_id in your roles_users table?
If admin user has a user_id of 1 in users table and your roles table
defines the “admin” role with a role_id = 1 then you must have a row
in roles_users table corresponding to this combination:
role_id = 1, user_id = 1
Check if you have done this.
Sorry for resurrecting an old thread, but this situation describes
exactly the situation I have set up. Yet I can’t get the user to
authenticate as an administrator.
I have a single user who I have granted admin rights, in the
| admin_id | user_id |
| 1 | 1 |
Where in the user table the user has ID = 1. The user is also in the
| id | name |
| 1 | test |
However, I am seeing this query deny the user access:
User Columns (1.3ms) SHOW FIELDS FROM
User Load (0.5ms) SELECT * FROM
users WHERE (
id = 1)
admins_users Columns (0.8ms) SHOW FIELDS FROM
Admin Load (1.2ms) SELECT * FROM
admins INNER JOIN
admins_users.user_id = 1 )
Admin Columns (0.8ms) SHOW FIELDS FROM
Filter chain halted as [:check_roles] rendered_or_redirected.
I always end up with the following text:
‘You don’t have access here.’
It seems like something is going wrong here:
return access_denied unless self.class.<%= users_name
%>authorized_for?(current<%= users_name %>, params, binding)
However, I can’t seem to discover why the user is denied access.