Class: MrMime::ImpersonationPolicy

Inherits:
Object
  • Object
show all
Defined in:
app/models/mr_mime/impersonation_policy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(impersonator, impersonated) ⇒ ImpersonationPolicy

Returns a new instance of ImpersonationPolicy.



11
12
13
14
# File 'app/models/mr_mime/impersonation_policy.rb', line 11

def initialize(impersonator, impersonated)
  @impersonator = impersonator
  @impersonated = impersonated
end

Instance Attribute Details

#impersonatedObject (readonly)

Returns the value of attribute impersonated.



5
6
7
# File 'app/models/mr_mime/impersonation_policy.rb', line 5

def impersonated
  @impersonated
end

#impersonatorObject (readonly)

Returns the value of attribute impersonator.



5
6
7
# File 'app/models/mr_mime/impersonation_policy.rb', line 5

def impersonator
  @impersonator
end

Class Method Details

.allowed?(*args) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/models/mr_mime/impersonation_policy.rb', line 7

def self.allowed?(*args)
  new(*args).allowed?
end

Instance Method Details

#allowed?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'app/models/mr_mime/impersonation_policy.rb', line 16

def allowed?
  return true unless user_permission_check

  impersonator.public_send(user_permission_check)
end