21700: Install Bundler system-wide in Rails postinst
[arvados.git] / doc / admin / group-management.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: Role group management at the CLI
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
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 .
14
15 h2. Create a role group
16
17 User groups are entries in the "groups" table with @"group_class": "role"@.
18
19 <pre>
20 arv group create --group '{"name": "My new group", "group_class": "role"}'
21 </pre>
22
23 h2(#add). Add a user to a role group
24
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.
26
27 <pre>
28 arv link create --link '{
29   "link_class": "permission",
30   "name": "can_manage",
31   "tail_uuid": "the_user_uuid",
32   "head_uuid": "the_group_uuid"}'
33
34 arv link create --link '{
35   "link_class": "permission",
36   "name": "can_read",
37   "tail_uuid": "the_group_uuid",
38   "head_uuid": "the_user_uuid"}'
39 </pre>
40
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@.
42
43 h2. List role groups
44
45 <pre>
46 arv group list --filters '[["group_class", "=", "role"]]'
47 </pre>
48
49 h2. List members of a role group
50
51 Use the command "jq":https://stedolan.github.io/jq/ to extract the tail_uuid of each permission link which has the user uuid.
52
53 <pre>
54 arv link list --filters '[["link_class", "=", "permission"],
55   ["head_uuid", "=", "the_group_uuid"]]' | jq .items[].tail_uuid
56 </pre>
57
58 h2(#share-project). Share a project with a role group
59
60 Members of the role group will have access to the project based on their level of access to the role group.
61
62 <pre>
63 arv link create --link '{
64   "link_class": "permission",
65   "name": "can_manage",
66   "tail_uuid": "the_group_uuid",
67   "head_uuid": "the_project_uuid"}'
68 </pre>
69
70 A project can also be shared read-only.  In that case, the link @name@ should be @can_read@ instead of @can_manage@.
71
72 h2. List things shared with the group
73
74 Use the command "jq":https://stedolan.github.io/jq/ to extract the head_uuid of each permission link which has the object uuid.
75
76 <pre>
77 arv link list --filters '[["link_class", "=", "permission"],
78   ["tail_uuid", "=", "the_group_uuid"]]' | jq .items[].head_uuid
79 </pre>
80
81 h2(#stop-sharing-project). Stop sharing a project with a group
82
83 This will remove access for members of the group.
84
85 The first step is to find the permission link objects.  The second step is to delete them.
86
87 <pre>
88 arv --format=uuid link list --filters '[["link_class", "=", "permission"],
89   ["tail_uuid", "=", "the_group_uuid"], ["head_uuid", "=", "the_project_uuid"]]'
90
91 arv link delete --uuid each_link_uuid
92 </pre>
93
94 h2. Remove user from a role group
95
96 The first step is to find the permission link objects.  The second step is to delete them.
97
98 <pre>
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"]]'
102
103 arv link delete --uuid each_link_uuid
104 </pre>