Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
025a1b01
Commit
025a1b01
authored
May 10, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled no-one as a merge access level in protected branches
Closes #31541
parent
566ee145
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
28 deletions
+22
-28
app/models/concerns/protected_branch_access.rb
app/models/concerns/protected_branch_access.rb
+18
-0
app/models/protected_branch/merge_access_level.rb
app/models/protected_branch/merge_access_level.rb
+0
-10
app/models/protected_branch/push_access_level.rb
app/models/protected_branch/push_access_level.rb
+0
-18
changelogs/unreleased/protected-branches-no-one-merge.yml
changelogs/unreleased/protected-branches-no-one-merge.yml
+4
-0
No files found.
app/models/concerns/protected_branch_access.rb
View file @
025a1b01
...
@@ -7,5 +7,23 @@ module ProtectedBranchAccess
...
@@ -7,5 +7,23 @@ module ProtectedBranchAccess
belongs_to
:protected_branch
belongs_to
:protected_branch
delegate
:project
,
to: :protected_branch
delegate
:project
,
to: :protected_branch
validates
:access_level
,
presence:
true
,
inclusion:
{
in:
[
Gitlab
::
Access
::
MASTER
,
Gitlab
::
Access
::
DEVELOPER
,
Gitlab
::
Access
::
NO_ACCESS
]
}
def
self
.
human_access_levels
{
Gitlab
::
Access
::
MASTER
=>
"Masters"
,
Gitlab
::
Access
::
DEVELOPER
=>
"Developers + Masters"
,
Gitlab
::
Access
::
NO_ACCESS
=>
"No one"
}.
with_indifferent_access
end
def
check_access
(
user
)
return
false
if
access_level
==
Gitlab
::
Access
::
NO_ACCESS
super
end
end
end
end
end
app/models/protected_branch/merge_access_level.rb
View file @
025a1b01
class
ProtectedBranch::MergeAccessLevel
<
ActiveRecord
::
Base
class
ProtectedBranch::MergeAccessLevel
<
ActiveRecord
::
Base
include
ProtectedBranchAccess
include
ProtectedBranchAccess
validates
:access_level
,
presence:
true
,
inclusion:
{
in:
[
Gitlab
::
Access
::
MASTER
,
Gitlab
::
Access
::
DEVELOPER
]
}
def
self
.
human_access_levels
{
Gitlab
::
Access
::
MASTER
=>
"Masters"
,
Gitlab
::
Access
::
DEVELOPER
=>
"Developers + Masters"
}.
with_indifferent_access
end
end
end
app/models/protected_branch/push_access_level.rb
View file @
025a1b01
class
ProtectedBranch::PushAccessLevel
<
ActiveRecord
::
Base
class
ProtectedBranch::PushAccessLevel
<
ActiveRecord
::
Base
include
ProtectedBranchAccess
include
ProtectedBranchAccess
validates
:access_level
,
presence:
true
,
inclusion:
{
in:
[
Gitlab
::
Access
::
MASTER
,
Gitlab
::
Access
::
DEVELOPER
,
Gitlab
::
Access
::
NO_ACCESS
]
}
def
self
.
human_access_levels
{
Gitlab
::
Access
::
MASTER
=>
"Masters"
,
Gitlab
::
Access
::
DEVELOPER
=>
"Developers + Masters"
,
Gitlab
::
Access
::
NO_ACCESS
=>
"No one"
}.
with_indifferent_access
end
def
check_access
(
user
)
return
false
if
access_level
==
Gitlab
::
Access
::
NO_ACCESS
super
end
end
end
changelogs/unreleased/protected-branches-no-one-merge.yml
0 → 100644
View file @
025a1b01
---
title
:
Allow 'no one' as an option for allowed to merge on a procted branch
merge_request
:
author
:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment