diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-09-13 17:32:58 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-09-18 17:15:38 -0300 |
commit | 5bfb6357ef4af408401f68a388ab4a1521af8903 (patch) | |
tree | cc2d508564890ad22735f627dc46207787918130 | |
parent | f06d370b20ffbb7b8dba83b841df053b39cf3b1a (diff) | |
download | gitlab-ce-issue_32215.tar.gz |
Allow DEVELOPER role to admin milestonesissue_32215
-rw-r--r-- | app/policies/group_policy.rb | 3 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/issue_32215.yml | 5 | ||||
-rw-r--r-- | spec/policies/group_policy_spec.rb | 18 | ||||
-rw-r--r-- | spec/policies/project_policy_spec.rb | 4 |
5 files changed, 26 insertions, 6 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb index 420991ff6d6..8af9738d75c 100644 --- a/app/policies/group_policy.rb +++ b/app/policies/group_policy.rb @@ -9,6 +9,7 @@ class GroupPolicy < BasePolicy condition(:has_access) { access_level != GroupMember::NO_ACCESS } condition(:guest) { access_level >= GroupMember::GUEST } + condition(:developer) { access_level >= GroupMember::DEVELOPER } condition(:owner) { access_level >= GroupMember::OWNER } condition(:master) { access_level >= GroupMember::MASTER } condition(:reporter) { access_level >= GroupMember::REPORTER } @@ -33,11 +34,11 @@ class GroupPolicy < BasePolicy rule { admin } .enable :read_group rule { has_projects } .enable :read_group + rule { developer }.enable :admin_milestones rule { reporter }.enable :admin_label rule { master }.policy do enable :create_projects - enable :admin_milestones enable :admin_pipeline enable :admin_build end diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index a925fac7d3e..b7b5bd34189 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -155,6 +155,7 @@ class ProjectPolicy < BasePolicy rule { can?(:developer_access) }.policy do enable :admin_merge_request + enable :admin_milestone enable :update_merge_request enable :create_commit_status enable :update_commit_status @@ -178,7 +179,6 @@ class ProjectPolicy < BasePolicy enable :update_project_snippet enable :update_environment enable :update_deployment - enable :admin_milestone enable :admin_project_snippet enable :admin_project_member enable :admin_note diff --git a/changelogs/unreleased/issue_32215.yml b/changelogs/unreleased/issue_32215.yml new file mode 100644 index 00000000000..c608eb6dd28 --- /dev/null +++ b/changelogs/unreleased/issue_32215.yml @@ -0,0 +1,5 @@ +--- +title: Allow developer role to admin milestones +merge_request: +author: +type: changed diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb index b186a78e44a..17dc3bb4f48 100644 --- a/spec/policies/group_policy_spec.rb +++ b/spec/policies/group_policy_spec.rb @@ -11,10 +11,11 @@ describe GroupPolicy do let(:reporter_permissions) { [:admin_label] } + let(:developer_permissions) { [:admin_milestones] } + let(:master_permissions) do [ - :create_projects, - :admin_milestones + :create_projects ] end @@ -52,6 +53,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_disallowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -63,6 +65,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_disallowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -74,6 +77,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -85,6 +89,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -96,6 +101,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_allowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -109,6 +115,7 @@ describe GroupPolicy do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_allowed(*master_permissions) expect_allowed(*owner_permissions) end @@ -122,6 +129,7 @@ describe GroupPolicy do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_allowed(*master_permissions) expect_allowed(*owner_permissions) end @@ -180,6 +188,7 @@ describe GroupPolicy do it do expect_disallowed(:read_group) expect_disallowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -191,6 +200,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_disallowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -202,6 +212,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_disallowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -213,6 +224,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_disallowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -224,6 +236,7 @@ describe GroupPolicy do it do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_allowed(*master_permissions) expect_disallowed(*owner_permissions) end @@ -237,6 +250,7 @@ describe GroupPolicy do expect_allowed(:read_group) expect_allowed(*reporter_permissions) + expect_allowed(*developer_permissions) expect_allowed(*master_permissions) expect_allowed(*owner_permissions) end diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb index 4dbaf7fb025..c0cbdeed03d 100644 --- a/spec/policies/project_policy_spec.rb +++ b/spec/policies/project_policy_spec.rb @@ -33,7 +33,7 @@ describe ProjectPolicy do let(:developer_permissions) do %i[ - admin_merge_request update_merge_request create_commit_status + admin_milestone admin_merge_request update_merge_request create_commit_status update_commit_status create_build update_build create_pipeline update_pipeline create_merge_request create_wiki push_code resolve_note create_container_image update_container_image @@ -44,7 +44,7 @@ describe ProjectPolicy do let(:master_permissions) do %i[ delete_protected_branch update_project_snippet update_environment - update_deployment admin_milestone admin_project_snippet + update_deployment admin_project_snippet admin_project_member admin_note admin_wiki admin_project admin_commit_status admin_build admin_container_image admin_pipeline admin_environment admin_deployment |