Class: Crm::OrganizationsFinder
- Inherits:
-
Object
- Object
- Crm::OrganizationsFinder
- Includes:
- Gitlab::Allowable, Gitlab::Utils::StrongMemoize
- Defined in:
- app/finders/crm/organizations_finder.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, params = {}) ⇒ OrganizationsFinder
constructor
A new instance of OrganizationsFinder.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(current_user, params = {}) ⇒ OrganizationsFinder
Returns a new instance of OrganizationsFinder.
24 25 26 27 |
# File 'app/finders/crm/organizations_finder.rb', line 24 def initialize(current_user, params = {}) @current_user = current_user @params = params end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
17 18 19 |
# File 'app/finders/crm/organizations_finder.rb', line 17 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
17 18 19 |
# File 'app/finders/crm/organizations_finder.rb', line 17 def params @params end |
Class Method Details
.counts_by_state(current_user, params = {}) ⇒ Object
19 20 21 22 |
# File 'app/finders/crm/organizations_finder.rb', line 19 def self.counts_by_state(current_user, params = {}) params = params.merge(sort: nil) new(current_user, params).execute.counts_by_state end |
Instance Method Details
#execute ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/finders/crm/organizations_finder.rb', line 29 def execute return CustomerRelations::Organization.none unless root_group crm_organizations = root_group.crm_organizations crm_organizations = by_ids(crm_organizations) crm_organizations = by_search(crm_organizations) crm_organizations = by_state(crm_organizations) sort_crm_organizations(crm_organizations) end |