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
Jérome Perrin
gitlab-ce
Commits
336b818b
Commit
336b818b
authored
Feb 10, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added access spec tests
Also created changelog and removed redundant code
parent
c4f09f23
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
24 deletions
+45
-24
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+2
-0
app/controllers/projects/protected_branches_controller.rb
app/controllers/projects/protected_branches_controller.rb
+0
-17
app/controllers/projects/settings/repository_controller.rb
app/controllers/projects/settings/repository_controller.rb
+1
-1
app/helpers/repository_helper.rb
app/helpers/repository_helper.rb
+8
-4
app/views/projects/protected_branches/_index.html.haml
app/views/projects/protected_branches/_index.html.haml
+1
-2
changelogs/unreleased/26732-combine-deploy-keys-and-push-rules-and-mirror-repository-and-protect-branches-settings-pages.yml
...mirror-repository-and-protect-branches-settings-pages.yml
+5
-0
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+14
-0
spec/features/security/project/public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+14
-0
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
336b818b
...
...
@@ -761,6 +761,8 @@ pre.light-well {
}
.protected-branches-list
{
margin-bottom
:
30px
;
a
{
color
:
$gl-text-color
;
...
...
app/controllers/projects/protected_branches_controller.rb
View file @
336b818b
class
Projects::ProtectedBranchesController
<
Projects
::
ApplicationController
include
RepositoryHelper
# Authorize
before_action
:require_non_empty_project
before_action
:authorize_admin_project!
...
...
@@ -61,20 +60,4 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
def
load_protected_branches
@protected_branches
=
@project
.
protected_branches
.
order
(
:name
).
page
(
params
[
:page
])
end
def
access_levels_options
{
push_access_levels:
{
"Roles"
=>
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
},
},
merge_access_levels:
{
"Roles"
=>
ProtectedBranch
::
MergeAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
}
}
}
end
def
load_gon_index
params
=
{
open_branches:
@project
.
open_branches
.
map
{
|
br
|
{
text:
br
.
name
,
id:
br
.
name
,
title:
br
.
name
}
}
}
gon
.
push
(
params
.
merge
(
access_levels_options
))
end
end
app/controllers/projects/settings/repository_controller.rb
View file @
336b818b
...
...
@@ -21,7 +21,7 @@ module Projects
def
define_protected_branches_controller
@protected_branch
=
@project
.
protected_branches
.
new
load_gon_index
(
@project
)
load_gon_index
end
end
end
...
...
app/helpers/repository_helper.rb
View file @
336b818b
module
RepositoryHelper
def
access_levels_options
{
push_access_levels:
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
},
merge_access_levels:
ProtectedBranch
::
MergeAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
}
push_access_levels:
{
"Roles"
=>
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
},
},
merge_access_levels:
{
"Roles"
=>
ProtectedBranch
::
MergeAccessLevel
.
human_access_levels
.
map
{
|
id
,
text
|
{
id:
id
,
text:
text
,
before_divider:
true
}
}
}
}
end
def
load_gon_index
(
project
)
params
=
{
open_branches:
project
.
open_branches
.
map
{
|
br
|
{
text:
br
.
name
,
id:
br
.
name
,
title:
br
.
name
}
}
}
def
load_gon_index
params
=
{
open_branches:
@
project
.
open_branches
.
map
{
|
br
|
{
text:
br
.
name
,
id:
br
.
name
,
title:
br
.
name
}
}
}
gon
.
push
(
params
.
merge
(
access_levels_options
))
end
end
app/views/projects/protected_branches/_index.html.haml
View file @
336b818b
-
page_title
"Protected branches"
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'protected_branches'
)
.row.prepend-top-default.append-bottom-default
.col-lg-3
%h4
.prepend-top-0
=
page_title
Protected Branches
%p
Keep stable branches secure and force developers to use merge requests.
%p
.prepend-top-20
By default, protected branches are designed to:
...
...
changelogs/unreleased/26732-combine-deploy-keys-and-push-rules-and-mirror-repository-and-protect-branches-settings-pages.yml
0 → 100644
View file @
336b818b
---
title
:
Combined deploy keys and push rules settings options into a single one called
Repository
merge_request
:
author
:
spec/features/security/project/internal_access_spec.rb
View file @
336b818b
...
...
@@ -110,6 +110,20 @@ describe "Internal Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
end
describe
"GET /:project_path/settings/repository"
do
subject
{
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
end
describe
"GET /:project_path/blob"
do
let
(
:commit
)
{
project
.
repository
.
commit
}
subject
{
namespace_project_blob_path
(
project
.
namespace
,
project
,
File
.
join
(
commit
.
id
,
'.gitignore'
))
}
...
...
spec/features/security/project/public_access_spec.rb
View file @
336b818b
...
...
@@ -110,6 +110,20 @@ describe "Public Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
end
describe
"GET /:project_path/settings/repository"
do
subject
{
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
end
describe
"GET /:project_path/pipelines"
do
subject
{
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
...
...
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