Commit 63e8820c authored by charlie ablett's avatar charlie ablett

Merge branch 'remove-plan-id-from-group-changes-auditor' into 'master'

Remove plan_id from GroupChangesAuditor

See merge request gitlab-org/gitlab!28888
parents f992a23d 0e7ee444
......@@ -7,11 +7,10 @@ module EE
request_access_enabled membership_lock lfs_enabled
shared_runners_minutes_limit
require_two_factor_authentication
two_factor_grace_period plan_id
two_factor_grace_period
project_creation_level).freeze
COLUMN_HUMAN_NAME = {
plan_id: 'plan',
visibility_level: 'visibility'
}.freeze
......@@ -36,11 +35,6 @@ module EE
from: ::Gitlab::Access.project_creation_level_name(old),
to: ::Gitlab::Access.project_creation_level_name(new)
}
when :plan_id
{
from: plan_name(old),
to: plan_name(new)
}
else
{
from: old,
......@@ -51,12 +45,6 @@ module EE
private
def plan_name(plan_id)
return 'none' unless plan_id.present?
Plan.find_by_id(plan_id.to_i)&.name || 'unknown'
end
def column_human_name(column)
COLUMN_HUMAN_NAME.fetch(column, column.to_s)
end
......
......@@ -39,19 +39,6 @@ describe EE::Audit::GroupChangesAuditor do
expect(event.details[:change]).to eq 'project_creation_level'
end
it 'creates an event when the group plan changes' do
new_plan = create(:free_plan, name: 'plan-1')
group.update!(plan_id: new_plan.id)
expect { foo_instance.execute }.to change { SecurityEvent.count }.by(1)
event = SecurityEvent.last
expect(event.details[:from]).to eq 'none'
expect(event.details[:to]).to eq 'plan-1'
expect(event.details[:change]).to eq 'plan'
end
it 'creates an event when attributes change' do
# Exclude special cases covered from above
columns = described_class::COLUMNS - described_class::COLUMN_HUMAN_NAME.keys - [:project_creation_level]
......
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