Commit de72151c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '42751-rename-master-to-maintainer-2' into 'master'

Resolve "Rename the `Master` role to `Maintainer`" Backend

Closes #42751

See merge request gitlab-org/gitlab-ce!19413
parents 1bf54e09 a63bce1a
......@@ -2,19 +2,20 @@ module ProtectedRefAccess
extend ActiveSupport::Concern
ALLOWED_ACCESS_LEVELS = [
Gitlab::Access::MASTER,
Gitlab::Access::MAINTAINER,
Gitlab::Access::DEVELOPER,
Gitlab::Access::NO_ACCESS
].freeze
HUMAN_ACCESS_LEVELS = {
Gitlab::Access::MASTER => "Maintainers".freeze,
Gitlab::Access::MAINTAINER => "Maintainers".freeze,
Gitlab::Access::DEVELOPER => "Developers + Maintainers".freeze,
Gitlab::Access::NO_ACCESS => "No one".freeze
}.freeze
included do
scope :master, -> { where(access_level: Gitlab::Access::MASTER) }
scope :master, -> { maintainer } # @deprecated
scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) }
scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) }
validates :access_level, presence: true, if: :role?, inclusion: {
......
......@@ -6,8 +6,11 @@ module SelectForProjectAuthorization
select("projects.id AS project_id, members.access_level")
end
def select_as_master_for_project_authorization
select(["projects.id AS project_id", "#{Gitlab::Access::MASTER} AS access_level"])
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
......@@ -186,10 +186,13 @@ class Group < Namespace
add_user(user, :developer, current_user: current_user)
end
def add_master(user, current_user = nil)
add_user(user, :master, current_user: current_user)
def add_maintainer(user, current_user = nil)
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
......@@ -206,12 +209,15 @@ class Group < Namespace
members_with_parents.owners.where(user_id: user).any?
end
def has_master?(user)
def has_maintainer?(user)
return false unless user
members_with_parents.masters.where(user_id: user).any?
members_with_parents.maintainers.where(user_id: user).any?
end
# @deprecated
alias_method :has_master?, :has_maintainer?
# Check if user is a last owner of the group.
# Parent owners are ignored for nested groups.
def last_owner?(user)
......
......@@ -69,9 +69,11 @@ class Member < ActiveRecord::Base
scope :guests, -> { active.where(access_level: GUEST) }
scope :reporters, -> { active.where(access_level: REPORTER) }
scope :developers, -> { active.where(access_level: DEVELOPER) }
scope :masters, -> { active.where(access_level: MASTER) }
scope :maintainers, -> { active.where(access_level: MAINTAINER) }
scope :masters, -> { maintainers } # @deprecated
scope :owners, -> { active.where(access_level: OWNER) }
scope :owners_and_masters, -> { active.where(access_level: [OWNER, MASTER]) }
scope :owners_and_maintainers, -> { active.where(access_level: [OWNER, MAINTAINER]) }
scope :owners_and_masters, -> { owners_and_maintainers } # @deprecated
scope :order_name_asc, -> { left_join_users.reorder(Gitlab::Database.nulls_last_order('users.name', 'ASC')) }
scope :order_name_desc, -> { left_join_users.reorder(Gitlab::Database.nulls_last_order('users.name', 'DESC')) }
......
......@@ -17,19 +17,19 @@ class ProjectMember < Member
# Add users to projects with passed access option
#
# access can be an integer representing a access code
# or symbol like :master representing role
# or symbol like :maintainer representing role
#
# Ex.
# add_users_to_projects(
# project_ids,
# user_ids,
# ProjectMember::MASTER
# ProjectMember::MAINTAINER
# )
#
# add_users_to_projects(
# project_ids,
# user_ids,
# :master
# :maintainer
# )
#
def add_users_to_projects(project_ids, users, access_level, current_user: nil, expires_at: nil)
......
......@@ -269,7 +269,8 @@ class Project < ActiveRecord::Base
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :members, to: :team, prefix: true
delegate :add_user, :add_users, to: :team
delegate :add_guest, :add_reporter, :add_developer, :add_master, :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
# Validations
......@@ -1647,10 +1648,10 @@ class Project < ActiveRecord::Base
params = {
name: default_branch,
push_access_levels_attributes: [{
access_level: Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_PUSH ? Gitlab::Access::DEVELOPER : Gitlab::Access::MASTER
access_level: Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_PUSH ? Gitlab::Access::DEVELOPER : Gitlab::Access::MAINTAINER
}],
merge_access_levels_attributes: [{
access_level: Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE ? Gitlab::Access::DEVELOPER : Gitlab::Access::MASTER
access_level: Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE ? Gitlab::Access::DEVELOPER : Gitlab::Access::MAINTAINER
}]
}
......
......@@ -4,7 +4,8 @@ class ProjectGroupLink < ActiveRecord::Base
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
MAINTAINER = 40
MASTER = MAINTAINER # @deprecated
belongs_to :project
belongs_to :group
......
......@@ -19,10 +19,13 @@ class ProjectTeam
add_user(user, :developer, current_user: current_user)
end
def add_master(user, current_user: nil)
add_user(user, :master, current_user: current_user)
def add_maintainer(user, current_user: nil)
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
......@@ -81,10 +84,13 @@ class ProjectTeam
@developers ||= fetch_members(Gitlab::Access::DEVELOPER)
end
def masters
@masters ||= fetch_members(Gitlab::Access::MASTER)
def maintainers
@maintainers ||= fetch_members(Gitlab::Access::MAINTAINER)
end
# @deprecated
alias_method :masters, :maintainers
def owners
@owners ||=
if group
......@@ -136,10 +142,13 @@ class ProjectTeam
max_member_access(user.id) == Gitlab::Access::DEVELOPER
end
def master?(user)
max_member_access(user.id) == Gitlab::Access::MASTER
def maintainer?(user)
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)
......
......@@ -99,7 +99,8 @@ class User < ActiveRecord::Base
has_many :group_members, -> { where(requested_at: nil) }, source: 'GroupMember'
has_many :groups, through: :group_members
has_many :owned_groups, -> { where(members: { access_level: Gitlab::Access::OWNER }) }, through: :group_members, source: :group
has_many :masters_groups, -> { where(members: { access_level: Gitlab::Access::MASTER }) }, through: :group_members, source: :group
has_many :maintainers_groups, -> { where(members: { access_level: Gitlab::Access::MAINTAINER }) }, through: :group_members, source: :group
alias_attribute :masters_groups, :maintainers_groups
# Projects
has_many :groups_projects, through: :groups, source: :projects
......@@ -728,7 +729,7 @@ class User < ActiveRecord::Base
end
def several_namespaces?
owned_groups.any? || masters_groups.any?
owned_groups.any? || maintainers_groups.any?
end
def namespace_id
......@@ -974,15 +975,15 @@ class User < ActiveRecord::Base
end
def manageable_groups
union_sql = Gitlab::SQL::Union.new([owned_groups.select(:id), masters_groups.select(:id)]).to_sql
union_sql = Gitlab::SQL::Union.new([owned_groups.select(:id), maintainers_groups.select(:id)]).to_sql
# Update this line to not use raw SQL when migrated to Rails 5.2.
# Either ActiveRecord or Arel constructions are fine.
# This was replaced with the raw SQL construction because of bugs in the arel gem.
# Bugs were fixed in arel 9.0.0 (Rails 5.2).
owned_and_master_groups = Group.where("namespaces.id IN (#{union_sql})") # rubocop:disable GitlabSecurity/SqlInjection
owned_and_maintainer_groups = Group.where("namespaces.id IN (#{union_sql})") # rubocop:disable GitlabSecurity/SqlInjection
Gitlab::GroupHierarchy.new(owned_and_master_groups).base_and_descendants
Gitlab::GroupHierarchy.new(owned_and_maintainer_groups).base_and_descendants
end
def namespaces
......@@ -1023,11 +1024,11 @@ class User < ActiveRecord::Base
def ci_owned_runners
@ci_owned_runners ||= begin
project_runner_ids = Ci::RunnerProject
.where(project: authorized_projects(Gitlab::Access::MASTER))
.where(project: authorized_projects(Gitlab::Access::MAINTAINER))
.select(:runner_id)
group_runner_ids = Ci::RunnerNamespace
.where(namespace_id: owned_or_masters_groups.select(:id))
.where(namespace_id: owned_or_maintainers_groups.select(:id))
.select(:runner_id)
union = Gitlab::SQL::Union.new([project_runner_ids, group_runner_ids])
......@@ -1236,11 +1237,14 @@ class User < ActiveRecord::Base
!terms_accepted?
end
def owned_or_masters_groups
union = Gitlab::SQL::Union.new([owned_groups, masters_groups])
def owned_or_maintainers_groups
union = Gitlab::SQL::Union.new([owned_groups, maintainers_groups])
Group.from("(#{union.to_sql}) namespaces")
end
# @deprecated
alias_method :owned_or_masters_groups, :owned_or_maintainers_groups
protected
# override, from Devise::Validatable
......
......@@ -4,7 +4,7 @@ module Clusters
delegate { cluster.project }
rule { can?(:master_access) }.policy do
rule { can?(:maintainer_access) }.policy do
enable :update_cluster
enable :admin_cluster
end
......
class DeployTokenPolicy < BasePolicy
with_options scope: :subject, score: 0
condition(:master) { @subject.project.team.master?(@user) }
condition(:maintainer) { @subject.project.team.maintainer?(@user) }
rule { anonymous }.prevent_all
rule { master }.policy do
rule { maintainer }.policy do
enable :create_deploy_token
enable :update_deploy_token
end
......
......@@ -11,7 +11,7 @@ class GroupPolicy < BasePolicy
condition(:guest) { access_level >= GroupMember::GUEST }
condition(:developer) { access_level >= GroupMember::DEVELOPER }
condition(:owner) { access_level >= GroupMember::OWNER }
condition(:master) { access_level >= GroupMember::MASTER }
condition(:maintainer) { access_level >= GroupMember::MAINTAINER }
condition(:reporter) { access_level >= GroupMember::REPORTER }
condition(:nested_groups_supported, scope: :global) { Group.supports_nested_groups? }
......@@ -59,7 +59,7 @@ class GroupPolicy < BasePolicy
enable :admin_issue
end
rule { master }.policy do
rule { maintainer }.policy do
enable :create_projects
enable :admin_pipeline
enable :admin_build
......
......@@ -46,7 +46,7 @@ class ProjectPolicy < BasePolicy
condition(:developer) { team_access_level >= Gitlab::Access::DEVELOPER }
desc "User has maintainer access"
condition(:master) { team_access_level >= Gitlab::Access::MASTER }
condition(:maintainer) { team_access_level >= Gitlab::Access::MAINTAINER }
desc "Project is public"
condition(:public_project, scope: :subject, score: 0) { project.public? }
......@@ -123,14 +123,14 @@ class ProjectPolicy < BasePolicy
rule { guest }.enable :guest_access
rule { reporter }.enable :reporter_access
rule { developer }.enable :developer_access
rule { master }.enable :master_access
rule { maintainer }.enable :maintainer_access
rule { owner | admin }.enable :owner_access
rule { can?(:owner_access) }.policy do
enable :guest_access
enable :reporter_access
enable :developer_access
enable :master_access
enable :maintainer_access
enable :change_namespace
enable :change_visibility_level
......@@ -228,7 +228,7 @@ class ProjectPolicy < BasePolicy
enable :create_deployment
end
rule { can?(:master_access) }.policy do
rule { can?(:maintainer_access) }.policy do
enable :push_to_delete_protected_branch
enable :update_project_snippet
enable :update_environment
......
......@@ -274,9 +274,9 @@ class NotificationService
def new_access_request(member)
return true unless member.notifiable?(:subscription)
recipients = member.source.members.active_without_invites_and_requests.owners_and_masters
if fallback_to_group_owners_masters?(recipients, member)
recipients = member.source.group.members.active_without_invites_and_requests.owners_and_masters
recipients = member.source.members.active_without_invites_and_requests.owners_and_maintainers
if fallback_to_group_owners_maintainers?(recipients, member)
recipients = member.source.group.members.active_without_invites_and_requests.owners_and_maintainers
end
recipients.each { |recipient| deliver_access_request_email(recipient, member) }
......@@ -519,7 +519,7 @@ class NotificationService
return [] unless project
notifiable_users(project.team.masters, :watch, target: project)
notifiable_users(project.team.maintainers, :watch, target: project)
end
def notifiable?(*args)
......@@ -534,7 +534,7 @@ class NotificationService
mailer.member_access_requested_email(member.real_source_type, member.id, recipient.user.notification_email).deliver_later
end
def fallback_to_group_owners_masters?(recipients, member)
def fallback_to_group_owners_maintainers?(recipients, member)
return false if recipients.present?
member.source.respond_to?(:group) && member.source.group
......
......@@ -115,7 +115,7 @@ module Projects
@project.group.refresh_members_authorized_projects(blocking: false)
current_user.refresh_authorized_projects
else
@project.add_master(@project.namespace.owner, current_user: current_user)
@project.add_maintainer(@project.namespace.owner, current_user: current_user)
end
end
......
......@@ -14,7 +14,7 @@ module ProtectedBranches
private
def params_with_default(params)
params[:"#{type}_access_level"] ||= Gitlab::Access::MASTER if use_default_access_level?(params)
params[:"#{type}_access_level"] ||= Gitlab::Access::MAINTAINER if use_default_access_level?(params)
params
end
......
......@@ -9,14 +9,14 @@ module ProtectedBranches
if params.delete(:developers_can_push)
Gitlab::Access::DEVELOPER
else
Gitlab::Access::MASTER
Gitlab::Access::MAINTAINER
end
merge_access_level =
if params.delete(:developers_can_merge)
Gitlab::Access::DEVELOPER
else
Gitlab::Access::MASTER
Gitlab::Access::MAINTAINER
end
@params.merge!(push_access_levels_attributes: [{ access_level: push_access_level }],
......
......@@ -17,14 +17,14 @@ module ProtectedBranches
when true
params[:push_access_levels_attributes] = [{ access_level: Gitlab::Access::DEVELOPER }]
when false
params[:push_access_levels_attributes] = [{ access_level: Gitlab::Access::MASTER }]
params[:push_access_levels_attributes] = [{ access_level: Gitlab::Access::MAINTAINER }]
end
case @developers_can_merge
when true
params[:merge_access_levels_attributes] = [{ access_level: Gitlab::Access::DEVELOPER }]
when false
params[:merge_access_levels_attributes] = [{ access_level: Gitlab::Access::MASTER }]
params[:merge_access_levels_attributes] = [{ access_level: Gitlab::Access::MAINTAINER }]
end
service = ProtectedBranches::UpdateService.new(@project, @current_user, @params)
......
......@@ -17,7 +17,7 @@ class Member < ActiveRecord::Base
scope :guests, -> { where(access_level: GUEST) }
scope :reporters, -> { where(access_level: REPORTER) }
scope :developers, -> { where(access_level: DEVELOPER) }
scope :masters, -> { where(access_level: MASTER) }
scope :maintainers, -> { where(access_level: MAINTAINER) }
scope :owners, -> { where(access_level: OWNER) }
delegate :name, :username, :email, to: :user, prefix: true
......
......@@ -9,7 +9,7 @@ class AddProtectedBranchesPushAccess < ActiveRecord::Migration
create_table :protected_branch_push_access_levels do |t|
t.references :protected_branch, index: { name: "index_protected_branch_push_access" }, foreign_key: true, null: false
# Gitlab::Access::MASTER == 40
# Gitlab::Access::MAINTAINER == 40
t.integer :access_level, default: 40, null: false
t.timestamps null: false
......
......@@ -9,7 +9,7 @@ class AddProtectedBranchesMergeAccess < ActiveRecord::Migration
create_table :protected_branch_merge_access_levels do |t|
t.references :protected_branch, index: { name: "index_protected_branch_merge_access" }, foreign_key: true, null: false
# Gitlab::Access::MASTER == 40
# Gitlab::Access::MAINTAINER == 40
t.integer :access_level, default: 40, null: false
t.timestamps null: false
......
......@@ -14,7 +14,7 @@ bundle exec rake gitlab:import:user_to_projects[username@domain.tld] RAILS_ENV=p
Notes:
- admin users are added as masters
- admin users are added as maintainers
```bash
# omnibus-gitlab
......
......@@ -11,7 +11,9 @@ module Gitlab
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
MAINTAINER = 40
# @deprecated
MASTER = MAINTAINER
OWNER = 50
# Branch protection settings
......@@ -32,7 +34,7 @@ module Gitlab
"Guest" => GUEST,
"Reporter" => REPORTER,
"Developer" => DEVELOPER,
"Maintainer" => MASTER
"Maintainer" => MAINTAINER
}
end
......@@ -47,7 +49,7 @@ module Gitlab
guest: GUEST,
reporter: REPORTER,
developer: DEVELOPER,
master: MASTER
maintainer: MAINTAINER
}
end
......
......@@ -47,7 +47,7 @@ module Gitlab
def ensure_default_member!
@project.project_members.destroy_all
ProjectMember.create!(user: @user, access_level: ProjectMember::MASTER, source_id: @project.id, importing: true)
ProjectMember.create!(user: @user, access_level: ProjectMember::MAINTAINER, source_id: @project.id, importing: true)
end
def add_team_member(member, existing_user = nil)
......
......@@ -24,7 +24,7 @@ module Gitlab
user.projects.select_for_project_authorization,
# The personal projects of the user.
user.personal_projects.select_as_master_for_project_authorization,
user.personal_projects.select_as_maintainer_for_project_authorization,
# Projects that belong directly to any of the groups the user has
# access to.
......
......@@ -15,7 +15,7 @@ module Gitlab
user.projects.select_for_project_authorization,
# Personal projects
user.personal_projects.select_as_master_for_project_authorization,
user.personal_projects.select_as_maintainer_for_project_authorization,
# Projects of groups the user is a member of
user.groups_projects.select_for_project_authorization,
......
namespace :gitlab do
namespace :import do
desc "GitLab | Add all users to all projects (admin users are added as masters)"
desc "GitLab | Add all users to all projects (admin users are added as maintainers)"
task all_users_to_all_projects: :environment do |t, args|
user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id)
......@@ -10,7 +10,7 @@ namespace :gitlab do
ProjectMember.add_users_to_projects(project_ids, user_ids, ProjectMember::DEVELOPER)
puts "Importing #{admin_ids.size} admins into #{project_ids.size} projects"
ProjectMember.add_users_to_projects(project_ids, admin_ids, ProjectMember::MASTER)
ProjectMember.add_users_to_projects(project_ids, admin_ids, ProjectMember::MAINTAINER)
end
desc "GitLab | Add a specific user to all projects (as a developer)"
......
......@@ -44,6 +44,9 @@ module QA
click_allow(:push, 'Developers + Maintainers')
end
# @deprecated
alias_method :allow_devs_and_masters_to_push, :allow_devs_and_maintainers_to_push
def allow_no_one_to_merge
click_allow(:merge, 'No one')
end
......@@ -52,6 +55,9 @@ module QA
click_allow(:merge, 'Developers + Maintainers')
end
# @deprecated
alias_method :allow_devs_and_masters_to_merge, :allow_devs_and_maintainers_to_merge
def protect_branch
click_on 'Protect'
end
......
......@@ -228,12 +228,12 @@ describe AutocompleteController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
context 'authorized projects' do
before do
authorized_project.add_master(user)
authorized_project.add_maintainer(user)
end
describe 'GET #projects with project ID' do
......@@ -253,8 +253,8 @@ describe AutocompleteController do
context 'authorized projects and search' do
before do
authorized_project.add_master(user)
authorized_search_project.add_master(user)
authorized_project.add_maintainer(user)
authorized_search_project.add_maintainer(user)
end
describe 'GET #projects with project ID and search' do
......@@ -277,9 +277,9 @@ describe AutocompleteController do
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
authorized_project3.add_master(user)
authorized_project.add_maintainer(user)
authorized_project2.add_maintainer(user)
authorized_project3.add_maintainer(user)
stub_const 'MoveToProjectFinder::PAGE_SIZE', 2
end
......@@ -301,9 +301,9 @@ describe AutocompleteController do
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
authorized_project3.add_master(user)
authorized_project.add_maintainer(user)
authorized_project2.add_maintainer(user)
authorized_project3.add_maintainer(user)
end
describe 'GET #projects with project ID and offset_id' do
......
......@@ -13,7 +13,7 @@ describe Boards::IssuesController do
let!(:list2) { create(:list, board: board, label: development, position: 1) }
before do
project.add_master(user)
project.add_maintainer(user)
project.add_guest(guest)
end
......
......@@ -7,7 +7,7 @@ describe Boards::ListsController do
let(:guest) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
project.add_guest(guest)
end
......
......@@ -28,8 +28,8 @@ describe Dashboard::GroupsController do
let!(:other_group) { create(:group, name: 'other') }
before do
top_level_result.add_master(user)
top_level_a.add_master(user)
top_level_result.add_maintainer(user)
top_level_a.add_maintainer(user)
end
it 'renders only groups the user is a member of when searching hierarchy correctly' do
......
......@@ -17,7 +17,7 @@ describe Dashboard::MilestonesController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
it_behaves_like 'milestone tabs'
......
......@@ -5,7 +5,7 @@ describe DashboardController do
let(:project) { create(:project) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@ describe Groups::BoardsController do
let(:user) { create(:user) }
before do
group.add_master(user)
group.add_maintainer(user)
sign_in(user)
end
......
......@@ -28,7 +28,7 @@ describe Groups::MilestonesController do
before do
sign_in(user)
group.add_owner(user)
project.add_master(user)
project.add_maintainer(user)
end
describe '#index' do
......
......@@ -14,7 +14,7 @@ describe Groups::RunnersController do
before do
sign_in(user)
group.add_master(user)
group.add_maintainer(user)
end
describe '#update' do
......
......@@ -5,7 +5,7 @@ describe Groups::Settings::CiCdController do
let(:user) { create(:user) }
before do
group.add_master(user)
group.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,7 +6,7 @@ describe Groups::VariablesController do
before do
sign_in(user)
group.add_master(user)
group.add_maintainer(user)
end
describe 'GET #show' do
......
......@@ -7,7 +7,7 @@ describe GroupsController do
let(:project) { create(:project, namespace: group) }
let!(:group_member) { create(:group_member, group: group, user: user) }
let!(:owner) { group.add_owner(create(:user)).user }
let!(:master) { group.add_master(create(:user)).user }
let!(:maintainer) { group.add_maintainer(create(:user)).user }
let!(:developer) { group.add_developer(create(:user)).user }
let!(:guest) { group.add_guest(create(:user)).user }
......@@ -62,7 +62,7 @@ describe GroupsController do
[true, false].each do |can_create_group_status|
context "and can_create_group is #{can_create_group_status}" do
before do
User.where(id: [admin, owner, master, developer, guest]).update_all(can_create_group: can_create_group_status)
User.where(id: [admin, owner, maintainer, developer, guest]).update_all(can_create_group: can_create_group_status)
end
[:admin, :owner].each do |member_type|
......@@ -73,7 +73,7 @@ describe GroupsController do
end
end
[:guest, :developer, :master].each do |member_type|
[:guest, :developer, :maintainer].each do |member_type|
context "and logged in as #{member_type.capitalize}" do
it_behaves_like 'member without ability to create subgroups' do
let(:member) { send(member_type) }
......
......@@ -6,7 +6,7 @@ describe Projects::AvatarsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
controller.instance_variable_set(:@project, project)
end
......
......@@ -6,7 +6,7 @@ describe Projects::BadgesController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -7,7 +7,7 @@ describe Projects::BlameController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
controller.instance_variable_set(:@project, project)
end
......
......@@ -108,7 +108,7 @@ describe Projects::BlobController do
end
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -230,12 +230,12 @@ describe Projects::BlobController do
end
end
context 'as master' do
let(:master) { create(:user) }
context 'as maintainer' do
let(:maintainer) { create(:user) }
before do
project.add_master(master)
sign_in(master)
project.add_maintainer(maintainer)
sign_in(maintainer)
get :edit, default_params
end
......@@ -263,7 +263,7 @@ describe Projects::BlobController do
end
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@ describe Projects::BoardsController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,7 +6,7 @@ describe Projects::BranchesController do
let(:developer) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
project.add_developer(user)
allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz'])
......
......@@ -17,7 +17,7 @@ describe Projects::Clusters::ApplicationsController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -70,7 +70,7 @@ describe Projects::Clusters::ApplicationsController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......
......@@ -11,7 +11,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -61,7 +61,7 @@ describe Projects::ClustersController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -79,7 +79,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -142,7 +142,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -156,7 +156,7 @@ describe Projects::ClustersController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -185,7 +185,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -236,7 +236,7 @@ describe Projects::ClustersController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -267,7 +267,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -286,7 +286,7 @@ describe Projects::ClustersController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -306,7 +306,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -327,7 +327,7 @@ describe Projects::ClustersController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -350,7 +350,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -365,7 +365,7 @@ describe Projects::ClustersController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -386,7 +386,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -437,7 +437,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -525,7 +525,7 @@ describe Projects::ClustersController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -552,7 +552,7 @@ describe Projects::ClustersController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -605,7 +605,7 @@ describe Projects::ClustersController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......
......@@ -9,7 +9,7 @@ describe Projects::CommitController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET show' do
......
......@@ -6,7 +6,7 @@ describe Projects::CommitsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe "GET show" do
......
......@@ -6,7 +6,7 @@ describe Projects::CompareController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET index' do
......
......@@ -6,7 +6,7 @@ describe Projects::CycleAnalyticsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'cycle analytics not set up flag' do
......
......@@ -5,7 +5,7 @@ describe Projects::DeployKeysController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -8,7 +8,7 @@ describe Projects::DeploymentsController do
let(:environment) { create(:environment, name: 'production', project: project) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -9,7 +9,7 @@ describe Projects::EnvironmentsController do
end
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -7,7 +7,7 @@ describe Projects::FindFileController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
controller.instance_variable_set(:@project, project)
end
......
......@@ -6,7 +6,7 @@ describe Projects::GraphsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET languages' do
......
......@@ -7,7 +7,7 @@ describe Projects::GroupLinksController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@ describe Projects::HooksController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,7 +6,7 @@ describe Projects::ImportsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET #show' do
......
......@@ -695,7 +695,7 @@ describe Projects::IssuesController do
let(:project) { merge_request.source_project }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in user
end
......@@ -869,7 +869,7 @@ describe Projects::IssuesController do
def post_spam
admin = create(:admin)
create(:user_agent_detail, subject: issue)
project.add_master(admin)
project.add_maintainer(admin)
sign_in(admin)
post :mark_as_spam, {
namespace_id: project.namespace,
......
......@@ -431,7 +431,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
describe 'POST erase' do
let(:role) { :master }
let(:role) { :maintainer }
before do
project.add_role(user, role)
......
......@@ -6,7 +6,7 @@ describe Projects::LabelsController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@ describe Projects::MattermostsController do
let!(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -16,7 +16,7 @@ describe Projects::MergeRequests::CreationsController do
end
before do
fork_project.add_master(user)
fork_project.add_maintainer(user)
Projects::ForkService.new(project, user).execute(fork_project)
sign_in(user)
end
......@@ -94,7 +94,7 @@ describe Projects::MergeRequests::CreationsController do
let(:other_project) { create(:project, :repository) }
before do
other_project.add_master(user)
other_project.add_maintainer(user)
end
context 'when the path exists in the diff' do
......
......@@ -140,7 +140,7 @@ describe Projects::MergeRequests::DiffsController do
let(:other_project) { create(:project) }
before do
other_project.add_master(user)
other_project.add_maintainer(user)
diff_for_path(old_path: existing_path, new_path: existing_path, project_id: other_project)
end
......
......@@ -11,7 +11,7 @@ describe Projects::MilestonesController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
controller.instance_variable_set(:@project, project)
end
......
......@@ -14,7 +14,7 @@ describe Projects::PagesController do
before do
allow(Gitlab.config.pages).to receive(:enabled).and_return(true)
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET show' do
......
......@@ -19,7 +19,7 @@ describe Projects::PagesDomainsController do
before do
allow(Gitlab.config.pages).to receive(:enabled).and_return(true)
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET show' do
......
......@@ -121,7 +121,7 @@ describe Projects::PipelineSchedulesController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_allowed_for(:developer).of(project) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -274,7 +274,7 @@ describe Projects::PipelineSchedulesController do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -292,19 +292,19 @@ describe Projects::PipelineSchedulesController do
it { expect { go }.to be_allowed_for(developer_1) }
it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
end
context 'when a master created a pipeline schedule' do
let(:master_1) { create(:user) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: master_1) }
context 'when a maintainer created a pipeline schedule' do
let(:maintainer_1) { create(:user) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: maintainer_1) }
before do
project.add_master(master_1)
project.add_maintainer(maintainer_1)
end
it { expect { go }.to be_allowed_for(master_1) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(maintainer_1) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_denied_for(:developer).of(project) }
end
end
......@@ -331,7 +331,7 @@ describe Projects::PipelineSchedulesController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -346,7 +346,7 @@ describe Projects::PipelineSchedulesController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -364,7 +364,7 @@ describe Projects::PipelineSchedulesController do
describe 'security' do
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }
it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { go }.to be_allowed_for(:developer).of(project).own(pipeline_schedule) }
it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { go }.to be_denied_for(:guest).of(project) }
......@@ -453,9 +453,9 @@ describe Projects::PipelineSchedulesController do
end
end
context 'when a master makes the request' do
context 'when a maintainer makes the request' do
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,7 +6,7 @@ describe Projects::PipelinesSettingsController do
let(:project) { project_auto_devops.project }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -37,7 +37,7 @@ describe Projects::ProjectMembersController do
context 'when user has enough rights' do
before do
project.add_master(user)
project.add_maintainer(user)
end
it 'adds user to members' do
......@@ -70,7 +70,7 @@ describe Projects::ProjectMembersController do
let(:requester) { create(:project_member, :access_request, project: project) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -121,7 +121,7 @@ describe Projects::ProjectMembersController do
context 'when user has enough rights' do
before do
project.add_master(user)
project.add_maintainer(user)
end
it '[HTML] removes user from members' do
......@@ -181,7 +181,7 @@ describe Projects::ProjectMembersController do
let(:project) { create(:project, namespace: user.namespace) }
before do
project.add_master(user)
project.add_maintainer(user)
end
it 'cannot remove themselves from the project' do
......@@ -263,7 +263,7 @@ describe Projects::ProjectMembersController do
context 'when user has enough rights' do
before do
project.add_master(user)
project.add_maintainer(user)
end
it 'adds user to members' do
......@@ -285,7 +285,7 @@ describe Projects::ProjectMembersController do
let(:member) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
another_project.add_guest(member)
sign_in(user)
end
......@@ -332,7 +332,7 @@ describe Projects::ProjectMembersController do
context 'when creating owner' do
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -346,9 +346,9 @@ describe Projects::ProjectMembersController do
end
end
context 'when create master' do
context 'when create maintainer' do
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -356,7 +356,7 @@ describe Projects::ProjectMembersController do
expect do
post :create, user_ids: stranger.id,
namespace_id: project.namespace,
access_level: Member::MASTER,
access_level: Member::MAINTAINER,
project_id: project
end.to change { project.members.count }.by(1)
end
......
......@@ -7,7 +7,7 @@ describe Projects::Prometheus::MetricsController do
let(:prometheus_adapter) { double('prometheus_adapter', can_query?: true) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -8,7 +8,7 @@ describe Projects::ProtectedBranchesController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
end
describe "GET #index" do
......@@ -20,10 +20,10 @@ describe Projects::ProtectedBranchesController do
end
describe "POST #create" do
let(:master_access_level) { [{ access_level: Gitlab::Access::MASTER }] }
let(:maintainer_access_level) { [{ access_level: Gitlab::Access::MAINTAINER }] }
let(:access_level_params) do
{ merge_access_levels_attributes: master_access_level,
push_access_levels_attributes: master_access_level }
{ merge_access_levels_attributes: maintainer_access_level,
push_access_levels_attributes: maintainer_access_level }
end
let(:create_params) { attributes_for(:protected_branch).merge(access_level_params) }
......
......@@ -15,7 +15,7 @@ describe Projects::ProtectedTagsController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -15,7 +15,7 @@ describe Projects::RunnersController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe '#update' do
......
......@@ -9,7 +9,7 @@ describe Projects::ServicesController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe '#test' do
......
......@@ -6,7 +6,7 @@ describe Projects::Settings::CiCdController do
let(:project) { project_auto_devops.project }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......@@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do
let!(:shared_runner) { create(:ci_runner, :instance) }
it 'sets assignable project runners only' do
group.add_master(user)
group.add_maintainer(user)
get :show, namespace_id: project.namespace, project_id: project
......@@ -40,7 +40,7 @@ describe Projects::Settings::CiCdController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true)
end
......
......@@ -5,7 +5,7 @@ describe Projects::Settings::IntegrationsController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@ describe Projects::Settings::RepositoryController do
let(:user) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,8 +6,8 @@ describe Projects::SnippetsController do
let(:user2) { create(:user) }
before do
project.add_master(user)
project.add_master(user2)
project.add_maintainer(user)
project.add_maintainer(user2)
end
describe 'GET #index' do
......@@ -291,7 +291,7 @@ describe Projects::SnippetsController do
def mark_as_spam
admin = create(:admin)
create(:user_agent_detail, subject: snippet)
project.add_master(admin)
project.add_maintainer(admin)
sign_in(admin)
post :mark_as_spam,
......
......@@ -13,7 +13,7 @@ describe Projects::TemplatesController do
end
before do
project.add_user(user, Gitlab::Access::MASTER)
project.add_user(user, Gitlab::Access::MAINTAINER)
project.repository.create_file(user, file_path_1, 'something valid',
message: 'test 3', branch_name: 'master')
end
......
......@@ -7,7 +7,7 @@ describe Projects::TreeController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
controller.instance_variable_set(:@project, project)
end
......
......@@ -6,7 +6,7 @@ describe Projects::VariablesController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
describe 'GET #show' do
......
......@@ -759,7 +759,7 @@ describe ProjectsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
context 'when project export is enabled' do
......@@ -787,7 +787,7 @@ describe ProjectsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
context 'object storage disabled' do
......@@ -847,7 +847,7 @@ describe ProjectsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
context 'when project export is enabled' do
......@@ -875,7 +875,7 @@ describe ProjectsController do
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
context 'when project export is enabled' do
......
......@@ -269,13 +269,13 @@ describe UploadsController do
context "when the user has access to the project" do
before do
project.add_master(user)
project.add_maintainer(user)
end
context "when the user is blocked" do
before do
user.block
project.add_master(user)
project.add_maintainer(user)
end
it "redirects to the sign in page" do
......@@ -475,13 +475,13 @@ describe UploadsController do
context "when the user has access to the project" do
before do
project.add_master(user)
project.add_maintainer(user)
end
context "when the user is blocked" do
before do
user.block
project.add_master(user)
project.add_maintainer(user)
end
it "redirects to the sign in page" do
......
......@@ -7,7 +7,7 @@ FactoryBot.define do
trait(:guest) { access_level GroupMember::GUEST }
trait(:reporter) { access_level GroupMember::REPORTER }
trait(:developer) { access_level GroupMember::DEVELOPER }
trait(:master) { access_level GroupMember::MASTER }
trait(:maintainer) { access_level GroupMember::MAINTAINER }
trait(:owner) { access_level GroupMember::OWNER }
trait(:access_request) { requested_at Time.now }
......
......@@ -2,12 +2,12 @@ FactoryBot.define do
factory :project_member do
user
project
master
maintainer
trait(:guest) { access_level ProjectMember::GUEST }
trait(:reporter) { access_level ProjectMember::REPORTER }
trait(:developer) { access_level ProjectMember::DEVELOPER }
trait(:master) { access_level ProjectMember::MASTER }
trait(:maintainer) { access_level ProjectMember::MAINTAINER }
trait(:access_request) { requested_at Time.now }
trait(:invited) do
......
......@@ -47,7 +47,7 @@ FactoryBot.define do
# user have access to the project. Our specs don't use said service class,
# thus we must manually refresh things here.
unless project.group || project.pending_delete
project.add_master(project.owner)
project.add_maintainer(project.owner)
end
project.group&.refresh_members_authorized_projects
......
......@@ -39,23 +39,23 @@ FactoryBot.define do
end
end
trait :masters_can_push do
trait :maintainers_can_push do
transient do
default_push_level false
end
after(:build) do |protected_branch|
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MAINTAINER)
end
end
after(:build) do |protected_branch, evaluator|
if evaluator.default_access_level && evaluator.default_push_level
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_branch.push_access_levels.new(access_level: Gitlab::Access::MAINTAINER)
end
if evaluator.default_access_level && evaluator.default_merge_level
protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_branch.merge_access_levels.new(access_level: Gitlab::Access::MAINTAINER)
end
end
......
......@@ -27,19 +27,19 @@ FactoryBot.define do
end
end
trait :masters_can_create do
trait :maintainers_can_create do
transient do
default_access_level false
end
after(:build) do |protected_tag|
protected_tag.create_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_tag.create_access_levels.new(access_level: Gitlab::Access::MAINTAINER)
end
end
after(:build) do |protected_tag, evaluator|
if evaluator.default_access_level
protected_tag.create_access_levels.new(access_level: Gitlab::Access::MASTER)
protected_tag.create_access_levels.new(access_level: Gitlab::Access::MAINTAINER)
end
end
end
......
......@@ -168,7 +168,7 @@ describe 'Admin Groups' do
it 'renders shared project' do
empty_project = create(:project)
empty_project.project_group_links.create!(
group_access: Gitlab::Access::MASTER,
group_access: Gitlab::Access::MAINTAINER,
group: group
)
......
......@@ -88,7 +88,7 @@ describe "Admin::Projects" do
describe 'add admin himself to a project' do
before do
project.add_master(user)
project.add_maintainer(user)
end
it 'adds admin a to a project as developer', :js do
......@@ -110,7 +110,7 @@ describe "Admin::Projects" do
describe 'admin remove himself from a project' do
before do
project.add_master(user)
project.add_maintainer(user)
project.add_developer(current_user)
end
......
......@@ -8,8 +8,8 @@ describe "Dashboard Issues Feed" do
let!(:project2) { create(:project) }
before do
project1.add_master(user)
project2.add_master(user)
project1.add_maintainer(user)
project2.add_maintainer(user)
end
describe "atom feed" do
......
......@@ -26,7 +26,7 @@ describe "Dashboard Feed" do
let(:note) { create(:note, noteable: issue, author: user, note: 'Bug confirmed', project: project) }
before do
project.add_master(user)
project.add_maintainer(user)
issue_event(issue, user)
note_event(note, user)
visit dashboard_projects_path(:atom, feed_token: user.feed_token)
......
......@@ -47,7 +47,7 @@ describe "User Feed" do
let!(:push_event_payload) { create(:push_event_payload, event: push_event) }
before do
project.add_master(user)
project.add_maintainer(user)
issue_event(issue, user)
note_event(note, user)
merge_request_event(merge_request, user)
......
......@@ -12,7 +12,7 @@ describe 'Issue Boards add issue modal', :js do
let!(:issue2) { create(:issue, project: project, title: 'hij', description: 'klm') }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
......
......@@ -11,8 +11,8 @@ describe 'Issue Boards', :js do
let!(:user2) { create(:user) }
before do
project.add_master(user)
project.add_master(user2)
project.add_maintainer(user)
project.add_maintainer(user2)
set_cookie('sidebar_collapsed', 'true')
......
......@@ -13,7 +13,7 @@ describe 'Issue Boards', :js do
let!(:issue3) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label], relative_position: 1) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -10,7 +10,7 @@ describe 'Issue Boards add issue modal filtering', :js do
let!(:issue1) { create(:issue, project: project) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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