diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-01-17 11:40:37 -0600 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-01-18 12:43:46 -0600 |
commit | 54994762ffd45e55cc9c000fbfb382382c69ad5d (patch) | |
tree | 1613e95fcae03b3ee8e4ad99be7b2bfefccd4023 /app/policies | |
parent | c46b8e968ba926745418738cb8855f0ca23b97cd (diff) | |
download | gitlab-ce-54994762ffd45e55cc9c000fbfb382382c69ad5d.tar.gz |
Backport of 54385-board-policy
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/board_policy.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/policies/board_policy.rb b/app/policies/board_policy.rb new file mode 100644 index 00000000000..46db008421f --- /dev/null +++ b/app/policies/board_policy.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class BoardPolicy < BasePolicy + delegate { @subject.parent } + + condition(:is_group_board) { @subject.group_board? } + + rule { is_group_board ? can?(:read_group) : can?(:read_project) }.enable :read_parent + + rule { is_group_board & can?(:read_group) }.policy do + enable :read_milestone + enable :read_issue + end +end |