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



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

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



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

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



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

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