Commit 6182eecf authored by dcouture's avatar dcouture Committed by Douglas Barbosa Alexandre

Adjust update_runners_registration_token permission

The permissions for the registration token
weren't consistent with every other permissions
related to the runner. It's now required to be
a group owner instead of maintainer.

Changelog: changed
parent d59ee459
...@@ -163,7 +163,6 @@ class GroupPolicy < BasePolicy ...@@ -163,7 +163,6 @@ class GroupPolicy < BasePolicy
enable :admin_cluster enable :admin_cluster
enable :read_deploy_token enable :read_deploy_token
enable :create_jira_connect_subscription enable :create_jira_connect_subscription
enable :update_runners_registration_token
enable :maintainer_access enable :maintainer_access
end end
...@@ -180,6 +179,7 @@ class GroupPolicy < BasePolicy ...@@ -180,6 +179,7 @@ class GroupPolicy < BasePolicy
enable :update_default_branch_protection enable :update_default_branch_protection
enable :create_deploy_token enable :create_deploy_token
enable :destroy_deploy_token enable :destroy_deploy_token
enable :update_runners_registration_token
enable :owner_access enable :owner_access
end end
......
...@@ -1005,7 +1005,7 @@ RSpec.describe GroupPolicy do ...@@ -1005,7 +1005,7 @@ RSpec.describe GroupPolicy do
context 'with maintainer' do context 'with maintainer' do
let(:current_user) { maintainer } let(:current_user) { maintainer }
it { is_expected.to be_allowed(:update_runners_registration_token) } it { is_expected.to be_disallowed(:update_runners_registration_token) }
end end
context 'with reporter' do context 'with reporter' do
......
...@@ -118,7 +118,7 @@ RSpec.describe API::Ci::Runners do ...@@ -118,7 +118,7 @@ RSpec.describe API::Ci::Runners do
end end
include_context 'when authorized', 'group' do include_context 'when authorized', 'group' do
let_it_be(:user) { create_default(:group_member, :maintainer, user: create(:user), group: group ).user } let_it_be(:user) { create_default(:group_member, :owner, user: create(:user), group: group ).user }
def get_token def get_token
group.reload.runners_token group.reload.runners_token
......
...@@ -89,7 +89,7 @@ RSpec.describe 'RunnersRegistrationTokenReset' do ...@@ -89,7 +89,7 @@ RSpec.describe 'RunnersRegistrationTokenReset' do
end end
include_context 'when authorized', 'group' do include_context 'when authorized', 'group' do
let_it_be(:user) { create_default(:group_member, :maintainer, user: create(:user), group: group ).user } let_it_be(:user) { create_default(:group_member, :owner, user: create(:user), group: group ).user }
def get_token def get_token
group.reload.runners_token group.reload.runners_token
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment