Forum: Ruby on Rails Authorization with single table inheritance?

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.
Invincible C. (Guest)
on 2007-04-17 00:43
(Received via mailing list)
Hi,


I am trying to use Authorization plugin for providing access control for
my
application.Application has 2 types of users, admins and end-users both
being maintained in a single table with calles users and with the helps
of
users and admins using STI.
When I make my admin model "user-like" by including statement
"acts_as_authorized_user" and have something like " permit 'admin' " in
any
of the controller, it gives following error in development log,

"There is not table by name ROLES_ADMINS"

Looks like authorization plugin just reads the class name and tries to
find
a table with roles_#{class_name}.

On a second attempt I tried including acts_as_authorized_user in User
model
which is extended by Admin and EndUser Models...despite of having permit
'admin' statement, Rails allows all the controller actions visible to
all
the users irrespective of their role :(


Has anyone tried this before?


-Invincible
Invincible C. (Guest)
on 2007-04-17 01:36
(Received via mailing list)
ok guys...thats was really a silly mistake...

In my User model I had following statemnt

def has_role?(role,options)
   true
end


-Invincible.
This topic is locked and can not be replied to.