Class: Eco::API::Policies::DefaultPolicies::UserAccess
- Inherits:
-
Common::Loaders::Policy
- Object
- Common::Loaders::Base
- Common::Loaders::CaseBase
- Common::Loaders::Policy
- Eco::API::Policies::DefaultPolicies::UserAccess
- Defined in:
- lib/eco/api/policies/default_policies/99_user_access_policy.rb
Overview
Default policy:
- Removes the account if the email is empty
- Adds the defined default_usergroup if user does not have policy groups
- Adds the defined default_login_method if update includes empty login methods
Instance Attribute Summary collapse
-
#account_removed_count ⇒ Object
Returns the value of attribute account_removed_count.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Attributes included from Language::AuxiliarLogger
Instance Method Summary collapse
Methods inherited from Common::Loaders::Policy
Methods inherited from Common::Loaders::CaseBase
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
Constructor Details
This class inherits a constructor from Eco::API::Common::Loaders::Policy
Instance Attribute Details
#account_removed_count ⇒ Object
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 @account_removed_count end |
#job ⇒ Object (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 |
#options ⇒ Object (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 end |
#session ⇒ Object (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, , policy, job) @session = session; @options = ; @job = job self.account_removed_count = 0 people.each do |person| remove_account_when_no_email!(person) if person.email.to_s.empty? next unless account = person.account next if .dig(:exclude, :account) if account.policy_group_ids.empty? && def_pg account.policy_group_ids = [def_pg] end add_login_method_if_applicable!(account) end warn_account_removal! end |