Module: Micro::Authorization::Permissions

Defined in:
lib/micro/authorization/permissions.rb,
lib/micro/authorization/permissions/model.rb,
lib/micro/authorization/permissions/checker.rb,
lib/micro/authorization/permissions/for_each_feature.rb

Defined Under Namespace

Modules: Checker, ForEachFeature Classes: Model, MultipleRolesChecker, SingleRoleChecker

Class Method Summary collapse

Class Method Details

.[](instance) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/micro/authorization/permissions.rb', line 10

def self.[](instance)
  return instance if instance.is_a?(Permissions::Model)

  raise ArgumentError.new(
    "#{instance.inspect} must be a #{Permissions::Model.name}"
  )
end

.new(permissions, context: []) ⇒ Object



18
19
20
# File 'lib/micro/authorization/permissions.rb', line 18

def self.new(permissions, context: [])
  Permissions::Model.new(permissions, context)
end