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
Boxiang Sun
gitlab-ce
Commits
0e78c2e9
Commit
0e78c2e9
authored
Mar 27, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow group owner to enable runners from subgroups (#41981)
parent
86ca1a77
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
+32
-5
app/models/user.rb
app/models/user.rb
+12
-5
changelogs/unreleased/41981-allow-group-owner-to-enable-runners-from-subgroups.yml
...81-allow-group-owner-to-enable-runners-from-subgroups.yml
+5
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+15
-0
No files found.
app/models/user.rb
View file @
0e78c2e9
...
...
@@ -955,6 +955,10 @@ class User < ActiveRecord::Base
Gitlab
::
GroupHierarchy
.
new
(
owned_and_master_groups
).
base_and_descendants
end
def
manageable_group_projects
Project
.
where
(
namespace:
manageable_groups
)
end
def
namespaces
namespace_ids
=
groups
.
pluck
(
:id
)
namespace_ids
.
push
(
namespace
.
id
)
...
...
@@ -1205,12 +1209,15 @@ class User < ActiveRecord::Base
end
def
ci_projects_union
scope
=
{
access_level:
[
Gitlab
::
Access
::
MASTER
,
Gitlab
::
Access
::
OWNER
]
}
groups
=
groups_projects
.
where
(
members:
scope
)
other
=
projects
.
where
(
members:
scope
)
manageable_other_projects
=
projects
.
where
(
members:
{
access_level:
[
Gitlab
::
Access
::
MASTER
,
Gitlab
::
Access
::
OWNER
]
}
)
Gitlab
::
SQL
::
Union
.
new
([
personal_projects
.
select
(
:id
),
groups
.
select
(
:id
),
other
.
select
(
:id
)])
Gitlab
::
SQL
::
Union
.
new
([
manageable_group_projects
.
select
(
:id
),
personal_projects
.
select
(
:id
),
manageable_other_projects
.
select
(
:id
)
])
end
# Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration
...
...
changelogs/unreleased/41981-allow-group-owner-to-enable-runners-from-subgroups.yml
0 → 100644
View file @
0e78c2e9
---
title
:
'
Allow
group
owner
to
enable
runners
from
subgroups
(#41981)'
merge_request
:
18009
author
:
type
:
fixed
spec/models/user_spec.rb
View file @
0e78c2e9
...
...
@@ -1850,6 +1850,21 @@ describe User do
it_behaves_like
:member
end
context
'with subgroup with different owner for project runner'
,
:nested_groups
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:another_user
)
{
create
(
:user
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:project
)
{
create
(
:project
,
group:
subgroup
)
}
def
add_user
(
access
)
group
.
add_user
(
user
,
access
)
group
.
add_user
(
another_user
,
:owner
)
subgroup
.
add_user
(
another_user
,
:owner
)
end
it_behaves_like
:member
end
end
describe
'#projects_with_reporter_access_limited_to'
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