diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-04 05:37:22 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-04 05:38:58 +0300 |
commit | 07d7d8e65905a39164b63f55eccdcea8f10f5d14 (patch) | |
tree | 4fc627e0256a787ab80f4483b3d6e2442c26a619 /app/models/protected_tag/create_access_level.rb | |
parent | f9e849c076efb3162a3d951d8aae2e7be3e574f4 (diff) |
Renamed ProtectedTag push_access_levels to create_access_levels
Diffstat (limited to 'app/models/protected_tag/create_access_level.rb')
-rw-r--r-- | app/models/protected_tag/create_access_level.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/models/protected_tag/create_access_level.rb b/app/models/protected_tag/create_access_level.rb new file mode 100644 index 00000000000..c7e1319719d --- /dev/null +++ b/app/models/protected_tag/create_access_level.rb @@ -0,0 +1,21 @@ +class ProtectedTag::CreateAccessLevel < ActiveRecord::Base + include ProtectedTagAccess + + validates :access_level, presence: true, inclusion: { in: [Gitlab::Access::MASTER, + Gitlab::Access::DEVELOPER, + Gitlab::Access::NO_ACCESS] } + + def self.human_access_levels + { + Gitlab::Access::MASTER => "Masters", + Gitlab::Access::DEVELOPER => "Developers + Masters", + Gitlab::Access::NO_ACCESS => "No one" + }.with_indifferent_access + end + + def check_access(user) + return false if access_level == Gitlab::Access::NO_ACCESS + + super + end +end |