Class: UffizziCore::User

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Enumerize
Includes:
AASM, ActiveModel::Validations, HashidConcern, StateMachineConcern, UserRepo
Defined in:
app/models/uffizzi_core/user.rb

Instance Method Summary collapse

Methods included from HashidConcern

#hashid

Instance Method Details

#active_projectsObject



33
34
35
# File 'app/models/uffizzi_core/user.rb', line 33

def active_projects
  projects.active
end

#admin_access_to_project?(project) ⇒ Boolean

Returns:

  • (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

#deploymentsObject



37
38
39
# File 'app/models/uffizzi_core/user.rb', line 37

def deployments
  UffizziCore::Deployment.where(project_id: active_projects)
end

#full_nameObject



41
42
43
# File 'app/models/uffizzi_core/user.rb', line 41

def full_name
  "#{first_name} #{last_name}"
end

#organizational_accountObject



29
30
31
# File 'app/models/uffizzi_core/user.rb', line 29

def 
  accounts.find_by(kind: UffizziCore::Account.kind.organizational)
end