# Archive organization

Content, represented as files/folders + metadata lives inside a Data Container (that are like S3 buckets or Azure containers). Data Containers can be grouped in collections or subcollections, creating a way for users to group and organize datasets and content.&#x20;

The user is free to organize the content following any desired structure. Some organizations are partitioning the repository by departments, others are grouping the content by type while others create no partitions at all and use a flat structure.

Further considerations related to preservation are described in [planning-and-using-additional-information-in-labdrive](https://docs.libnova.com/labdrive/data-curation-and-preservation-1/planning-and-using-additional-information-in-labdrive "mention")

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MVkgzRUpOEpdXtS-DjE%2F-MVkoaV1vq_YdvmOTcyQ%2Fimage.png?alt=media\&token=bb367fd9-5f1b-4f0b-bf0e-077dcddd56d1)

These collections or subcollections conform the Archival Structure in the repository:

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0fU5ExlRiTBrF3xM4%2Fimage.png?alt=media\&token=a999d7cb-cc7b-4139-89e3-997df9fbb079)

Every node of the Archival Structure can have Data Containers or other nodes inside.

As access permissions can be defined per each node, it is easy for the user to assign permissions to certain users to everything that is contained in the node.&#x20;

## Creating or changing an Archive Structure

### Using the management interface

1.Go to **Configuration** and then **Archival Structure**

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0hrX_X2VcgI1h84u4%2Fimage.png?alt=media\&token=2c46f022-04f7-445b-a4ef-391bfa6302f3)

2\. Create a new node selecting **Add Node** (1) or edit an existing one with **Edit Node** (2):

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0iXulD7ZgmLwSL9gK%2Fimage.png?alt=media\&token=52484b6f-e6f3-4833-9def-b9256bf7276f)

3\. If you are creating a new node, indicate the **Name** (that will be displayed to the users), the **Code** (handy for the API and for searching, and shown as a prefix for the name, so keep it short) and the **Parent Node**, that will determine in which other node is contained the new node that you are creating. You can select ROOT to keep it as a first-level node, without any parent node. When finished, select **Add**.

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0irgJqijnqU_j8SSf%2Fimage.png?alt=media\&token=292312b0-1343-4d9c-97e4-fddc353b346e)

4\. When the node has been created, the **permissions** section appears below. Here you can select **Inherit Parent Node Permissions** for this node to inherit the same access permissions than the parent node (only available if the node has a parent node) or to define **Custom Permissions**, to be able to indicate them for the present node:

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0k0cKtMiqonpeDZ5k%2Fimage.png?alt=media\&token=4a5377dd-0c29-44d4-ac33-cce835018803)

5\. Select **Add** to add users or groups and then select permissions for them. If you want for the user or group of users to be able to create subnodes inside the node, make sure you select the **Node Admin** permission.

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0l3ec4Inp18ivGSZ2%2Fimage.png?alt=media\&token=7e07b6c3-52b2-480f-96ab-d7c55bd7fe04)

### Using the API

{% hint style="info" %}
API examples here are just shown for illustrative purposes. Check the [LABDRIVE API documentation](https://docs.libnova.com/labdrive/developers-guide/api-extended-documentation) for additional information and all available methods.
{% endhint %}

1\. Sign in to the LABDRIVE Management Interface

2\. Obtain your LABDRIVE API key by selecting your name and then **Access Methods:**

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MVaHSX-G_bFFXPQn-Od%2F-MVaJWnwSfyMMFbO42X1%2Fimage.png?alt=media\&token=7047e304-094c-4c46-a50e-102ba2513abe)

3\. Then, you need to **create the node** and then **assign permissions**. To create the node:

```
curl --request POST  --url "$your_platform_url/api/archivalstructure" \
     --header 'Content-Type: application/json' \
     --header "authorization: Bearer $your_platform_api_key" \
     --data \
'{
 "name": "New archival structure name",
 "code": "NAC2",
 "content_policy": "INHERIT",
 "parent": 1
}'

```

