debian-mirror-gitlab/doc/user/group/subgroups/index.md

200 lines
8.2 KiB
Markdown
Raw Normal View History

2019-09-04 21:01:54 +05:30
---
2021-04-17 20:07:23 +05:30
stage: Manage
2022-03-02 08:16:31 +05:30
group: Authentication & Authorization
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2019-09-04 21:01:54 +05:30
type: reference, howto, concepts
---
2021-12-11 22:18:48 +05:30
# Subgroups **(FREE)**
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/2772) in GitLab 9.0.
2017-08-17 22:00:37 +05:30
2020-04-08 14:13:33 +05:30
GitLab supports up to 20 levels of subgroups, also known as nested groups or hierarchical groups.
2019-09-04 21:01:54 +05:30
By using subgroups you can do the following:
2017-08-17 22:00:37 +05:30
- **Separate internal / external organizations.** Since every group
2020-10-24 23:57:45 +05:30
can have its own visibility level ([public, internal, or private](../../../development/permissions.md#general-permissions)),
you're able to host groups for different purposes under the same umbrella.
2017-08-17 22:00:37 +05:30
- **Organize large projects.** For large projects, subgroups makes it
potentially easier to separate permissions on parts of the source code.
- **Make it easier to manage people and control visibility.** Give people
2019-07-07 11:18:12 +05:30
different [permissions](../../permissions.md#group-members-permissions) depending on their group [membership](#membership).
2017-08-17 22:00:37 +05:30
2020-07-28 23:09:34 +05:30
For more information on allowed permissions in groups and projects, see
[visibility levels](../../../development/permissions.md#general-permissions).
2017-08-17 22:00:37 +05:30
## Overview
A group can have many subgroups inside it, and at the same time a group can have
2020-07-28 23:09:34 +05:30
only one immediate parent group. It resembles a directory behavior or a nested items list:
2017-08-17 22:00:37 +05:30
- Group 1
- Group 1.1
- Group 1.2
2019-10-12 21:52:04 +05:30
- Group 1.2.1
- Group 1.2.2
- Group 1.2.2.1
2017-08-17 22:00:37 +05:30
In a real world example, imagine maintaining a GNU/Linux distribution with the
2019-09-04 21:01:54 +05:30
first group being the name of the distribution, and subsequent groups split as follows:
2017-08-17 22:00:37 +05:30
- Organization Group - GNU/Linux distro
- Category Subgroup - Packages
2019-10-12 21:52:04 +05:30
- (project) Package01
- (project) Package02
2017-08-17 22:00:37 +05:30
- Category Subgroup - Software
2019-10-12 21:52:04 +05:30
- (project) Core
- (project) CLI
- (project) Android app
- (project) iOS app
2017-08-17 22:00:37 +05:30
- Category Subgroup - Infra tools
2019-10-12 21:52:04 +05:30
- (project) Ansible playbooks
2017-08-17 22:00:37 +05:30
Another example of GitLab as a company would be the following:
- Organization Group - GitLab
2018-10-15 14:42:47 +05:30
- Category Subgroup - Marketing
2019-10-12 21:52:04 +05:30
- (project) Design
- (project) General
2017-08-17 22:00:37 +05:30
- Category Subgroup - Software
2019-10-12 21:52:04 +05:30
- (project) GitLab CE
- (project) GitLab EE
- (project) Omnibus GitLab
- (project) GitLab Runner
- (project) GitLab Pages daemon
2017-08-17 22:00:37 +05:30
- Category Subgroup - Infra tools
2019-10-12 21:52:04 +05:30
- (project) Chef cookbooks
2017-08-17 22:00:37 +05:30
- Category Subgroup - Executive team
2019-12-21 20:55:43 +05:30
When performing actions such as transferring or importing a project between
subgroups, the behavior is the same as when performing these actions at the
`group/project` level.
2017-08-17 22:00:37 +05:30
## Creating a subgroup
2021-11-18 22:05:49 +05:30
Users can create subgroups if they are explicitly added as an Owner (or
Maintainer, if that setting is enabled) to an immediate parent group, even if group
creation is disabled by an administrator in their settings.
To create a subgroup:
1. On the top bar, select **Menu > Groups** and find the parent group.
1. In the top right, select **New subgroup**.
1. Select **Create group**.
1. Fill in the fields. View a list of [reserved names](../../reserved_names.md)
that cannot be used as group names.
1. Select **Create group**.
### Change who can create subgroups
2019-10-12 21:52:04 +05:30
To create a subgroup you must either be an Owner or a Maintainer of the
group, depending on the group's setting.
2021-11-18 22:05:49 +05:30
By default:
2019-10-12 21:52:04 +05:30
2021-11-18 22:05:49 +05:30
- In GitLab 12.2 or later, both Owners and Maintainers can create subgroups.
- In GitLab 12.1 or earlier, only Owners can create subgroups.
2019-10-12 21:52:04 +05:30
2021-11-18 22:05:49 +05:30
You can change this setting:
2021-01-29 00:20:46 +05:30
2021-11-18 22:05:49 +05:30
- As group owner:
2021-09-04 01:27:46 +05:30
1. Select the group.
1. On the left sidebar, select **Settings > General**.
2022-03-02 08:16:31 +05:30
1. Expand **Permissions and group features**.
2021-11-18 22:05:49 +05:30
- As an administrator:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin**.
2021-09-04 01:27:46 +05:30
1. On the left sidebar, select **Overview > Groups**.
1. Select the group, and select **Edit**.
2021-11-18 22:05:49 +05:30
For more information, view the [permissions table](../../permissions.md#group-members-permissions).
2017-08-17 22:00:37 +05:30
## Membership
2021-02-22 17:27:13 +05:30
When you add a member to a group, that member is also added to all subgroups.
2021-04-29 21:17:54 +05:30
Permission level is inherited from the group's parent. This model allows access to
2021-02-22 17:27:13 +05:30
subgroups if you have membership in one of its parents.
2017-08-17 22:00:37 +05:30
2021-09-30 23:02:18 +05:30
Jobs for pipelines in subgroups can use [runners](../../../ci/runners/index.md) registered to the parent group(s).
2020-07-28 23:09:34 +05:30
This means secrets configured for the parent group are available to subgroup jobs.
2019-12-21 20:55:43 +05:30
2020-11-24 15:15:51 +05:30
In addition, maintainers of projects that belong to subgroups can see the details of runners registered to parent group(s).
2019-12-21 20:55:43 +05:30
2019-09-04 21:01:54 +05:30
The group permissions for a member can be changed only by Owners, and only on
2017-08-17 22:00:37 +05:30
the **Members** page of the group the member was added.
You can tell if a member has inherited the permissions from a parent group by
looking at the group's **Members** page.
2021-11-18 22:05:49 +05:30
![Group members page](img/group_members_v14_4.png)
2017-08-17 22:00:37 +05:30
2019-09-04 21:01:54 +05:30
From the image above, we can deduce the following things:
2017-08-17 22:00:37 +05:30
2019-09-04 21:01:54 +05:30
- There are 5 members that have access to the group `four`.
2021-02-22 17:27:13 +05:30
- User 0 is a Reporter and has inherited their permissions from group `one`
2019-09-04 21:01:54 +05:30
which is above the hierarchy of group `four`.
2021-02-22 17:27:13 +05:30
- User 1 is a Developer and has inherited their permissions from group
2019-09-04 21:01:54 +05:30
`one/two` which is above the hierarchy of group `four`.
2021-02-22 17:27:13 +05:30
- User 2 is a Developer and has inherited their permissions from group
2019-09-04 21:01:54 +05:30
`one/two/three` which is above the hierarchy of group `four`.
2021-02-22 17:27:13 +05:30
- For User 3 the **Source** column indicates **Direct member**, therefore they belong to
2019-09-04 21:01:54 +05:30
group `four`, the one we're inspecting.
2017-08-17 22:00:37 +05:30
- Administrator is the Owner and member of **all** subgroups and for that reason,
2021-02-22 17:27:13 +05:30
as with User 3, the **Source** column indicates **Direct member**.
2017-08-17 22:00:37 +05:30
2021-04-17 20:07:23 +05:30
Members can be [filtered by inherited or direct membership](../index.md#filter-a-group).
2020-01-01 13:55:28 +05:30
2017-08-17 22:00:37 +05:30
### Overriding the ancestor group membership
2021-02-22 17:27:13 +05:30
NOTE:
2019-09-04 21:01:54 +05:30
You must be an Owner of a group to be able to add members to it.
2017-08-17 22:00:37 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2018-12-05 23:21:45 +05:30
A user's permissions in a subgroup cannot be lower than in any of its ancestor groups.
Therefore, you cannot reduce a user's permissions in a subgroup with respect to its ancestor groups.
2017-08-17 22:00:37 +05:30
To override a user's membership of an ancestor group (the first group they were
2018-12-05 23:21:45 +05:30
added to), add the user to the new subgroup again with a higher set of permissions.
2017-08-17 22:00:37 +05:30
2021-02-22 17:27:13 +05:30
For example, if User 1 was first added to group `one/two` with Developer
permissions, then they inherit those permissions in every other subgroup
2021-09-04 01:27:46 +05:30
of `one/two`. To give them the [Maintainer role](../../permissions.md) for group `one/two/three/four`,
2018-11-08 19:23:39 +05:30
you would add them again in that group as Maintainer. Removing them from that group,
2021-02-22 17:27:13 +05:30
the permissions fall back to those of the ancestor group.
2017-08-17 22:00:37 +05:30
## Mentioning subgroups
Mentioning groups (`@group`) in issues, commits and merge requests, would
2019-09-04 21:01:54 +05:30
notify all members of that group. Now with subgroups, there is more granular
2017-08-17 22:00:37 +05:30
support if you want to split your group's structure. Mentioning works as before
and you can choose the group of people to be notified.
![Mentioning subgroups](img/mention_subgroups.png)
## Limitations
Here's a list of what you can't do with subgroups:
2019-03-02 22:35:43 +05:30
- [GitLab Pages](../../project/pages/index.md) supports projects hosted under
a subgroup, but not subgroup websites.
That means that only the highest-level group supports
2019-12-26 22:10:19 +05:30
[group websites](../../project/pages/getting_started_part_one.md#gitlab-pages-default-domain-names),
2019-03-02 22:35:43 +05:30
although you can have project websites under a subgroup.
2017-08-17 22:00:37 +05:30
- It is not possible to share a project with a group that's an ancestor of
the group the project is in. That means you can only share as you walk down
the hierarchy. For example, `group/subgroup01/project` **cannot** be shared
with `group`, but can be shared with `group/subgroup02` or
`group/subgroup01/subgroup03`.
2019-09-04 21:01:54 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->