diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-05-25 23:47:46 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-05-25 23:47:46 +0300 |
commit | 74fb50041568e381513d2a9053d31a714797a0a8 (patch) | |
tree | 655cc4c6bb8db89a4d2423e25ed10759426bb4f9 /lib | |
parent | 380966e861a3c0cfc1d2884939c6677599690206 (diff) | |
parent | 5273335247660465a39ffdcb1c801807e84b3eba (diff) |
Merge branch 'issue_10725' into 'master'
Fix forks creation when visibility level is restricted
fixes #10725
See merge request !4283
Diffstat (limited to 'lib')
-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 |