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
dfe5c6e2
Commit
dfe5c6e2
authored
Jan 11, 2022
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
42620353
3709b852
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
247 additions
and
216 deletions
+247
-216
app/assets/javascripts/diffs/components/image_diff_overlay.vue
...ssets/javascripts/diffs/components/image_diff_overlay.vue
+8
-8
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+12
-0
app/controllers/groups/runners_controller.rb
app/controllers/groups/runners_controller.rb
+3
-4
app/finders/ci/runners_finder.rb
app/finders/ci/runners_finder.rb
+1
-1
app/policies/group_policy.rb
app/policies/group_policy.rb
+4
-5
app/views/projects/runners/_group_runners.html.haml
app/views/projects/runners/_group_runners.html.haml
+2
-2
doc/user/permissions.md
doc/user/permissions.md
+163
-162
lib/sidebars/groups/menus/ci_cd_menu.rb
lib/sidebars/groups/menus/ci_cd_menu.rb
+1
-3
locale/gitlab.pot
locale/gitlab.pot
+4
-4
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+21
-4
spec/frontend/diffs/components/image_diff_overlay_spec.js
spec/frontend/diffs/components/image_diff_overlay_spec.js
+11
-8
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+3
-3
spec/support/shared_contexts/policies/group_policy_shared_context.rb
...t/shared_contexts/policies/group_policy_shared_context.rb
+14
-12
No files found.
app/assets/javascripts/diffs/components/image_diff_overlay.vue
View file @
dfe5c6e2
...
@@ -4,8 +4,8 @@ import { isArray } from 'lodash';
...
@@ -4,8 +4,8 @@ import { isArray } from 'lodash';
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
imageDiffMixin
from
'
ee_else_ce/diffs/mixins/image_diff
'
;
import
imageDiffMixin
from
'
ee_else_ce/diffs/mixins/image_diff
'
;
function
calcPercent
(
pos
,
size
,
renderedSize
)
{
function
calcPercent
(
pos
,
renderedSize
)
{
return
(
((
pos
/
size
)
*
100
)
/
((
renderedSize
/
size
)
*
100
))
*
100
;
return
(
100
*
pos
)
/
renderedSize
;
}
}
export
default
{
export
default
{
...
@@ -65,8 +65,8 @@ export default {
...
@@ -65,8 +65,8 @@ export default {
...
mapActions
(
'
diffs
'
,
[
'
openDiffFileCommentForm
'
]),
...
mapActions
(
'
diffs
'
,
[
'
openDiffFileCommentForm
'
]),
getImageDimensions
()
{
getImageDimensions
()
{
return
{
return
{
width
:
this
.
$parent
.
width
,
width
:
Math
.
round
(
this
.
$parent
.
width
)
,
height
:
this
.
$parent
.
height
,
height
:
Math
.
round
(
this
.
$parent
.
height
)
,
};
};
},
},
getPositionForObject
(
meta
)
{
getPositionForObject
(
meta
)
{
...
@@ -87,15 +87,15 @@ export default {
...
@@ -87,15 +87,15 @@ export default {
},
},
clickedImage
(
x
,
y
)
{
clickedImage
(
x
,
y
)
{
const
{
width
,
height
}
=
this
.
getImageDimensions
();
const
{
width
,
height
}
=
this
.
getImageDimensions
();
const
xPercent
=
calcPercent
(
x
,
width
,
this
.
renderedWidth
);
const
xPercent
=
calcPercent
(
x
,
this
.
renderedWidth
);
const
yPercent
=
calcPercent
(
y
,
height
,
this
.
renderedHeight
);
const
yPercent
=
calcPercent
(
y
,
this
.
renderedHeight
);
this
.
openDiffFileCommentForm
({
this
.
openDiffFileCommentForm
({
fileHash
:
this
.
fileHash
,
fileHash
:
this
.
fileHash
,
width
,
width
,
height
,
height
,
x
:
width
*
(
xPercent
/
100
),
x
:
Math
.
round
(
width
*
(
xPercent
/
100
)
),
y
:
height
*
(
yPercent
/
100
),
y
:
Math
.
round
(
height
*
(
yPercent
/
100
)
),
xPercent
,
xPercent
,
yPercent
,
yPercent
,
});
});
...
...
app/controllers/groups/application_controller.rb
View file @
dfe5c6e2
...
@@ -37,6 +37,18 @@ class Groups::ApplicationController < ApplicationController
...
@@ -37,6 +37,18 @@ class Groups::ApplicationController < ApplicationController
end
end
end
end
def
authorize_admin_group_runners!
unless
can?
(
current_user
,
:admin_group_runners
,
group
)
render_404
end
end
def
authorize_read_group_runners!
unless
can?
(
current_user
,
:read_group_runners
,
group
)
render_404
end
end
def
authorize_create_deploy_token!
def
authorize_create_deploy_token!
unless
can?
(
current_user
,
:create_deploy_token
,
group
)
unless
can?
(
current_user
,
:create_deploy_token
,
group
)
render_404
render_404
...
...
app/controllers/groups/runners_controller.rb
View file @
dfe5c6e2
# frozen_string_literal: true
# frozen_string_literal: true
class
Groups::RunnersController
<
Groups
::
ApplicationController
class
Groups::RunnersController
<
Groups
::
ApplicationController
# TODO Proper policies, such as `read_group_runners, should be implemented per
before_action
:authorize_read_group_runners!
,
only:
[
:index
,
:show
]
# https://gitlab.com/gitlab-org/gitlab/-/issues/334802
before_action
:authorize_admin_group_runners!
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
]
before_action
:authorize_admin_group!
before_action
:runner_list_group_view_vue_ui_enabled
,
only:
[
:index
]
before_action
:runner_list_group_view_vue_ui_enabled
,
only:
[
:index
]
before_action
:runner
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
,
:show
]
before_action
:runner
,
only:
[
:edit
,
:update
,
:destroy
,
:pause
,
:resume
,
:show
]
...
@@ -17,7 +16,7 @@ class Groups::RunnersController < Groups::ApplicationController
...
@@ -17,7 +16,7 @@ class Groups::RunnersController < Groups::ApplicationController
end
end
def
runner_list_group_view_vue_ui_enabled
def
runner_list_group_view_vue_ui_enabled
re
turn
re
nder_404
unless
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
group
,
default_enabled: :yaml
)
render_404
unless
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
group
,
default_enabled: :yaml
)
end
end
def
show
def
show
...
...
app/finders/ci/runners_finder.rb
View file @
dfe5c6e2
...
@@ -47,7 +47,7 @@ module Ci
...
@@ -47,7 +47,7 @@ module Ci
end
end
def
group_runners
def
group_runners
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:
admin_group
,
@group
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:
read_group_runners
,
@group
)
@runners
=
case
@params
[
:membership
]
@runners
=
case
@params
[
:membership
]
when
:direct
when
:direct
...
...
app/policies/group_policy.rb
View file @
dfe5c6e2
...
@@ -165,7 +165,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
...
@@ -165,7 +165,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:destroy_package
enable
:destroy_package
enable
:create_projects
enable
:create_projects
enable
:admin_pipeline
enable
:admin_pipeline
enable
:admin_group_runners
enable
:admin_build
enable
:admin_build
enable
:read_cluster
enable
:read_cluster
enable
:add_cluster
enable
:add_cluster
...
@@ -183,6 +182,10 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
...
@@ -183,6 +182,10 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:admin_group_member
enable
:admin_group_member
enable
:change_visibility_level
enable
:change_visibility_level
enable
:read_group_runners
enable
:admin_group_runners
enable
:register_group_runners
enable
:set_note_created_at
enable
:set_note_created_at
enable
:set_emails_disabled
enable
:set_emails_disabled
enable
:change_prevent_sharing_groups_outside_hierarchy
enable
:change_prevent_sharing_groups_outside_hierarchy
...
@@ -208,10 +211,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
...
@@ -208,10 +211,6 @@ class GroupPolicy < Namespaces::GroupProjectNamespaceSharedPolicy
enable
:read_nested_project_resources
enable
:read_nested_project_resources
end
end
rule
{
can?
(
:admin_group_runners
)
}.
policy
do
enable
:register_group_runners
end
rule
{
owner
}.
enable
:create_subgroup
rule
{
owner
}.
enable
:create_subgroup
rule
{
maintainer
&
maintainer_can_create_group
}.
enable
:create_subgroup
rule
{
maintainer
&
maintainer_can_create_group
}.
enable
:create_subgroup
...
...
app/views/projects/runners/_group_runners.html.haml
View file @
dfe5c6e2
...
@@ -29,9 +29,9 @@
...
@@ -29,9 +29,9 @@
-
if
can?
(
current_user
,
:admin_group_runners
,
@project
.
group
)
-
if
can?
(
current_user
,
:admin_group_runners
,
@project
.
group
)
-
group_link
=
link_to
_
(
"group's CI/CD settings."
),
group_settings_ci_cd_path
(
@project
.
group
)
-
group_link
=
link_to
_
(
"group's CI/CD settings."
),
group_settings_ci_cd_path
(
@project
.
group
)
=
_
(
'Group
maintai
ners can register group runners in the %{link}'
).
html_safe
%
{
link:
group_link
}
=
_
(
'Group
ow
ners can register group runners in the %{link}'
).
html_safe
%
{
link:
group_link
}
-
else
-
else
=
_
(
'Ask your group
maintai
ner to set up a group runner.'
)
=
_
(
'Ask your group
ow
ner to set up a group runner.'
)
-
else
-
else
%h4
.underlined-title
%h4
.underlined-title
...
...
doc/user/permissions.md
View file @
dfe5c6e2
...
@@ -47,7 +47,7 @@ The following table lists project permissions available for each role:
...
@@ -47,7 +47,7 @@ The following table lists project permissions available for each role:
<!-- Keep this table sorted: By topic first, then by minimum role, then alphabetically. -->
<!-- Keep this table sorted: By topic first, then by minimum role, then alphabetically. -->
| Action | Guest | Reporter | Developer | Maintainer | Owner |
| Action | Guest | Reporter | Developer | Maintainer | Owner |
|-------------------------------------------------------------------------------------------------------------------------|----------|----------|-----------|------------|-------|
|-------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------
|----------|----------|-----------|------------|-------|
|
[
Analytics
](
analytics/index.md
)
:
<br>
View issue analytics
**(PREMIUM)**
| ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Analytics
](
analytics/index.md
)
:
<br>
View issue analytics
**(PREMIUM)**
| ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Analytics
](
analytics/index.md
)
:
<br>
View
[
merge request analytics
](
analytics/merge_request_analytics.md
)
**(PREMIUM)**
| ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Analytics
](
analytics/index.md
)
:
<br>
View
[
merge request analytics
](
analytics/merge_request_analytics.md
)
**(PREMIUM)**
| ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Analytics
](
analytics/index.md
)
:
<br>
View value stream analytics | ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Analytics
](
analytics/index.md
)
:
<br>
View value stream analytics | ✓ | ✓ | ✓ | ✓ | ✓ |
...
@@ -73,7 +73,8 @@ The following table lists project permissions available for each role:
...
@@ -73,7 +73,8 @@ The following table lists project permissions available for each role:
|
[
CI/CD
](
../ci/index.md
)
:
<br>
View a job with
[
debug logging
](
../ci/variables/index.md#debug-logging
)
| | | ✓ | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
View a job with
[
debug logging
](
../ci/variables/index.md#debug-logging
)
| | | ✓ | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage CI/CD variables | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage CI/CD variables | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage job triggers | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage job triggers | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage runners | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage group runners | | | | | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Manage project runners | | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Run Web IDE's Interactive Web Terminals
**(ULTIMATE ONLY)**
| | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Run Web IDE's Interactive Web Terminals
**(ULTIMATE ONLY)**
| | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Use
[
environment terminals
](
../ci/environments/index.md#web-terminals-deprecated
)
| | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Use
[
environment terminals
](
../ci/environments/index.md#web-terminals-deprecated
)
| | | | ✓ | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Delete pipelines | | | | | ✓ |
|
[
CI/CD
](
../ci/index.md
)
:
<br>
Delete pipelines | | | | | ✓ |
...
@@ -94,7 +95,7 @@ The following table lists project permissions available for each role:
...
@@ -94,7 +95,7 @@ The following table lists project permissions available for each role:
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Participate in on-call rotation | ✓| ✓ | ✓ | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Participate in on-call rotation | ✓| ✓ | ✓ | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
View
[
escalation policies
](
../operations/incident_management/escalation_policies.md
)
| | ✓ | ✓ | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
View
[
escalation policies
](
../operations/incident_management/escalation_policies.md
)
| | ✓ | ✓ | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Manage
[
on-call schedules
](
../operations/incident_management/oncall_schedules.md
)
| | | | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Manage
[
on-call schedules
](
../operations/incident_management/oncall_schedules.md
)
| | | | ✓ | ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Manage
[
escalation policies
](
../operations/incident_management/escalation_policies.md
)
| | | | ✓
| ✓ |
|
[
Incident Management
](
../operations/incident_management/index.md
)
:
<br>
Manage
[
escalation policies
](
../operations/incident_management/escalation_policies.md
)
| | | | ✓
| ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Add Labels | ✓ (
*16*
) | ✓ | ✓ | ✓ | ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Add Labels | ✓ (
*16*
) | ✓ | ✓ | ✓ | ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Assign | ✓ (
*16*
) | ✓ | ✓ | ✓ | ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Assign | ✓ (
*16*
) | ✓ | ✓ | ✓ | ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Create | ✓ | ✓ | ✓ | ✓ | ✓ |
|
[
Issues
](
project/issues/index.md
)
:
<br>
Create | ✓ | ✓ | ✓ | ✓ | ✓ |
...
...
lib/sidebars/groups/menus/ci_cd_menu.rb
View file @
dfe5c6e2
...
@@ -34,10 +34,8 @@ module Sidebars
...
@@ -34,10 +34,8 @@ module Sidebars
)
)
end
end
# TODO Proper policies, such as `read_group_runners`, should be implemented per
# See https://gitlab.com/gitlab-org/gitlab/-/issues/334802
def
show_runners?
def
show_runners?
can?
(
context
.
current_user
,
:
admin_group
,
context
.
group
)
&&
can?
(
context
.
current_user
,
:
read_group_runners
,
context
.
group
)
&&
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
context
.
group
,
default_enabled: :yaml
)
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
context
.
group
,
default_enabled: :yaml
)
end
end
end
end
...
...
locale/gitlab.pot
View file @
dfe5c6e2
...
@@ -4793,7 +4793,7 @@ msgstr ""
...
@@ -4793,7 +4793,7 @@ msgstr ""
msgid "Ask someone with write access to resolve it."
msgid "Ask someone with write access to resolve it."
msgstr ""
msgstr ""
msgid "Ask your group
maintai
ner to set up a group runner."
msgid "Ask your group
ow
ner to set up a group runner."
msgstr ""
msgstr ""
msgid "Assertion consumer service URL"
msgid "Assertion consumer service URL"
...
@@ -16754,9 +16754,6 @@ msgstr ""
...
@@ -16754,9 +16754,6 @@ msgstr ""
msgid "Group jobs by"
msgid "Group jobs by"
msgstr ""
msgstr ""
msgid "Group maintainers can register group runners in the %{link}"
msgstr ""
msgid "Group members"
msgid "Group members"
msgstr ""
msgstr ""
...
@@ -16781,6 +16778,9 @@ msgstr ""
...
@@ -16781,6 +16778,9 @@ msgstr ""
msgid "Group overview content"
msgid "Group overview content"
msgstr ""
msgstr ""
msgid "Group owners can register group runners in the %{link}"
msgstr ""
msgid "Group path is already taken. We've suggested one that is available."
msgid "Group path is already taken. We've suggested one that is available."
msgstr ""
msgstr ""
...
...
spec/features/runners_spec.rb
View file @
dfe5c6e2
...
@@ -268,10 +268,27 @@ RSpec.describe 'Runners' do
...
@@ -268,10 +268,27 @@ RSpec.describe 'Runners' do
it
'group runners are not available'
do
it
'group runners are not available'
do
visit
project_runners_path
(
project
)
visit
project_runners_path
(
project
)
expect
(
page
).
not_to
have_content
'Group owners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Ask your group owner to set up a group runner'
end
end
end
context
'as project maintainer and group owner'
do
before
do
group
.
add_owner
(
user
)
end
context
'project with a group but no group runner'
do
let
(
:project
)
{
create
:project
,
group:
group
}
it
'group runners are available'
do
visit
project_runners_path
(
project
)
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'Group
maintai
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Group
ow
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
not_to
have_content
'Ask your group
maintai
ner to set up a group runner'
expect
(
page
).
not_to
have_content
'Ask your group
ow
ner to set up a group runner'
end
end
end
end
end
end
...
@@ -296,8 +313,8 @@ RSpec.describe 'Runners' do
...
@@ -296,8 +313,8 @@ RSpec.describe 'Runners' do
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
to
have_content
'This group does not have any group runners yet.'
expect
(
page
).
not_to
have_content
'Group
maintai
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
not_to
have_content
'Group
ow
ners can register group runners in the group\'s CI/CD settings.'
expect
(
page
).
to
have_content
'Ask your group
maintai
ner to set up a group runner.'
expect
(
page
).
to
have_content
'Ask your group
ow
ner to set up a group runner.'
end
end
end
end
...
...
spec/frontend/diffs/components/image_diff_overlay_spec.js
View file @
dfe5c6e2
...
@@ -6,8 +6,8 @@ import { imageDiffDiscussions } from '../mock_data/diff_discussions';
...
@@ -6,8 +6,8 @@ import { imageDiffDiscussions } from '../mock_data/diff_discussions';
describe
(
'
Diffs image diff overlay component
'
,
()
=>
{
describe
(
'
Diffs image diff overlay component
'
,
()
=>
{
const
dimensions
=
{
const
dimensions
=
{
width
:
100
,
width
:
99.9
,
height
:
200
,
height
:
199.5
,
};
};
let
wrapper
;
let
wrapper
;
let
dispatch
;
let
dispatch
;
...
@@ -38,7 +38,6 @@ describe('Diffs image diff overlay component', () => {
...
@@ -38,7 +38,6 @@ describe('Diffs image diff overlay component', () => {
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
wrapper
=
null
;
});
});
it
(
'
renders comment badges
'
,
()
=>
{
it
(
'
renders comment badges
'
,
()
=>
{
...
@@ -81,17 +80,21 @@ describe('Diffs image diff overlay component', () => {
...
@@ -81,17 +80,21 @@ describe('Diffs image diff overlay component', () => {
it
(
'
dispatches openDiffFileCommentForm when clicking overlay
'
,
()
=>
{
it
(
'
dispatches openDiffFileCommentForm when clicking overlay
'
,
()
=>
{
createComponent
({
canComment
:
true
});
createComponent
({
canComment
:
true
});
wrapper
.
find
(
'
.js-add-image-diff-note-button
'
).
trigger
(
'
click
'
,
{
offsetX
:
0
,
offsetY
:
0
});
wrapper
.
find
(
'
.js-add-image-diff-note-button
'
).
trigger
(
'
click
'
,
{
offsetX
:
1.2
,
offsetY
:
3.8
});
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
diffs/openDiffFileCommentForm
'
,
{
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
diffs/openDiffFileCommentForm
'
,
{
fileHash
:
'
ABC
'
,
fileHash
:
'
ABC
'
,
x
:
0
,
x
:
1
,
y
:
0
,
y
:
4
,
width
:
100
,
width
:
100
,
height
:
200
,
height
:
200
,
xPercent
:
0
,
xPercent
:
expect
.
any
(
Number
)
,
yPercent
:
0
,
yPercent
:
expect
.
any
(
Number
)
,
});
});
const
{
xPercent
,
yPercent
}
=
dispatch
.
mock
.
calls
[
0
][
1
];
expect
(
xPercent
).
toBeCloseTo
(
0.6
);
expect
(
yPercent
).
toBeCloseTo
(
1.9
);
});
});
describe
(
'
toggle discussion
'
,
()
=>
{
describe
(
'
toggle discussion
'
,
()
=>
{
...
...
spec/policies/group_policy_spec.rb
View file @
dfe5c6e2
...
@@ -36,6 +36,7 @@ RSpec.describe GroupPolicy do
...
@@ -36,6 +36,7 @@ RSpec.describe GroupPolicy do
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_group_runners
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
end
end
...
@@ -51,6 +52,7 @@ RSpec.describe GroupPolicy do
...
@@ -51,6 +52,7 @@ RSpec.describe GroupPolicy do
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_organization
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_crm_contact
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_counts
)
}
it
{
expect_disallowed
(
:read_group_runners
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
it
{
expect_disallowed
(
*
read_group_permissions
)
}
end
end
...
@@ -1126,9 +1128,7 @@ RSpec.describe GroupPolicy do
...
@@ -1126,9 +1128,7 @@ RSpec.describe GroupPolicy do
context
'with maintainer'
do
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:register_group_runners
)
}
it
{
is_expected
.
to
be_disallowed
(
:register_group_runners
)
}
it_behaves_like
'expected outcome based on runner registration control'
end
end
context
'with reporter'
do
context
'with reporter'
do
...
...
spec/support/shared_contexts/policies/group_policy_shared_context.rb
View file @
dfe5c6e2
...
@@ -48,22 +48,24 @@ RSpec.shared_context 'GroupPolicy context' do
...
@@ -48,22 +48,24 @@ RSpec.shared_context 'GroupPolicy context' do
destroy_package
destroy_package
create_projects
create_projects
read_cluster create_cluster update_cluster admin_cluster add_cluster
read_cluster create_cluster update_cluster admin_cluster add_cluster
admin_group_runners
]
]
end
end
let
(
:owner_permissions
)
do
let
(
:owner_permissions
)
do
[
%i[
:owner_access
,
owner_access
:admin_group
,
admin_group
:admin_namespace
,
admin_namespace
:admin_group_member
,
admin_group_member
:change_visibility_level
,
change_visibility_level
:set_note_created_at
,
set_note_created_at
:create_subgroup
,
create_subgroup
:read_statistics
,
read_statistics
:update_default_branch_protection
update_default_branch_protection
].
compact
read_group_runners
admin_group_runners
register_group_runners
]
end
end
let
(
:admin_permissions
)
{
%i[read_confidential_issues]
}
let
(
:admin_permissions
)
{
%i[read_confidential_issues]
}
...
...
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