diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 15:59:26 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 15:59:26 +0300 |
| commit | a442ad2b141e078fcc2899ece6068b82b5338bb8 (patch) | |
| tree | 8ce63530d1d3c30c0a6bb34fcba008431d7bacd2 | |
| parent | 7daf394732db2bc696938739cdb8f1bccd0a501f (diff) | |
| download | gitlab-ce-a442ad2b141e078fcc2899ece6068b82b5338bb8.tar.gz | |
Added Gitlab::Access module
| -rw-r--r-- | lib/gitlab/access.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb new file mode 100644 index 00000000000..fa273f3f50a --- /dev/null +++ b/lib/gitlab/access.rb @@ -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 |
