Module: Authorule::Rule

Extended by:
ActiveSupport::Concern
Defined in:
lib/authorule/rule.rb

Overview

A permission rule. Each rule allows or denies the permission holder one permission.

Usage

Create a model class, and include this mixin into it, e.g.

class PermissionRule < ActiveRecord::Base
  include Authorule::Rule

  belongs_to :user
end

See Also:

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyString (readonly)

Returns A unique key identifying this rule.

Returns:

  • (String)

    A unique key identifying this rule.



98
99
100
101
102
103
104
# File 'lib/authorule/rule.rb', line 98

def key
  if kind == 'all'
    'all'
  else
    [ kind, name, action ].compact.join(':')
  end
end

Instance Method Details

#to_displayObject

Misc



109
110
111
# File 'lib/authorule/rule.rb', line 109

def to_display
  key
end