Class: UsersFinder
- Inherits:
-
Object
- Object
- UsersFinder
- Includes:
- CreatedAtFilter, CustomAttributesFilter
- Defined in:
- app/finders/users_finder.rb
Overview
UsersFinder
Used to filter users by set of params
Arguments:
current_user - which user use
params:
username: string
extern_uid: string
provider: string
search: string
active: boolean
blocked: boolean
external: boolean
non_external: boolean
without_projects: boolean
sort: string
id: integer
non_internal: boolean
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, params = {}) ⇒ UsersFinder
constructor
A new instance of UsersFinder.
Methods included from CustomAttributesFilter
Methods included from CreatedAtFilter
Constructor Details
#initialize(current_user, params = {}) ⇒ UsersFinder
Returns a new instance of UsersFinder.
29 30 31 32 |
# File 'app/finders/users_finder.rb', line 29 def initialize(current_user, params = {}) @current_user = current_user @params = params end |
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
27 28 29 |
# File 'app/finders/users_finder.rb', line 27 def current_user @current_user end |
#params ⇒ Object
Returns the value of attribute params.
27 28 29 |
# File 'app/finders/users_finder.rb', line 27 def params @params end |
Instance Method Details
#execute ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/finders/users_finder.rb', line 34 def execute users = base_scope users = by_username(users) users = by_id(users) users = by_admins(users) users = by_search(users) users = by_blocked(users) users = by_active(users) users = by_external_identity(users) users = by_external(users) users = by_non_external(users) users = by_2fa(users) users = by_created_at(users) users = by_without_projects(users) users = by_custom_attributes(users) users = by_non_internal(users) users = by_without_project_bots(users) order(users) end |