Method: Authorization::Reader::AuthorizationRulesReader#to

Defined in:
lib/declarative_authorization/reader.rb

#to(*privs) ⇒ Object

Used in a has_permission_on block, to may be used to specify privileges to be assigned to the current role under the conditions specified in the current block.

role :admin
  has_permission_on :employees do
    to :create, :read, :update, :delete
  end
end

Raises:



277
278
279
280
# File 'lib/declarative_authorization/reader.rb', line 277

def to (*privs)
  raise DSLError, "to only allowed in has_permission_on blocks" if @current_rule.nil?
  @current_rule.append_privileges(privs)
end