Added Gitlab::Access module
This commit is contained in:
parent
7daf394732
commit
a442ad2b14
1 changed files with 48 additions and 0 deletions
48
lib/gitlab/access.rb
Normal file
48
lib/gitlab/access.rb
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Gitlab::Access module
|
||||
#
|
||||
# Define allowed roles that can be used
|
||||
# in GitLab code to determine authorization level
|
||||
#
|
||||
module Gitlab
|
||||
module Access
|
||||
GUEST = 10
|
||||
REPORTER = 20
|
||||
DEVELOPER = 30
|
||||
MASTER = 40
|
||||
OWNER = 50
|
||||
|
||||
class << self
|
||||
def values
|
||||
options.values
|
||||
end
|
||||
|
||||
def options
|
||||
{
|
||||
"Guest" => GUEST,
|
||||
"Reporter" => REPORTER,
|
||||
"Developer" => DEVELOPER,
|
||||
"Master" => MASTER,
|
||||
}
|
||||
end
|
||||
|
||||
def options_with_owner
|
||||
options.merge(
|
||||
"Owner" => OWNER
|
||||
)
|
||||
end
|
||||
|
||||
def sym_options
|
||||
{
|
||||
guest: GUEST,
|
||||
reporter: REPORTER,
|
||||
developer: DEVELOPER,
|
||||
master: MASTER,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def human_access
|
||||
Gitlab::Access.options_with_owner.key(access_field)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue