Commit 1cc2b765 authored by Mark Chao's avatar Mark Chao

Remove references to deprecated Master role

Remove method and constant aliasing
parent 27ad9c73
...@@ -19,7 +19,6 @@ module ProtectedRefAccess ...@@ -19,7 +19,6 @@ module ProtectedRefAccess
end end
included do included do
scope :master, -> { maintainer } # @deprecated
scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) } scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) }
scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) } scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) }
scope :by_user, -> (user) { where(user_id: user ) } scope :by_user, -> (user) { where(user_id: user ) }
......
...@@ -11,8 +11,5 @@ module SelectForProjectAuthorization ...@@ -11,8 +11,5 @@ module SelectForProjectAuthorization
def select_as_maintainer_for_project_authorization def select_as_maintainer_for_project_authorization
select(["projects.id AS project_id", "#{Gitlab::Access::MAINTAINER} AS access_level"]) select(["projects.id AS project_id", "#{Gitlab::Access::MAINTAINER} AS access_level"])
end end
# @deprecated
alias_method :select_as_master_for_project_authorization, :select_as_maintainer_for_project_authorization
end end
end end
...@@ -245,9 +245,6 @@ class Group < Namespace ...@@ -245,9 +245,6 @@ class Group < Namespace
add_user(user, :maintainer, current_user: current_user) add_user(user, :maintainer, current_user: current_user)
end end
# @deprecated
alias_method :add_master, :add_maintainer
def add_owner(user, current_user = nil) def add_owner(user, current_user = nil)
add_user(user, :owner, current_user: current_user) add_user(user, :owner, current_user: current_user)
end end
...@@ -274,9 +271,6 @@ class Group < Namespace ...@@ -274,9 +271,6 @@ class Group < Namespace
::ContainerRepository.for_group_and_its_subgroups(self).exists? ::ContainerRepository.for_group_and_its_subgroups(self).exists?
end end
# @deprecated
alias_method :has_master?, :has_maintainer?
# Check if user is a last owner of the group. # Check if user is a last owner of the group.
def last_owner?(user) def last_owner?(user)
has_owner?(user) && members_with_parents.owners.size == 1 has_owner?(user) && members_with_parents.owners.size == 1
......
...@@ -76,10 +76,8 @@ class Member < ApplicationRecord ...@@ -76,10 +76,8 @@ class Member < ApplicationRecord
scope :developers, -> { active.where(access_level: DEVELOPER) } scope :developers, -> { active.where(access_level: DEVELOPER) }
scope :maintainers, -> { active.where(access_level: MAINTAINER) } scope :maintainers, -> { active.where(access_level: MAINTAINER) }
scope :non_guests, -> { where('members.access_level > ?', GUEST) } scope :non_guests, -> { where('members.access_level > ?', GUEST) }
scope :masters, -> { maintainers } # @deprecated scope :owners, -> { active.where(access_level: OWNER) }
scope :owners, -> { active.where(access_level: OWNER) }
scope :owners_and_maintainers, -> { active.where(access_level: [OWNER, MAINTAINER]) } scope :owners_and_maintainers, -> { active.where(access_level: [OWNER, MAINTAINER]) }
scope :owners_and_masters, -> { owners_and_maintainers } # @deprecated
scope :with_user, -> (user) { where(user: user) } scope :with_user, -> (user) { where(user: user) }
scope :with_source_id, ->(source_id) { where(source_id: source_id) } scope :with_source_id, ->(source_id) { where(source_id: source_id) }
......
...@@ -349,7 +349,6 @@ class Project < ApplicationRecord ...@@ -349,7 +349,6 @@ class Project < ApplicationRecord
delegate :members, to: :team, prefix: true delegate :members, to: :team, prefix: true
delegate :add_user, :add_users, to: :team delegate :add_user, :add_users, to: :team
delegate :add_guest, :add_reporter, :add_developer, :add_maintainer, :add_role, to: :team delegate :add_guest, :add_reporter, :add_developer, :add_maintainer, :add_role, to: :team
delegate :add_master, to: :team # @deprecated
delegate :group_runners_enabled, :group_runners_enabled=, :group_runners_enabled?, to: :ci_cd_settings delegate :group_runners_enabled, :group_runners_enabled=, :group_runners_enabled?, to: :ci_cd_settings
delegate :root_ancestor, to: :namespace, allow_nil: true delegate :root_ancestor, to: :namespace, allow_nil: true
delegate :last_pipeline, to: :commit, allow_nil: true delegate :last_pipeline, to: :commit, allow_nil: true
......
...@@ -7,7 +7,6 @@ class ProjectGroupLink < ApplicationRecord ...@@ -7,7 +7,6 @@ class ProjectGroupLink < ApplicationRecord
REPORTER = 20 REPORTER = 20
DEVELOPER = 30 DEVELOPER = 30
MAINTAINER = 40 MAINTAINER = 40
MASTER = MAINTAINER # @deprecated
belongs_to :project belongs_to :project
belongs_to :group belongs_to :group
......
...@@ -25,9 +25,6 @@ class ProjectTeam ...@@ -25,9 +25,6 @@ class ProjectTeam
add_user(user, :maintainer, current_user: current_user) add_user(user, :maintainer, current_user: current_user)
end end
# @deprecated
alias_method :add_master, :add_maintainer
def add_role(user, role, current_user: nil) def add_role(user, role, current_user: nil)
public_send(:"add_#{role}", user, current_user: current_user) # rubocop:disable GitlabSecurity/PublicSend public_send(:"add_#{role}", user, current_user: current_user) # rubocop:disable GitlabSecurity/PublicSend
end end
...@@ -98,9 +95,6 @@ class ProjectTeam ...@@ -98,9 +95,6 @@ class ProjectTeam
@maintainers ||= fetch_members(Gitlab::Access::MAINTAINER) @maintainers ||= fetch_members(Gitlab::Access::MAINTAINER)
end end
# @deprecated
alias_method :masters, :maintainers
def owners def owners
@owners ||= @owners ||=
if group if group
...@@ -156,9 +150,6 @@ class ProjectTeam ...@@ -156,9 +150,6 @@ class ProjectTeam
max_member_access(user.id) == Gitlab::Access::MAINTAINER max_member_access(user.id) == Gitlab::Access::MAINTAINER
end end
# @deprecated
alias_method :master?, :maintainer?
# Checks if `user` is authorized for this project, with at least the # Checks if `user` is authorized for this project, with at least the
# `min_access_level` (if given). # `min_access_level` (if given).
def member?(user, min_access_level = Gitlab::Access::GUEST) def member?(user, min_access_level = Gitlab::Access::GUEST)
......
...@@ -1693,9 +1693,6 @@ class User < ApplicationRecord ...@@ -1693,9 +1693,6 @@ class User < ApplicationRecord
end end
end end
# @deprecated
alias_method :owned_or_masters_groups, :owned_or_maintainers_groups
protected protected
# override, from Devise::Validatable # override, from Devise::Validatable
......
...@@ -15,7 +15,7 @@ describe 'PackageFiles' do ...@@ -15,7 +15,7 @@ describe 'PackageFiles' do
context 'user with master role' do context 'user with master role' do
before do before do
project.add_master(user) project.add_maintainer(user)
end end
it 'allows direct download by url' do it 'allows direct download by url' do
......
...@@ -8,7 +8,7 @@ describe 'Packages' do ...@@ -8,7 +8,7 @@ describe 'Packages' do
before do before do
sign_in(user) sign_in(user)
project.add_master(user) project.add_maintainer(user)
stub_licensed_features(packages: true) stub_licensed_features(packages: true)
end end
......
...@@ -83,7 +83,7 @@ describe Burndown do ...@@ -83,7 +83,7 @@ describe Burndown do
new_milestone = create(:milestone) new_milestone = create(:milestone)
burndown = described_class.new(new_milestone.issues_visible_to_user(user), new_milestone.start_date, new_milestone.due_date) burndown = described_class.new(new_milestone.issues_visible_to_user(user), new_milestone.start_date, new_milestone.due_date)
new_milestone.project.add_master(user) new_milestone.project.add_maintainer(user)
expect(burndown).to be_accurate expect(burndown).to be_accurate
end end
...@@ -237,7 +237,7 @@ describe Burndown do ...@@ -237,7 +237,7 @@ describe Burndown do
end end
def build_sample(milestone, issue_params) def build_sample(milestone, issue_params)
project.add_master(user) project.add_maintainer(user)
issues = [] issues = []
confidential_issues = [] confidential_issues = []
......
...@@ -19,13 +19,13 @@ describe ProtectedBranch do ...@@ -19,13 +19,13 @@ describe ProtectedBranch do
first_protected_branch = create(:protected_branch, default_access_level: false) first_protected_branch = create(:protected_branch, default_access_level: false)
second_protected_branch = create(:protected_branch, default_access_level: false) second_protected_branch = create(:protected_branch, default_access_level: false)
first_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) first_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
second_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) second_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
expect(first_protected_branch).to be_valid expect(first_protected_branch).to be_valid
expect(second_protected_branch).to be_valid expect(second_protected_branch).to be_valid
first_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) first_protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
expect(first_protected_branch).to be_invalid expect(first_protected_branch).to be_invalid
expect(first_protected_branch.errors.full_messages.first).to match("access level has already been taken") expect(first_protected_branch.errors.full_messages.first).to match("access level has already been taken")
end end
...@@ -34,8 +34,8 @@ describe ProtectedBranch do ...@@ -34,8 +34,8 @@ describe ProtectedBranch do
protected_branch = create(:protected_branch, default_access_level: false) protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.add_developer(user) protected_branch.project.add_developer(user)
protected_branch.send(association_name) << build(factory_name, user: user, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, user: user, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
expect(protected_branch).to be_valid expect(protected_branch).to be_valid
end end
...@@ -45,8 +45,8 @@ describe ProtectedBranch do ...@@ -45,8 +45,8 @@ describe ProtectedBranch do
protected_branch = create(:protected_branch, default_access_level: false) protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.project_group_links.create(group: group) protected_branch.project.project_group_links.create(group: group)
protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
expect(protected_branch).to be_valid expect(protected_branch).to be_valid
end end
...@@ -75,8 +75,8 @@ describe ProtectedBranch do ...@@ -75,8 +75,8 @@ describe ProtectedBranch do
protected_branch = create(:protected_branch, default_access_level: false) protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.add_developer(user) protected_branch.project.add_developer(user)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, user: user, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, user: user, access_level: Gitlab::Access::MAINTAINER)
expect(protected_branch).to be_valid expect(protected_branch).to be_valid
end end
...@@ -107,8 +107,8 @@ describe ProtectedBranch do ...@@ -107,8 +107,8 @@ describe ProtectedBranch do
protected_branch = create(:protected_branch, default_access_level: false) protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.project_group_links.create(group: group) protected_branch.project.project_group_links.create(group: group)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MASTER) protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MAINTAINER)
expect(protected_branch).to be_valid expect(protected_branch).to be_valid
end end
......
...@@ -12,7 +12,7 @@ describe PrometheusAlertEntity do ...@@ -12,7 +12,7 @@ describe PrometheusAlertEntity do
context 'when user can read prometheus alerts' do context 'when user can read prometheus alerts' do
before do before do
prometheus_alert.project.add_master(user) prometheus_alert.project.add_maintainer(user)
stub_licensed_features(prometheus_alerts: true) stub_licensed_features(prometheus_alerts: true)
end end
......
...@@ -79,7 +79,7 @@ describe MergeRequests::RefreshService do ...@@ -79,7 +79,7 @@ describe MergeRequests::RefreshService do
allow(service).to receive(:todo_service).and_return(todo_service) allow(service).to receive(:todo_service).and_return(todo_service)
allow(service).to receive(:notification_service).and_return(notification_service) allow(service).to receive(:notification_service).and_return(notification_service)
group.add_master(fork_user) group.add_maintainer(fork_user)
merge_request merge_request
another_merge_request another_merge_request
......
...@@ -11,7 +11,7 @@ describe Epics::CloseService do ...@@ -11,7 +11,7 @@ describe Epics::CloseService do
context 'when epics are disabled' do context 'when epics are disabled' do
before do before do
group.add_master(user) group.add_maintainer(user)
end end
it 'does not close the epic' do it 'does not close the epic' do
...@@ -26,7 +26,7 @@ describe Epics::CloseService do ...@@ -26,7 +26,7 @@ describe Epics::CloseService do
context 'when a user has permissions to update the epic' do context 'when a user has permissions to update the epic' do
before do before do
group.add_master(user) group.add_maintainer(user)
end end
context 'when closing an opened epic' do context 'when closing an opened epic' do
......
...@@ -11,7 +11,7 @@ describe Epics::ReopenService do ...@@ -11,7 +11,7 @@ describe Epics::ReopenService do
context 'when epics are disabled' do context 'when epics are disabled' do
before do before do
group.add_master(user) group.add_maintainer(user)
end end
it 'does not reopen the epic' do it 'does not reopen the epic' do
...@@ -26,7 +26,7 @@ describe Epics::ReopenService do ...@@ -26,7 +26,7 @@ describe Epics::ReopenService do
context 'when a user has permissions to update the epic' do context 'when a user has permissions to update the epic' do
before do before do
group.add_master(user) group.add_maintainer(user)
end end
context 'when reopening a closed epic' do context 'when reopening a closed epic' do
......
...@@ -10,7 +10,7 @@ describe Epics::UpdateService do ...@@ -10,7 +10,7 @@ describe Epics::UpdateService do
describe '#execute' do describe '#execute' do
before do before do
stub_licensed_features(epics: true) stub_licensed_features(epics: true)
group.add_master(user) group.add_maintainer(user)
end end
def find_note(starting_with) def find_note(starting_with)
......
...@@ -137,7 +137,7 @@ describe Groups::AutocompleteService do ...@@ -137,7 +137,7 @@ describe Groups::AutocompleteService do
let!(:subgroup_milestone) { create(:milestone, group: sub_group) } let!(:subgroup_milestone) { create(:milestone, group: sub_group) }
before do before do
sub_group.add_master(user) sub_group.add_maintainer(user)
end end
context 'when group is public' do context 'when group is public' do
......
...@@ -14,8 +14,6 @@ module Gitlab ...@@ -14,8 +14,6 @@ module Gitlab
REPORTER = 20 REPORTER = 20
DEVELOPER = 30 DEVELOPER = 30
MAINTAINER = 40 MAINTAINER = 40
# @deprecated
MASTER = MAINTAINER
OWNER = 50 OWNER = 50
# Branch protection settings # Branch protection settings
......
...@@ -123,7 +123,7 @@ describe GroupDescendantsFinder do ...@@ -123,7 +123,7 @@ describe GroupDescendantsFinder do
project = create(:project, namespace: group) project = create(:project, namespace: group)
other_project = create(:project) other_project = create(:project)
other_project.project_group_links.create(group: group, other_project.project_group_links.create(group: group,
group_access: ProjectGroupLink::MASTER) group_access: ProjectGroupLink::MAINTAINER)
expect(finder.execute).to contain_exactly(project) expect(finder.execute).to contain_exactly(project)
end end
......
...@@ -302,7 +302,7 @@ describe API::Groups do ...@@ -302,7 +302,7 @@ describe API::Groups do
before do before do
group1.add_developer(user2) group1.add_developer(user2)
group3.add_master(user2) group3.add_maintainer(user2)
end end
it 'returns an array of groups the user has at least master access' do it 'returns an array of groups the user has at least master access' do
......
...@@ -19,7 +19,7 @@ describe "Internal Project Pages Access" do ...@@ -19,7 +19,7 @@ describe "Internal Project Pages Access" do
before do before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true) allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
group.add_owner(owner) group.add_owner(owner)
project.add_master(master) project.add_maintainer(master)
project.add_developer(developer) project.add_developer(developer)
project.add_reporter(reporter) project.add_reporter(reporter)
project.add_guest(guest) project.add_guest(guest)
......
...@@ -19,7 +19,7 @@ describe "Private Project Pages Access" do ...@@ -19,7 +19,7 @@ describe "Private Project Pages Access" do
before do before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true) allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
group.add_owner(owner) group.add_owner(owner)
project.add_master(master) project.add_maintainer(master)
project.add_developer(developer) project.add_developer(developer)
project.add_reporter(reporter) project.add_reporter(reporter)
project.add_guest(guest) project.add_guest(guest)
......
...@@ -19,7 +19,7 @@ describe "Public Project Pages Access" do ...@@ -19,7 +19,7 @@ describe "Public Project Pages Access" do
before do before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true) allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
group.add_owner(owner) group.add_owner(owner)
project.add_master(master) project.add_maintainer(master)
project.add_developer(developer) project.add_developer(developer)
project.add_reporter(reporter) project.add_reporter(reporter)
project.add_guest(guest) project.add_guest(guest)
......
...@@ -2790,7 +2790,7 @@ describe NotificationService, :mailer do ...@@ -2790,7 +2790,7 @@ describe NotificationService, :mailer do
let!(:developer) { create(:user) } let!(:developer) { create(:user) }
before do before do
project.add_master(master) project.add_maintainer(master)
end end
it 'sends the email to owners and masters' do it 'sends the email to owners and masters' do
......
...@@ -38,7 +38,7 @@ RSpec.describe "projects/artifacts/_artifact.html.haml" do ...@@ -38,7 +38,7 @@ RSpec.describe "projects/artifacts/_artifact.html.haml" do
let(:user) { create(:user) } let(:user) { create(:user) }
it 'has a delete button' do it 'has a delete button' do
allow_any_instance_of(ProjectTeam).to receive(:max_member_access).and_return(Gitlab::Access::MASTER) allow_any_instance_of(ProjectTeam).to receive(:max_member_access).and_return(Gitlab::Access::MAINTAINER)
render_partial render_partial
expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first))
......
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