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
b4293c6c
Commit
b4293c6c
authored
Mar 26, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
54d2990e
8947103f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
2 deletions
+18
-2
app/policies/project_policy.rb
app/policies/project_policy.rb
+1
-0
changelogs/unreleased/fix-hidden-statistics.yml
changelogs/unreleased/fix-hidden-statistics.yml
+5
-0
doc/user/permissions.md
doc/user/permissions.md
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+10
-0
No files found.
app/policies/project_policy.rb
View file @
b4293c6c
...
...
@@ -187,6 +187,7 @@ class ProjectPolicy < BasePolicy
rule
{
can?
(
:reporter_access
)
}.
policy
do
enable
:download_code
enable
:read_statistics
enable
:download_wiki_code
enable
:fork_project
enable
:create_project_snippet
...
...
changelogs/unreleased/fix-hidden-statistics.yml
0 → 100644
View file @
b4293c6c
---
title
:
Show statistics also when repository is disabled
merge_request
:
26509
author
:
Peter Marko
type
:
fixed
doc/user/permissions.md
View file @
b4293c6c
...
...
@@ -119,7 +119,7 @@ The following table depicts the various user permission levels in a project.
| Force push to protected branches [^4] | | | | | |
| Remove protected branches [^4] | | | | | |
| View project Audit Events | | | | ✓ | ✓ |
| View project statistics | |
|
| ✓ | ✓ |
| View project statistics | |
✓ | ✓
| ✓ | ✓ |
## Project features permissions
...
...
lib/api/entities.rb
View file @
b4293c6c
...
...
@@ -275,7 +275,7 @@ module API
expose
:printing_merge_request_link_enabled
expose
:merge_method
expose
:statistics
,
using:
'API::Entities::ProjectStatistics'
,
if:
->
(
project
,
options
)
{
options
[
:statistics
]
&&
Ability
.
allowed?
(
options
[
:current_user
],
:
download_code
,
project
)
options
[
:statistics
]
&&
Ability
.
allowed?
(
options
[
:current_user
],
:
read_statistics
,
project
)
}
# rubocop: disable CodeReuse/ActiveRecord
...
...
spec/requests/api/projects_spec.rb
View file @
b4293c6c
...
...
@@ -1233,6 +1233,16 @@ describe API::Projects do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
include
'statistics'
end
it
"includes statistics also when repository is disabled"
do
project
.
add_developer
(
user
)
project
.
project_feature
.
update_attribute
(
:repository_access_level
,
ProjectFeature
::
DISABLED
)
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
params:
{
statistics:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
include
'statistics'
end
end
it
"includes import_error if user can admin project"
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