Cancan authentication with Rails -


i have complex scenario authentication it, came model structure.

see model structure

can 1 guide how use cancan embed authentication structure.

def initialize (user)     user ||= user.new # guest user         user.roles.each |role|       role.permissions.each |p|         can :read, p.resource.class_name.to_s.classify.constantize |subject|           p.resource.class_name == subject.id , p.can_read         end         can :create, p.resource.class_name.to_s.classify.constantize |subject|           p.resource.class_name == subject.id , p.can_create         end         can :update, p.resource.class_name.to_s.classify.constantize |subject|           p.resource.class_name == subject.id , p.can_update         end         can :destroy, p.resource.class_name.to_s.classify.constantize |subject|           p.resource.class_name == subject.id , p.can_delete         end       end     end end 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -