This instance was upgraded to Heptapod 0.27.2 on 2021-12-08 at 22:00 UTC+1

Commit e22d200a authored by Mark Chao's avatar Mark Chao Committed by Dmitriy Zaporozhets
Browse files

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

parent 2649cbe0cb26
......@@ -9,7 +9,7 @@ def change
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
......
......@@ -7,12 +7,14 @@ module Gitlab
module Access
AccessDeniedError = Class.new(StandardError)
NO_ACCESS = 0
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
NO_ACCESS = 0
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MAINTAINER = 40
# @deprecated
MASTER = MAINTAINER
OWNER = 50
# Branch protection settings
PROTECTION_NONE = 0
......@@ -32,7 +34,7 @@ def options
"Guest" => GUEST,
"Reporter" => REPORTER,
"Developer" => DEVELOPER,
"Maintainer" => MASTER
"Maintainer" => MAINTAINER
}
end
......@@ -44,10 +46,10 @@ def options_with_owner
def sym_options
{
guest: GUEST,
reporter: REPORTER,
developer: DEVELOPER,
master: MASTER
guest: GUEST,
reporter: REPORTER,
developer: DEVELOPER,
maintainer: MAINTAINER
}
end
......
......@@ -47,7 +47,7 @@ def missing_keys_tracking_hash
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 @@ def calculate
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 @@ def calculate
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 @@ def allow_devs_and_maintainers_to_push
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 @@ def allow_devs_and_maintainers_to_merge
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
let(:guest) { create(:user) }
before do
project.add_master(user)
project.add_maintainer(user)
project.add_guest(guest)
end
......
......@@ -28,8 +28,8 @@
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 @@
before do
sign_in(user)
project.add_master(user)
project.add_maintainer(user)
end
it_behaves_like 'milestone tabs'
......
......@@ -5,7 +5,7 @@
let(:project) { create(:project) }
before do
project.add_master(user)
project.add_maintainer(user)
sign_in(user)
end
......
......@@ -5,7 +5,7 @@
let(:user) { create(:user) }
before do
group.add_master(user)
group.add_maintainer(user)
sign_in(user)
end
......
......@@ -28,7 +28,7 @@
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 @@
before do
sign_in(user)
group.add_master(user)
group.add_maintainer(user)
end
describe '#update' do
......
......@@ -5,7 +5,7 @@
let(:user) { create(:user) }
before do
group.add_master(user)
group.add_maintainer(user)
sign_in(user)
end
......
......@@ -6,7 +6,7 @@
before do
sign_in(user)
group.add_master(user)
group.add_maintainer(user)
end
describe 'GET #show' do
......
......@@ -7,7 +7,7 @@
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 @@
[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 @@
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) }
......
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