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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b3cd850c
Commit
b3cd850c
authored
Aug 28, 2018
by
Sean McGivern
Committed by
Lin Jen-Shin
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EE-specific code from ProtectedRefAccess
parent
9357585e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
app/models/concerns/protected_ref_access.rb
app/models/concerns/protected_ref_access.rb
+11
-7
doc/api/protected_branches.md
doc/api/protected_branches.md
+1
-1
lib/api/protected_branches.rb
lib/api/protected_branches.rb
+2
-2
lib/api/protected_tags.rb
lib/api/protected_tags.rb
+1
-1
No files found.
app/models/concerns/protected_ref_access.rb
View file @
b3cd850c
...
...
@@ -3,18 +3,22 @@
module
ProtectedRefAccess
extend
ActiveSupport
::
Concern
ALLOWED_ACCESS_LEVELS
=
[
Gitlab
::
Access
::
MAINTAINER
,
Gitlab
::
Access
::
DEVELOPER
,
Gitlab
::
Access
::
NO_ACCESS
].
freeze
HUMAN_ACCESS_LEVELS
=
{
Gitlab
::
Access
::
MAINTAINER
=>
"Maintainers"
.
freeze
,
Gitlab
::
Access
::
DEVELOPER
=>
"Developers + Maintainers"
.
freeze
,
Gitlab
::
Access
::
NO_ACCESS
=>
"No one"
.
freeze
}.
freeze
class_methods
do
def
allowed_access_levels
[
Gitlab
::
Access
::
MAINTAINER
,
Gitlab
::
Access
::
DEVELOPER
,
Gitlab
::
Access
::
NO_ACCESS
]
end
end
included
do
scope
:master
,
->
{
maintainer
}
# @deprecated
scope
:maintainer
,
->
{
where
(
access_level:
Gitlab
::
Access
::
MAINTAINER
)
}
...
...
@@ -26,7 +30,7 @@ module ProtectedRefAccess
scope
:for_group
,
->
{
where
.
not
(
group_id:
nil
)
}
validates
:access_level
,
presence:
true
,
if: :role?
,
inclusion:
{
in:
ALLOWED_ACCESS_LEVELS
in:
self
.
allowed_access_levels
}
end
...
...
doc/api/protected_branches.md
View file @
b3cd850c
...
...
@@ -4,7 +4,7 @@
**Valid access levels**
The access levels are defined in the
`ProtectedRefAccess
::ALLOWED_ACCESS_LEVELS`
constant
. Currently, these levels are recognized:
The access levels are defined in the
`ProtectedRefAccess
.allowed_access_levels`
method
. Currently, these levels are recognized:
```
0 => No access
30 => Developer access
...
...
lib/api/protected_branches.rb
View file @
b3cd850c
...
...
@@ -44,10 +44,10 @@ module API
params
do
requires
:name
,
type:
String
,
desc:
'The name of the protected branch'
optional
:push_access_level
,
type:
Integer
,
values:
Protected
RefAccess
::
ALLOWED_ACCESS_LEVELS
,
values:
Protected
Branch
::
PushAccessLevel
.
allowed_access_levels
,
desc:
'Access levels allowed to push (defaults: `40`, maintainer access level)'
optional
:merge_access_level
,
type:
Integer
,
values:
Protected
RefAccess
::
ALLOWED_ACCESS_LEVELS
,
values:
Protected
Branch
::
MergeAccessLevel
.
allowed_access_levels
,
desc:
'Access levels allowed to merge (defaults: `40`, maintainer access level)'
end
# rubocop: disable CodeReuse/ActiveRecord
...
...
lib/api/protected_tags.rb
View file @
b3cd850c
...
...
@@ -47,7 +47,7 @@ module API
params
do
requires
:name
,
type:
String
,
desc:
'The name of the protected tag'
optional
:create_access_level
,
type:
Integer
,
default:
Gitlab
::
Access
::
MAINTAINER
,
values:
Protected
RefAccess
::
ALLOWED_ACCESS_LEVELS
,
values:
Protected
Tag
::
CreateAccessLevel
.
allowed_access_levels
,
desc:
'Access levels allowed to create (defaults: `40`, maintainer access level)'
end
post
':id/protected_tags'
do
...
...
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