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