summaryrefslogtreecommitdiff
path: root/lib/gitlab/access.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 /lib/gitlab/access.rb
parente14b4b051ef4fda565b50b8d92644ab046dfcdbf (diff)
downloadgitlab-ce-538741f2303f03e520d0bbfea150da6754f5a995.tar.gz
Add highest_role method to User
Diffstat (limited to 'lib/gitlab/access.rb')
-rw-r--r--lib/gitlab/access.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb
index ec090aea784..6c8ca8f219c 100644
--- a/lib/gitlab/access.rb
+++ b/lib/gitlab/access.rb
@@ -46,6 +46,12 @@ module Gitlab
)
end
+ def options_with_none
+ options_with_owner.merge(
+ "None" => NO_ACCESS
+ )
+ end
+
def sym_options
{
guest: GUEST,
@@ -75,12 +81,20 @@ module Gitlab
def human_access(access)
options_with_owner.key(access)
end
+
+ def human_access_with_none(access)
+ options_with_none.key(access)
+ end
end
def human_access
Gitlab::Access.human_access(access_field)
end
+ def human_access_with_none
+ Gitlab::Access.human_access_with_none(access_field)
+ end
+
def owner?
access_field == OWNER
end