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
01fd0f78
Commit
01fd0f78
authored
Dec 06, 2020
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Deploy Keys on prot branches FF in GitAccess
parent
20837751
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
app/models/protected_branch/push_access_level.rb
app/models/protected_branch/push_access_level.rb
+1
-2
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+8
-2
No files found.
app/models/protected_branch/push_access_level.rb
View file @
01fd0f78
...
@@ -37,7 +37,6 @@ class ProtectedBranch::PushAccessLevel < ApplicationRecord
...
@@ -37,7 +37,6 @@ class ProtectedBranch::PushAccessLevel < ApplicationRecord
end
end
def
enabled_deploy_key_for_user?
(
deploy_key
,
user
)
def
enabled_deploy_key_for_user?
(
deploy_key
,
user
)
DeployKey
.
with_write_access_for_project
(
protected_branch
.
project
,
deploy_key:
deploy_key
).
any?
&&
deploy_key
.
user_id
==
user
.
id
&&
DeployKey
.
with_write_access_for_project
(
protected_branch
.
project
,
deploy_key:
deploy_key
).
any?
deploy_key
.
user_id
==
user
.
id
end
end
end
end
lib/gitlab/git_access.rb
View file @
01fd0f78
...
@@ -319,8 +319,10 @@ module Gitlab
...
@@ -319,8 +319,10 @@ module Gitlab
end
end
def
check_change_access!
def
check_change_access!
return
if
deploy_key?
&&
!
deploy_keys_on_protected_branches_enabled?
if
changes
==
ANY
if
changes
==
ANY
can_push
=
deploy_key?
||
can_push
=
(
deploy_key?
&&
deploy_keys_on_protected_branches_enabled?
)
||
user_can_push?
||
user_can_push?
||
project
&
.
any_branch_allows_collaboration?
(
user_access
.
user
)
project
&
.
any_branch_allows_collaboration?
(
user_access
.
user
)
...
@@ -447,7 +449,7 @@ module Gitlab
...
@@ -447,7 +449,7 @@ module Gitlab
CiAccess
.
new
CiAccess
.
new
elsif
user
&&
request_from_ci_build?
elsif
user
&&
request_from_ci_build?
BuildAccess
.
new
(
user
,
container:
container
)
BuildAccess
.
new
(
user
,
container:
container
)
elsif
deploy_key?
elsif
deploy_key?
&&
deploy_keys_on_protected_branches_enabled?
DeployKeyAccess
.
new
(
deploy_key
,
container:
container
)
DeployKeyAccess
.
new
(
deploy_key
,
container:
container
)
else
else
UserAccess
.
new
(
user
,
container:
container
)
UserAccess
.
new
(
user
,
container:
container
)
...
@@ -526,6 +528,10 @@ module Gitlab
...
@@ -526,6 +528,10 @@ module Gitlab
def
size_checker
def
size_checker
container
.
repository_size_checker
container
.
repository_size_checker
end
end
def
deploy_keys_on_protected_branches_enabled?
Feature
.
enabled?
(
:deploy_keys_on_protected_branches
,
project
)
end
end
end
end
end
...
...
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