diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-05-25 00:53:53 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-05-25 17:57:00 +0300 |
commit | 5273335247660465a39ffdcb1c801807e84b3eba (patch) | |
tree | 0eba37e98a775cdfccc6ba59ac3e8c86a9e1584b /lib/gitlab/visibility_level.rb | |
parent | 9a10205a4fdb79346f087318ec35110b17ba9153 (diff) |
Fix forks creation when visibility level is restricted
Diffstat (limited to 'lib/gitlab/visibility_level.rb')
-rw-r--r-- | lib/gitlab/visibility_level.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index a1ee1cba216..9462f3368e6 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -32,6 +32,13 @@ module Gitlab } end + def highest_allowed_level + restricted_levels = current_application_settings.restricted_visibility_levels + + allowed_levels = self.values - restricted_levels + allowed_levels.max || PRIVATE + end + def allowed_for?(user, level) user.is_admin? || allowed_level?(level.to_i) end |