Class: Ditty::UserPolicy::Scope

Inherits:
ApplicationPolicy::Scope show all
Defined in:
lib/ditty/policies/user_policy.rb

Instance Attribute Summary

Attributes inherited from ApplicationPolicy::Scope

#scope, #user

Instance Method Summary collapse

Methods inherited from ApplicationPolicy::Scope

#initialize

Constructor Details

This class inherits a constructor from Ditty::ApplicationPolicy::Scope

Instance Method Details

#resolveObject



39
40
41
42
43
44
45
46
47
# File 'lib/ditty/policies/user_policy.rb', line 39

def resolve
  if user&.super_admin?
    scope
  elsif user
    scope.where(id: user.id)
  else
    scope.where(id: -1)
  end
end