Sha256: 3cf11e70e0efe9fcbbd768f35e8c8003ef19c65864ca119cd28809cb41b09630
Contents?: true
Size: 1005 Bytes
Versions: 53
Compression:
Stored size: 1005 Bytes
Contents
class AbstractResourcePolicy class Scope attr_reader :current_user, :scope def initialize(user, scope) @current_user = user @scope = scope end def resolve scope.all end end attr_reader :current_user, :model def initialize(current_user, model) @current_user = current_user @model = model end def index? # @current_user.admin? true end def new? # @current_user.admin? true end def edit? # @current_user.admin? true end def show? # @current_user.admin? or @current_user == @user true end def create? # @current_user.admin? true end def update? # @current_user.admin? true end def destroy? # return false if @current_user == @user # @current_user.admin? true end def attach? true end def detach? true end def prefer? true end def defer? true end def activate? true end def deactivate? true end end
Version data entries
53 entries across 36 versions & 1 rubygems