Module: Zuul::ActiveRecord::Permission::InstanceMethods

Defined in:
lib/zuul/active_record/permission.rb

Instance Method Summary collapse

Instance Method Details

#assigned_contextsObject

Returns a list of contexts within which the permission has been assigned to roles and/or subjects



34
35
36
# File 'lib/zuul/active_record/permission.rb', line 34

def assigned_contexts
  role_contexts.concat(subject_contexts).uniq
end

#role_contextsObject

Returns a list of contexts within which the permission has been assigned to roles



39
40
41
42
43
# File 'lib/zuul/active_record/permission.rb', line 39

def role_contexts
  auth_scope do
    send(permission_role_plural_key).group(:context_type, :context_id).map(&:context)
  end
end

#subject_contextsObject

Returns a list of contexts within which the permission has been assigned to subjects



46
47
48
49
50
# File 'lib/zuul/active_record/permission.rb', line 46

def subject_contexts
  auth_scope do
    send(permission_subject_plural_key).group(:context_type, :context_id).map(&:context)
  end
end