You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where am I going wrong? I have a register of users, where a User with Lider rule, you can manage your users and some other actions, but do not know why, this rule does not work. Sorry for my English
ability.rb
classAbilityincludeCanCan::Abilitydefinitialize(user)user ||= User.newifuser.has_role?:participantcan[:show,:update],User,id: user.idcan:see_timestamps,User,id: user.idendifuser.has_role?:leaderRails.logger.debug"Leader - Testing"can[:read,:update],User,id: user.idRails.logger.info"Before Testing - User is leader"can:manage,User,leader_id: user.id# not work - always true :-( all userscan:destroy,User,status: 0cannot:destroy,User,id: user.idcannot:confirmation,User# can :read, User, leader_id: user.id# p.try(:leader_id) == user.id# end# if user.leader_id.nil?# can :manage, User do |participant|# participant.leader_id == user.id# end# can :create, User# cannot :destroy, User, status: 1# end# can :read, User do |participant|# participant.leader_id == user.id# end# can [:read, :update], User do |account|# account.email == user.email# end# can :see_timestamps, User, :leader_id => user.idendifuser.has_role?:supervisorRails.logger.debug'Supervisor - Testing'can:manage,[State,City]endifuser.has_role?:admincan:manage,:allendendend
Where am I going wrong? I have a register of users, where a User with Lider rule, you can manage your users and some other actions, but do not know why, this rule does not work. Sorry for my English
ability.rb
users_controller.rb
index.html.erb
Show debug params => permitted: false
The text was updated successfully, but these errors were encountered: