Module: IAmICan::Permission::Helpers::Ins

Included in:
Assignment
Defined in:
lib/i_am_i_can/permission/helpers.rb

Instance Method Summary collapse

Instance Method Details

#_pms_assignment_result(preds, obj, not_defined_items, covered_items = nil, strict_mode = false) ⇒ Object

Raises:



48
49
50
51
52
53
54
55
56
# File 'lib/i_am_i_can/permission/helpers.rb', line 48

def _pms_assignment_result(preds, obj, not_defined_items, covered_items = nil, strict_mode = false)
  prefix = 'Permission Assignment Done'
  msg1 = "#{not_defined_items} have not been defined or have been repeatedly assigned" if not_defined_items.present?
  msg2 = "#{covered_items} have been covered" if covered_items.present?
  fail_msg = prefix + ', but ' + [msg1, msg2].compact.join(', ') if msg1 || msg2
  raise Error, fail_msg if (strict_mode || i_am_i_can.strict_mode) && fail_msg
  puts fail_msg || prefix unless ENV['ITEST']
  prefix.present?
end

#local_permissionsObject Also known as: local_permission_names



62
63
64
# File 'lib/i_am_i_can/permission/helpers.rb', line 62

def local_permissions
  @local_permissions ||= [ ]
end

#permissionsObject

TODO: show by hash



69
70
71
# File 'lib/i_am_i_can/permission/helpers.rb', line 69

def permissions
  local_permission_names + stored_permission_names
end

#pms_matched?(pms_name, plist) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/i_am_i_can/permission/helpers.rb', line 58

def pms_matched?(pms_name, plist)
  i_am_i_can.permission_model.matched?(pms_name, in: plist[:in])
end