Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorThiago Presa <tpresa@gitlab.com>2019-03-22 12:54:03 +0300
committerSean McGivern <sean@gitlab.com>2019-03-22 12:54:03 +0300
commit538741f2303f03e520d0bbfea150da6754f5a995 (patch)
treed7e04fc2f5e60ed94e7109eca6a574499e85b458 /app
parente14b4b051ef4fda565b50b8d92644ab046dfcdbf (diff)
Add highest_role method to User
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb4
-rw-r--r--app/views/admin/users/show.html.haml5
2 files changed, 9 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)
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index a74e052707f..4ffa8d89504 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -117,6 +117,11 @@
%strong
= @user.sign_in_count
+ %li
+ %span.light= _("Highest role:")
+ %strong
+ = Gitlab::Access.human_access_with_none(@user.highest_role)
+
- if @user.ldap_user?
%li
%span.light LDAP uid: