19070: Still trying to fix test_with_arvbox
[arvados.git] / doc / admin / collection-managed-properties.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: Configuring collection's managed properties
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 Collection's managed properties allow a cluster administrator to enable some special behaviors regarding properties at creation & update times.
14 This page describes how to enable and configure these behaviors on the API server.
15
16 h3. API Server configuration
17
18 The @Collections.ManagedProperties@ setting from the @config.yml@ file is used for enabling any of the following behaviors:
19
20 h4. Pre-assigned property key & value
21
22 For every newly created collection, assign a predefined key/value pair if it isn't already passed at creation time:
23
24 <pre>
25 Collections:
26   ManagedProperties:
27     foo: {Value: bar}
28 </pre>
29
30 h4. Original owner UUID
31
32 This behavior will assign to a property key the UUID of the user who owns the collection's contaning project.
33
34 <pre>
35 Collections:
36   ManagedProperties:
37     responsible_person_uuid: {Function: original_owner}
38 </pre>
39
40 h4. Protected properties
41
42 If there's a need to prevent a non-admin user from modifying a specific property, even by its owner, the @Protected@ attribute can be set to @true@, like so:
43
44 <pre>
45 Collections:
46   ManagedProperties:
47     sample_id: {Protected: true}
48 </pre>
49
50 This configuration won't assign a @sample_id@ property on collection creation, but if the user adds it to any collection, its value is protected from that point on.
51
52 Another use case would be to protect properties that were automatically assigned by the system:
53
54 <pre>
55 Collections:
56   ManagedProperties:
57     responsible_person_uuid: {Function: original_owner, Protected: true}
58 </pre>
59
60 If missing, the @Protected@ attribute it’s assumed as being @false@ by default.
61
62 h3. Supporting example scripts
63
64 When enabling this feature, there may be pre-existing collections that won't have the managed properties just configured. The following script examples may be helpful to sync these older collections.
65
66 For the following examples we assume that the @responsible_person_uuid@ property is set as @{Function: original_owner, Protected: true}@.
67
68 h4. List uuid/names of collections without @responsible_person_uuid@ property
69
70 The collection's managed properties feature assigns the configured properties to newly created collections. This means that previously existing collections won't get the default properties and if needed, they should be assigned manually.
71
72 The following example script outputs a listing of collection UUIDs and names of those collections that don't include the @responsible_person_uuid@ property.
73
74 {% codeblock as python %}
75 {% include 'admin_list_collections_without_property_py' %}
76 {% endcodeblock %}
77
78 h4. Update the @responsible_person_uuid@ property from nil to X in the project hierarchy rooted at P
79
80 When enabling @responsible_person_uuid@, new collections will get this property's value set to the user who owns the root project where the collection is placed, but older collections won't have the property set. The following example script allows an administrator to set the @responsible_person_uuid@ property to collections below a certaing project hierarchy.
81
82 {% codeblock as python %}
83 {% include 'admin_set_property_to_collections_under_project_py' %}
84 {% endcodeblock %}
85
86 h4. Update the @responsible_person_uuid@ property from X to Y on all collections
87
88 This example can be useful to change responsibility from one user to another.
89
90 Please note that the following code should run with admin privileges, assuming that the managed property is @Protected@.
91
92 {% codeblock as python %}
93 {% include 'admin_update_collection_property_py' %}
94 {% endcodeblock %}
95