BigW Consortium Gitlab

Commit fc287191 by Toon Claes

A VisibilityLevel also can be presented as string

For the API, the VisibilityLevel will be exposed as String instead of Integer. So add the string values and method to translate a level integer to a string.
parent 3b3f0fab
...@@ -35,6 +35,10 @@ module Gitlab ...@@ -35,6 +35,10 @@ module Gitlab
class << self class << self
delegate :values, to: :options delegate :values, to: :options
def string_values
string_options.keys
end
def options def options
{ {
'Private' => PRIVATE, 'Private' => PRIVATE,
...@@ -43,6 +47,14 @@ module Gitlab ...@@ -43,6 +47,14 @@ module Gitlab
} }
end end
def string_options
{
'private' => PRIVATE,
'internal' => INTERNAL,
'public' => PUBLIC
}
end
def highest_allowed_level def highest_allowed_level
restricted_levels = current_application_settings.restricted_visibility_levels restricted_levels = current_application_settings.restricted_visibility_levels
...@@ -82,6 +94,10 @@ module Gitlab ...@@ -82,6 +94,10 @@ module Gitlab
level_name level_name
end end
def string_level(level)
string_options.key(level)
end
end end
def private? def private?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment