Class: Eco::API::Policies::DefaultPolicies::UserAccess

Inherits:
Common::Loaders::Policy show all
Defined in:
lib/eco/api/policies/default_policies/99_user_access_policy.rb

Overview

Default policy:

  1. Removes the account if the email is empty
  2. Adds the defined default_usergroup if user does not have policy groups
  3. Adds the defined default_login_method if update includes empty login methods

Instance Attribute Summary collapse

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods inherited from Common::Loaders::Policy

#initialize

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!

Methods inherited from Common::Loaders::Base

<=>, created_at, #initialize, set_created_at!

Methods included from Common::ClassHelpers

#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant

Methods included from Language::AuxiliarLogger

#log

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::Policy

Instance Attribute Details

#account_removed_countObject

Returns the value of attribute account_removed_count.



9
10
11
# File 'lib/eco/api/policies/default_policies/99_user_access_policy.rb', line 9

def 
  @account_removed_count
end

#jobObject (readonly)

Returns the value of attribute job.



8
9
10
# File 'lib/eco/api/policies/default_policies/99_user_access_policy.rb', line 8

def job
  @job
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/eco/api/policies/default_policies/99_user_access_policy.rb', line 8

def options
  @options
end

#sessionObject (readonly)

Returns the value of attribute session.



8
9
10
# File 'lib/eco/api/policies/default_policies/99_user_access_policy.rb', line 8

def session
  @session
end

Instance Method Details

#main(people, session, options, policy, job) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/eco/api/policies/default_policies/99_user_access_policy.rb', line 11

def main(people, session, options, policy, job)
  @session = session; @options = options; @job = job

  self. = 0

  people.each do |person|
    (person) if person.email.to_s.empty?
    next unless  = person.
    next if options.dig(:exclude, :account)
    if .policy_group_ids.empty? && def_pg
      .policy_group_ids = [def_pg]
    end
    ()
  end

  
end