**Name** and **code** are the two descriptive values for the node, and **parent** is the id for the parent node in which you want to create this one. You can use "null" to create them in the root of the repository (remember to set "content\_policy" to "CUSTOM":&#x20;

```
 curl --request POST  --url "$your_platform_url/api/archivalstructure" \
       --header 'Content-Type: application/json' \
       --header "authorization: Bearer $your_platform_api_key" \
       --data \
  '{
   "name": "New archival structure",
   "code": "NAC",
   "content_policy": "CUSTOM",
   "parent": null
  }'
```

or you can use the following query to get the **ids** of the existing nodes to use one of them:

```
	curl --request GET \
      --url "$your_platform_url/api/archivalstructure" \
      --header "authorization: Bearer $your_platform_api_key"
```

####

#### Adjusting permissions

When you create a new node, permissions are defined as **custom permissions** (and empty) if the node is created without a parent and defined as **inherited** from the parent node otherwise.&#x20;

If you want to **see current permissions** for a node, use the following method:

```
  curl --request GET \
      --url "$your_platform_url/api/archivalstructure/1/permissions" \
      --header "authorization: Bearer $your_platform_api_key"
```

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MY0tc4hahrS1O9vWQq6%2F-MY0wgo7KYvgGtuLYtpk%2Fimage.png?alt=media\&token=a5df6cb6-8166-4a47-bb37-ae391ebae98c)

If you want to **delete permissions entry** for a given user group use:

```
curl --request DELETE \
     --url "$your_platform_url/api/archivalstructure/1/permissions/group/8"\
     --header "authorization: Bearer $your_platform_api_key"
```

&#x20;And for assigning them, use:

```
	curl --request POST \
      --url "$your_platform_url/api/archivalstructure/1/permissions" \
      --header 'Content-Type: application/json' \
      --header "authorization: Bearer $your_platform_api_key" \
      --data '{
               "user_groups": [
   	          {
   		     "type": "group",
   		     "id": "8"
   	          }
               ],
               "permissions": [
                 "CONTAINER_CREATE"
               ]
             }'
```

These are some of the permissions that are available for assigning to a node/container:

```
        "CONTAINER_CREATE": true,
        "CONTAINER_READ": true,
        "NODE_ADMIN": false,
        "CONTAINER_UPDATE": true,
        "CONTAINER_DELETE": true,
        "CONTAINER_CONTENT_READ": true,
        "CONTAINER_PERMISSION_READ": true,
        "CONTAINER_LOG_READ": true,
        "FILE_EVENT_TRIGGER": true,
        "CONTAINER_CONTENT_WRITE": true,
        "CONTAINER_CONTENT_METADATA_UPDATE": true,
        "CONTAINER_PERMISSION_WRITE": true,
        "CONTAINER_PERMISSION_DELETE": true
```

But you can get a full list of permissions using:

```
curl --request GET \
        --url "$your_platform_url/api/permissions" \
        --header "authorization: Bearer $your_platform_api_key"
```

## Deleting an Archive Structure

### Using the management interface

{% hint style="info" %}
Only nodes without any other sub-node or container can be deleted. Move anything that is inside the one you want to delete in order to proceed.&#x20;
{% endhint %}

1.Go to **Configuration** and then **Archival Structure**

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0hrX_X2VcgI1h84u4%2Fimage.png?alt=media\&token=2c46f022-04f7-445b-a4ef-391bfa6302f3)

2\. Use the remove button (1) to delete the node:

![](https://2290386118-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVFE6MnOK93sACDCxxx%2F-MY1-I_fzrPWfmX_8TWs%2F-MY11jiQmPq3yhsWTcDj%2Fimage.png?alt=media\&token=f1c3f23d-d07a-4df7-8eab-e59864f1a04e)

### Using the API

{% hint style="info" %}
API examples here are just shown for illustrative purposes. Check the [LABDRIVE API documentation](https://docs.libnova.com/labdrive/developers-guide/api-extended-documentation) for additional information and all available methods.
{% endhint %}

To **delete** an Archival Node, use the following method:

```
curl --request DELETE \
     --url "$your_platform_url/api/archivalstructure/1"\
     --header "authorization: Bearer $your_platform_api_key"
```
