Commit 1dcad68e authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch...

Merge branch '337730-remove-feature-flag-specialized_service_for_project_member_auth_refresh' into 'master'

Use specialized worker/service to refresh authorizations of project members by default

See merge request gitlab-org/gitlab!73337
parents 8a8789c6 f28aeac8
......@@ -94,7 +94,6 @@ class ProjectMember < Member
override :refresh_member_authorized_projects
def refresh_member_authorized_projects(blocking:)
return super unless Feature.enabled?(:specialized_service_for_project_member_auth_refresh)
return unless user
# rubocop:disable CodeReuse/ServiceClass
......
---
name: specialized_service_for_project_member_auth_refresh
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67477
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337730
milestone: '14.2'
type: development
group: group::access
default_enabled: false
......@@ -256,59 +256,5 @@ RSpec.describe ProjectMember do
it_behaves_like 'calls AuthorizedProjectUpdate::UserRefreshFromReplicaWorker with a delay to update project authorizations'
end
context 'when the feature flag `specialized_service_for_project_member_auth_refresh` is disabled' do
before do
stub_feature_flags(specialized_service_for_project_member_auth_refresh: false)
end
shared_examples_for 'calls UserProjectAccessChangedService to recalculate authorizations' do
it 'calls UserProjectAccessChangedService' do
expect_next_instance_of(UserProjectAccessChangedService, user.id) do |service|
expect(service).to receive(:execute)
end
action
end
end
context 'on create' do
let(:action) { project.add_user(user, Gitlab::Access::GUEST) }
it 'changes access level' do
expect { action }.to change { user.can?(:guest_access, project) }.from(false).to(true)
end
it_behaves_like 'calls UserProjectAccessChangedService to recalculate authorizations'
end
context 'on update' do
let(:action) { project.members.find_by(user: user).update!(access_level: Gitlab::Access::DEVELOPER) }
before do
project.add_user(user, Gitlab::Access::GUEST)
end
it 'changes access level' do
expect { action }.to change { user.can?(:developer_access, project) }.from(false).to(true)
end
it_behaves_like 'calls UserProjectAccessChangedService to recalculate authorizations'
end
context 'on destroy' do
let(:action) { project.members.find_by(user: user).destroy! }
before do
project.add_user(user, Gitlab::Access::GUEST)
end
it 'changes access level', :sidekiq_inline do
expect { action }.to change { user.can?(:guest_access, project) }.from(true).to(false)
end
it_behaves_like 'calls UserProjectAccessChangedService to recalculate authorizations'
end
end
end
end
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