Sha256: 666f6bfc3aad1a3bd0ab9ccd29d2a4c3be59ce692d64455ccd77bf92b3bcee70

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

class AccessPolicy
  include AccessGranted::Policy

  def configure
    # Example policy for AccessGranted.
    # For more details check the README at
    #
    # https://github.com/chaps-io/access-granted/blob/master/README.md
    #
    # Roles inherit from less important roles, so:
    # - :admin has permissions defined in :member, :guest and himself
    # - :member has permissions from :guest and himself
    # - :guest has only its own permissions since it's the first role.
    #
    # The most important role should be at the top.
    # In this case an administrator.
    #
    # role :admin, proc { |user| user.admin? } do
    #   can :destroy, User
    # end

    # More privileged role, applies to registered users.
    #
    # role :member, proc { |user| user.registered? } do
    #   can :create, Post
    #   can :create, Comment
    #   can [:update, :destroy], Post do |post, user|
    #     post.author == user
    #   end
    # end

    # The base role with no additional conditions.
    # Applies to every user.
    #
    # role :guest do
    #  can :read, Post
    #  can :read, Comment
    # end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
access-granted-1.3.3 lib/generators/templates/access_policy.rb
access-granted-1.3.1 lib/generators/templates/access_policy.rb
access-granted-1.3.0 lib/generators/templates/access_policy.rb
access-granted-1.2.0 lib/generators/templates/access_policy.rb
access-granted-1.1.2 lib/generators/templates/access_policy.rb
access-granted-1.1.1 lib/generators/templates/access_policy.rb
access-granted-1.1.0 lib/generators/templates/access_policy.rb
access-granted-1.0.4 lib/generators/templates/access_policy.rb