Sha256: 22178194449358bffe1d88a176bff2c77ccaa2fa7af27bda6589e06bd37efb59
Contents?: true
Size: 502 Bytes
Versions: 1
Compression:
Stored size: 502 Bytes
Contents
# coding: utf-8 module ScCore class Ability include CanCan::Ability def initialize(user) user ||= User.new cannot :manage, :all if root?(user) can :manage, :all else if client_admin?(user) can :read, :user end end end private def root?(user) user.class == AdminUser ? true : false end def client_admin?(user) user.roles.find_by(identifier: :client_admin).present? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sc_core-0.0.7 | app/models/sc_core/ability.rb |