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
admins: boolean
blocked: boolean
humans: boolean
external: boolean
non_external: boolean
without_active: boolean
without_humans: boolean
without_projects: boolean
sort: string
id: integer
non_internal: boolean
Direct Known Subclasses
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.
33 34 35 36 |
# File 'app/finders/users_finder.rb', line 33 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.
31 32 33 |
# File 'app/finders/users_finder.rb', line 31 def current_user @current_user end |
#params ⇒ Object
Returns the value of attribute params.
31 32 33 |
# File 'app/finders/users_finder.rb', line 31 def params @params end |
Instance Method Details
#execute ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/finders/users_finder.rb', line 38 def execute users = base_scope users = by_username(users) users = by_id(users) users = by_admins(users) users = by_humans(users) users = by_without_humans(users) users = by_search(users) users = by_blocked(users) users = by_active(users) users = by_without_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) users = by_member_source_ids(users) users = by_public_email(users) users = by_user_types(users) order(users) end |