class PIM::Authorization::RoleBuilder

Attributes

data_model[R]

Public Class Methods

new(data_model, default_permissions) click to toggle source
# File pim.rb, line 7353
def initialize data_model, default_permissions
  @data_model = data_model
  @default_permissions = default_permissions
end

Public Instance Methods

allow(object_type = ALL, *actions, &block) click to toggle source
# File pim.rb, line 7365
def allow object_type = ALL, *actions, &block
  @permissions << AllowPermission.new(data_model, object_type, *actions, &block)
end
build(name, &block) click to toggle source
# File pim.rb, line 7358
def build name, &block
  @permissions = []
  self.instance_exec(&@default_permissions) if @default_permissions
  self.instance_exec(&block)
  Role.new(name, @permissions)
end
deny(object_type = ALL, *actions, &block) click to toggle source
# File pim.rb, line 7369
def deny object_type = ALL, *actions, &block
  @permissions << DenyPermission.new(data_model, object_type, *actions, &block)
end