Sha256: a0bf560e458de131bc06f5f98de50657bea4f17a808febbfc01ac7e2fd9a1063

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

class UserPolicy < Policy
  module Collection
    def index?
      true
    end

    def deactivated?
      index?
    end

    def new?
      !User.any? || user.role?(:users)
    end

    def create?
      new?
    end

    def manage?
      new?
    end
  end

  module Member
    def edit?
      user == record || user.role?(:users)
    end

    def show?
      edit?
    end

    def delete_image?
      edit?
    end

    def policies?
      user.role?(:users)
    end

    def destroy?
      user.role?(:users)
    end
  end

  def change_password?
    user == record
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 app/policies/user_policy.rb