Sha256: e6b70392c4e945f6517b0459a0a5795bfdf3be5bd4ef0b70fe6716ac8745c874

Contents?: true

Size: 473 Bytes

Versions: 33

Compression:

Stored size: 473 Bytes

Contents

module Locomotive
  class AccountPolicy < ApplicationPolicy

    def index?
      super_admin?
    end

    def show?
      super_admin? || owner?
    end

    def create?
      # everybody can create an account
      true
    end

    def update?
      super_admin? || owner?
    end

    def destroy?
      # can not delete himself/herself
      super_admin? && !owner?
    end

    private

    def owner?
      @resource._id == membership.account_id
    end

  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
locomotivecms-4.0.0.rc0 app/policies/locomotive/account_policy.rb
locomotivecms-4.0.0.alpha3 app/policies/locomotive/account_policy.rb
locomotivecms-3.4.1 app/policies/locomotive/account_policy.rb
locomotivecms-4.0.0.alpha2 app/policies/locomotive/account_policy.rb
locomotivecms-4.0.0.alpha1 app/policies/locomotive/account_policy.rb
locomotivecms-3.4.0 app/policies/locomotive/account_policy.rb
locomotivecms-3.3.0 app/policies/locomotive/account_policy.rb
locomotivecms-3.3.0.rc3 app/policies/locomotive/account_policy.rb
locomotivecms-3.3.0.rc2 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.2 app/policies/locomotive/account_policy.rb
locomotivecms-3.2.1 app/policies/locomotive/account_policy.rb
locomotivecms-3.3.0.rc1 app/policies/locomotive/account_policy.rb
locomotivecms-3.2.0 app/policies/locomotive/account_policy.rb
locomotivecms-3.2.0.rc2 app/policies/locomotive/account_policy.rb
locomotivecms-3.2.0.rc1 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.1 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.0 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.0.rc3 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.0.rc2 app/policies/locomotive/account_policy.rb
locomotivecms-3.1.0.rc1 app/policies/locomotive/account_policy.rb