Class: UffizziCore::User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- UffizziCore::User
- Extended by:
- Enumerize
- Includes:
- AASM, ActiveModel::Validations, HashidConcern, StateMachineConcern, UserRepo
- Defined in:
- app/models/uffizzi_core/user.rb
Instance Method Summary collapse
- #active_projects ⇒ Object
- #admin_access_to_project?(project) ⇒ Boolean
- #deployments ⇒ Object
- #full_name ⇒ Object
- #organizational_account ⇒ Object
Methods included from HashidConcern
Instance Method Details
#active_projects ⇒ Object
33 34 35 |
# File 'app/models/uffizzi_core/user.rb', line 33 def active_projects projects.active end |
#admin_access_to_project?(project) ⇒ Boolean
59 60 61 |
# File 'app/models/uffizzi_core/user.rb', line 59 def admin_access_to_project?(project) projects.by_ids(project).by_accounts(memberships.by_role_admin.select(:account_id)).exists? end |
#deployments ⇒ Object
37 38 39 |
# File 'app/models/uffizzi_core/user.rb', line 37 def deployments UffizziCore::Deployment.where(project_id: active_projects) end |
#full_name ⇒ Object
41 42 43 |
# File 'app/models/uffizzi_core/user.rb', line 41 def full_name "#{first_name} #{last_name}" end |
#organizational_account ⇒ Object
29 30 31 |
# File 'app/models/uffizzi_core/user.rb', line 29 def organizational_account accounts.find_by(kind: UffizziCore::Account.kind.organizational) end |