4 title: Group management
8 Copyright (C) The Arvados Authors. All rights reserved.
10 SPDX-License-Identifier: CC-BY-SA-3.0
13 This page describes how to manage groups at the command line. You should be familiar with the "permission system":{{site.baseurl}}/api/permission-model.html .
17 User groups are entries in the "groups" table with @"group_class": "role"@.
20 arv group create --group '{"name": "My new group", "group_class": "role"}'
23 h2(#add). Add a user to a group
25 There are two separate permissions associated with group membership. The first link grants the user @can_manage@ permission to manage things that the group can manage. The second link grants permission for other users of the group to see that this user is part of the group.
28 arv link create --link '{
29 "link_class": "permission",
31 "tail_uuid": "the_user_uuid",
32 "head_uuid": "the_group_uuid"}'
34 arv link create --link '{
35 "link_class": "permission",
37 "tail_uuid": "the_group_uuid",
38 "head_uuid": "the_user_uuid"}'
41 A user can also be given read-only access to a group. In that case, the first link should be created with @can_read@ instead of @can_manage@.
46 arv group list --filters '[["group_class", "=", "role"]]'
49 h2. List members of a group
51 Use the command "jq":https://stedolan.github.io/jq/ to extract the tail_uuid of each permission link which has the user uuid.
54 arv link list --filters '[["link_class", "=", "permission"],
55 ["head_uuid", "=", "the_group_uuid"]]' | jq .items[].tail_uuid
58 h2. Share a project with a group
60 This will give all members of the group @can_manage@ access.
63 arv link create --link '{
64 "link_class": "permission",
66 "tail_uuid": "the_group_uuid",
67 "head_uuid": "the_project_uuid"}'
70 A project can also be shared read-only. In that case, the first link should be created with @can_read@ instead of @can_manage@.
72 h2. List things shared with the group
74 Use the command "jq":https://stedolan.github.io/jq/ to extract the head_uuid of each permission link which has the object uuid.
77 arv link list --filters '[["link_class", "=", "permission"],
78 ["tail_uuid", "=", "the_group_uuid"]]' | jq .items[].head_uuid
81 h2. Stop sharing a project with a group
83 This will remove access for members of the group.
85 The first step is to find the permission link objects. The second step is to delete them.
88 arv --format=uuid link list --filters '[["link_class", "=", "permission"],
89 ["tail_uuid", "=", "the_group_uuid"], ["head_uuid", "=", "the_project_uuid"]]'
91 arv link delete --uuid each_link_uuid
94 h2. Remove user from a group
96 The first step is to find the permission link objects. The second step is to delete them.
99 arv --format=uuid link list --filters '[["link_class", "=", "permission"],
100 ["tail_uuid", "in", ["the_user_uuid", "the_group_uuid"]],
101 ["head_uuid", "in", ["the_user_uuid", "the_group_uuid"]]'
103 arv link delete --uuid each_link_uuid