summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorThiago Presa <tpresa@gitlab.com>2019-03-22 09:54:03 +0000
committerSean McGivern <sean@gitlab.com>2019-03-22 09:54:03 +0000
commit538741f2303f03e520d0bbfea150da6754f5a995 (patch)
treed7e04fc2f5e60ed94e7109eca6a574499e85b458 /app/models/user.rb
parente14b4b051ef4fda565b50b8d92644ab046dfcdbf (diff)
downloadgitlab-ce-538741f2303f03e520d0bbfea150da6754f5a995.tar.gz
Add highest_role method to User
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 0ebfb9a0ccb..d2be26370ff 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -917,6 +917,10 @@ class User < ApplicationRecord
DeployKey.unscoped.in_projects(authorized_projects.pluck(:id)).distinct(:id)
end
+ def highest_role
+ members.maximum(:access_level) || Gitlab::Access::NO_ACCESS
+ end
+
def accessible_deploy_keys
@accessible_deploy_keys ||= begin
key_ids = project_deploy_keys.pluck(:id)