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
05f5212d
Commit
05f5212d
authored
Dec 09, 2019
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include read_group_timelogs policy in projects
parent
c895dc26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletion
+65
-1
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+7
-0
ee/app/policies/timelog_policy.rb
ee/app/policies/timelog_policy.rb
+0
-1
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+58
-0
No files found.
ee/app/policies/ee/project_policy.rb
View file @
05f5212d
...
...
@@ -95,6 +95,10 @@ module EE
!
@subject
.
design_management_enabled?
end
condition
(
:group_timelogs_available
)
do
@subject
.
feature_available?
(
:group_timelogs
)
end
rule
{
admin
}.
enable
:change_repository_storage
rule
{
support_bot
}.
enable
:guest_access
...
...
@@ -120,6 +124,8 @@ module EE
prevent
:admin_issue_link
end
rule
{
~
group_timelogs_available
}.
prevent
:read_group_timelogs
rule
{
can?
(
:read_issue
)
}.
policy
do
enable
:read_issue_link
enable
:read_design
...
...
@@ -131,6 +137,7 @@ module EE
enable
:admin_issue_link
enable
:admin_epic_issue
enable
:read_package
enable
:read_group_timelogs
end
rule
{
can?
(
:developer_access
)
}.
policy
do
...
...
ee/app/policies/timelog_policy.rb
View file @
05f5212d
# frozen_string_literal: true
class
TimelogPolicy
<
BasePolicy
delegate
{
@subject
.
issuable
.
resource_parent
.
group
}
delegate
{
@subject
.
issuable
.
resource_parent
}
end
ee/spec/policies/project_policy_spec.rb
View file @
05f5212d
...
...
@@ -1102,4 +1102,62 @@ describe ProjectPolicy do
it
{
is_expected
.
to
be_allowed
(
:read_reject_unsigned_commits
)
}
end
end
context
'when timelogs report feature is enabled'
do
before
do
stub_licensed_features
(
group_timelogs:
true
)
end
context
'admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
be_allowed
(
:read_group_timelogs
)
}
end
context
'with owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
be_allowed
(
:read_group_timelogs
)
}
end
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:read_group_timelogs
)
}
end
context
'with reporter'
do
let
(
:current_user
)
{
reporter
}
it
{
is_expected
.
to
be_allowed
(
:read_group_timelogs
)
}
end
context
'with guest'
do
let
(
:current_user
)
{
guest
}
it
{
is_expected
.
to
be_disallowed
(
:read_group_timelogs
)
}
end
context
'with non member'
do
let
(
:current_user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
be_disallowed
(
:read_group_timelogs
)
}
end
context
'with anonymous'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_disallowed
(
:read_group_timelogs
)
}
end
end
context
'when timelogs report feature is disabled'
do
let
(
:current_user
)
{
admin
}
before
do
stub_licensed_features
(
group_timelogs:
false
)
end
it
{
is_expected
.
to
be_disallowed
(
:read_group_timelogs
)
}
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