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
39a8fe6f
Commit
39a8fe6f
authored
Feb 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
34a14532
51c919a2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
70 deletions
+60
-70
app/controllers/projects/pages_controller.rb
app/controllers/projects/pages_controller.rb
+2
-1
app/policies/project_policy.rb
app/policies/project_policy.rb
+1
-1
app/views/projects/pages/_destroy.haml
app/views/projects/pages/_destroy.haml
+1
-1
changelogs/unreleased/allow-maintainers-to-remove-pages.yml
changelogs/unreleased/allow-maintainers-to-remove-pages.yml
+5
-0
doc/user/permissions.md
doc/user/permissions.md
+1
-2
spec/controllers/projects/pages_controller_spec.rb
spec/controllers/projects/pages_controller_spec.rb
+12
-0
spec/features/projects/pages_spec.rb
spec/features/projects/pages_spec.rb
+38
-65
No files found.
app/controllers/projects/pages_controller.rb
View file @
39a8fe6f
...
@@ -5,7 +5,8 @@ class Projects::PagesController < Projects::ApplicationController
...
@@ -5,7 +5,8 @@ class Projects::PagesController < Projects::ApplicationController
before_action
:require_pages_enabled!
before_action
:require_pages_enabled!
before_action
:authorize_read_pages!
,
only:
[
:show
]
before_action
:authorize_read_pages!
,
only:
[
:show
]
before_action
:authorize_update_pages!
,
except:
[
:show
]
before_action
:authorize_update_pages!
,
except:
[
:show
,
:destroy
]
before_action
:authorize_remove_pages!
,
only:
[
:destroy
]
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
show
def
show
...
...
app/policies/project_policy.rb
View file @
39a8fe6f
...
@@ -152,7 +152,6 @@ class ProjectPolicy < BasePolicy
...
@@ -152,7 +152,6 @@ class ProjectPolicy < BasePolicy
enable
:remove_fork_project
enable
:remove_fork_project
enable
:destroy_merge_request
enable
:destroy_merge_request
enable
:destroy_issue
enable
:destroy_issue
enable
:remove_pages
enable
:set_issue_iid
enable
:set_issue_iid
enable
:set_issue_created_at
enable
:set_issue_created_at
...
@@ -271,6 +270,7 @@ class ProjectPolicy < BasePolicy
...
@@ -271,6 +270,7 @@ class ProjectPolicy < BasePolicy
enable
:admin_pages
enable
:admin_pages
enable
:read_pages
enable
:read_pages
enable
:update_pages
enable
:update_pages
enable
:remove_pages
enable
:read_cluster
enable
:read_cluster
enable
:add_cluster
enable
:add_cluster
enable
:create_cluster
enable
:create_cluster
...
...
app/views/projects/pages/_destroy.haml
View file @
39a8fe6f
...
@@ -9,4 +9,4 @@
...
@@ -9,4 +9,4 @@
.form-actions
.form-actions
=
link_to
'Remove pages'
,
project_pages_path
(
@project
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove"
=
link_to
'Remove pages'
,
project_pages_path
(
@project
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove"
-
else
-
else
.nothing-here-block
Only
the project owner
can remove pages
.nothing-here-block
Only
project maintainers
can remove pages
changelogs/unreleased/allow-maintainers-to-remove-pages.yml
0 → 100644
View file @
39a8fe6f
---
title
:
Allow maintainers to remove pages
merge_request
:
author
:
type
:
fixed
doc/user/permissions.md
View file @
39a8fe6f
...
@@ -97,7 +97,7 @@ The following table depicts the various user permission levels in a project.
...
@@ -97,7 +97,7 @@ The following table depicts the various user permission levels in a project.
| Manage variables | | | | ✓ | ✓ |
| Manage variables | | | | ✓ | ✓ |
| Manage GitLab Pages | | | | ✓ | ✓ |
| Manage GitLab Pages | | | | ✓ | ✓ |
| Manage GitLab Pages domains and certificates | | | | ✓ | ✓ |
| Manage GitLab Pages domains and certificates | | | | ✓ | ✓ |
| Remove GitLab Pages | | | |
| ✓ |
| Remove GitLab Pages | | | |
✓
| ✓ |
| View GitLab Pages protected by
[
access control
](
project/pages/introduction.md#gitlab-pages-access-control-core-only
)
| ✓ | ✓ | ✓ | ✓ | ✓ |
| View GitLab Pages protected by
[
access control
](
project/pages/introduction.md#gitlab-pages-access-control-core-only
)
| ✓ | ✓ | ✓ | ✓ | ✓ |
| Manage clusters | | | | ✓ | ✓ |
| Manage clusters | | | | ✓ | ✓ |
| Manage license policy
**[ULTIMATE]**
| | | | ✓ | ✓ |
| Manage license policy
**[ULTIMATE]**
| | | | ✓ | ✓ |
...
@@ -107,7 +107,6 @@ The following table depicts the various user permission levels in a project.
...
@@ -107,7 +107,6 @@ The following table depicts the various user permission levels in a project.
| Transfer project to another namespace | | | | | ✓ |
| Transfer project to another namespace | | | | | ✓ |
| Remove project | | | | | ✓ |
| Remove project | | | | | ✓ |
| Delete issues | | | | | ✓ |
| Delete issues | | | | | ✓ |
| Remove pages | | | | | ✓ |
| Force push to protected branches [^4] | | | | | |
| Force push to protected branches [^4] | | | | | |
| Remove protected branches [^4] | | | | | |
| Remove protected branches [^4] | | | | | |
| View project Audit Events | | | | ✓ | ✓ |
| View project Audit Events | | | | ✓ | ✓ |
...
...
spec/controllers/projects/pages_controller_spec.rb
View file @
39a8fe6f
...
@@ -42,6 +42,18 @@ describe Projects::PagesController do
...
@@ -42,6 +42,18 @@ describe Projects::PagesController do
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
end
end
context
'when user is developer'
do
before
do
project
.
add_developer
(
user
)
end
it
'returns 404 status'
do
delete
:destroy
,
params:
request_params
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
end
context
'pages disabled'
do
context
'pages disabled'
do
...
...
spec/features/projects/pages_spec.rb
View file @
39a8fe6f
...
@@ -13,16 +13,6 @@ describe 'Pages' do
...
@@ -13,16 +13,6 @@ describe 'Pages' do
sign_in
(
user
)
sign_in
(
user
)
end
end
shared_examples
'no pages deployed'
do
it
'does not see anything to destroy'
do
visit
project_pages_path
(
project
)
expect
(
page
).
to
have_content
(
'Configure pages'
)
expect
(
page
).
not_to
have_link
(
'Remove pages'
)
expect
(
page
).
not_to
have_text
(
'Only the project owner can remove pages'
)
end
end
context
'when user is the owner'
do
context
'when user is the owner'
do
before
do
before
do
project
.
namespace
.
update
(
owner:
user
)
project
.
namespace
.
update
(
owner:
user
)
...
@@ -181,7 +171,12 @@ describe 'Pages' do
...
@@ -181,7 +171,12 @@ describe 'Pages' do
end
end
end
end
it_behaves_like
'no pages deployed'
it
'does not see anything to destroy'
do
visit
project_pages_path
(
project
)
expect
(
page
).
to
have_content
(
'Configure pages'
)
expect
(
page
).
not_to
have_link
(
'Remove pages'
)
end
describe
'project settings page'
do
describe
'project settings page'
do
it
'renders "Pages" tab'
do
it
'renders "Pages" tab'
do
...
@@ -208,22 +203,6 @@ describe 'Pages' do
...
@@ -208,22 +203,6 @@ describe 'Pages' do
end
end
end
end
context
'when the user is not the owner'
do
context
'when pages deployed'
do
before
do
allow_any_instance_of
(
Project
).
to
receive
(
:pages_deployed?
)
{
true
}
end
it
'sees "Only the project owner can remove pages" text'
do
visit
project_pages_path
(
project
)
expect
(
page
).
to
have_text
(
'Only the project owner can remove pages'
)
end
end
it_behaves_like
'no pages deployed'
end
describe
'HTTPS settings'
,
:js
,
:https_pages_enabled
do
describe
'HTTPS settings'
,
:js
,
:https_pages_enabled
do
before
do
before
do
project
.
namespace
.
update
(
owner:
user
)
project
.
namespace
.
update
(
owner:
user
)
...
@@ -289,13 +268,8 @@ describe 'Pages' do
...
@@ -289,13 +268,8 @@ describe 'Pages' do
end
end
describe
'Remove page'
do
describe
'Remove page'
do
context
'when user is the owner'
do
let
(
:project
)
{
create
:project
,
:repository
}
let
(
:project
)
{
create
:project
,
:repository
}
before
do
project
.
namespace
.
update
(
owner:
user
)
end
context
'when pages are deployed'
do
context
'when pages are deployed'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
commit_sha
=
project
.
commit
(
'HEAD'
).
sha
commit_sha
=
project
.
commit
(
'HEAD'
).
sha
...
@@ -336,5 +310,4 @@ describe 'Pages' do
...
@@ -336,5 +310,4 @@ describe 'Pages' do
end
end
end
end
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