Commit a63bce1a authored by Mark Chao's avatar Mark Chao Committed by Dmitriy Zaporozhets

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

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