ruby on rails - Database help trying to get Functions from a group through users -
ruby on rails - Database help trying to get Functions from a group through users -
i need check whether user part of grouping has functions give them access usermanagement page.. current have
def user_managment # if in grouping 1 , user has function id 1 (user management) if current_user.group_ids.include?(1) && current_user.function_ids.include?(1)#&& group.function_ids.include?(1) flash[:error] = "you have access user management!" else flash[:error] = "you have not access user management!" end if current_user.group_ids.include?(1) && group_ids(1).function_ids.include?(1) flash[:error] = "test" end end im unsure how check if have string user management in table userscontrollers can help?
what you're talking here access control, please please please please, stop you're doing , @ one of many, first-class authorization/acl gems out there. example, using acl9 have code that's much more comprehensible , expressive, such as:
access_control allow :manager, :of => user, :to => :user_management end rolling stuff bad move, , you'll end lot of messy code intertwined through app, hard maintain, , impossible ensure it's doing need to.
ruby-on-rails ruby ruby-on-rails-3 rubygems ruby-on-rails-plugins
Comments
Post a Comment