# 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.

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.

![](https://3176249975-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MgBifM53hLTD0q9p4fr%2F-MgqoDumGuyyW31OhuM4%2F-Mgqp0vr4ss21Oh5RCC_%2Fimage.png?alt=media\&token=84e7ec79-a1a1-4ed9-9ae7-6c507a727320)

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

![](https://gblobscdn.gitbook.com/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.

## Creating or changing an Archive Structure <a href="#creating-or-changing-an-archive-structure" id="creating-or-changing-an-archive-structure"></a>

### Using the management interface <a href="#using-the-management-interface" id="using-the-management-interface"></a>

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

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0hrX_X2VcgI1h84u4%2Fimage.png?alt=media\&token=2c46f022-04f7-445b-a4ef-391bfa6302f3)

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

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0iXulD7ZgmLwSL9gK%2Fimage.png?alt=media\&token=52484b6f-e6f3-4833-9def-b9256bf7276f)

1. 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 the new node that you are creating is contained. You can select ROOT to keep it as a first-level node, without any parent node. When finished, select **Add**.

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0irgJqijnqU_j8SSf%2Fimage.png?alt=media\&token=292312b0-1343-4d9c-97e4-fddc353b346e)

1. 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 as 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://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0k0cKtMiqonpeDZ5k%2Fimage.png?alt=media\&token=4a5377dd-0c29-44d4-ac33-cce835018803)

1. 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://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0l3ec4Inp18ivGSZ2%2Fimage.png?alt=media\&token=7e07b6c3-52b2-480f-96ab-d7c55bd7fe04)

### Using the API <a href="#using-the-api" id="using-the-api"></a>

{% hint style="info" %}
API examples here are just shown for illustrative purposes. Check the [LIBSAFE Go API documentation](../developers-guide/using-the-api) for additional information and all available methods.
{% endhint %}

1. Sign in to the LIBSAFE Go Management Interface
2. Obtain your LIBSAFE Go API key by selecting your name and then **Access Methods:**

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MVaHSX-G_bFFXPQn-Od%2F-MVaJWnwSfyMMFbO42X1%2Fimage.png?alt=media\&token=7047e304-094c-4c46-a50e-102ba2513abe)

1. Then, you need to **create the node** and **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", "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:

```
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", "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"
```

#### ​ <a href="#undefined-1" id="undefined-1"></a>

#### Adjusting permissions <a href="#adjusting-permissions" id="adjusting-permissions"></a>

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.

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://gblobscdn.gitbook.com/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"
```

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"]}'
```

The following permissions are available:

```
        "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
```

## Deleting an Archive Structure <a href="#deleting-an-archive-structure" id="deleting-an-archive-structure"></a>

### Using the management interface <a href="#using-the-management-interface-1" id="using-the-management-interface-1"></a>

{% 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.
{% endhint %}

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

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MXs8SNOV1w9l3jmEPhB%2F-MY0hrX_X2VcgI1h84u4%2Fimage.png?alt=media\&token=2c46f022-04f7-445b-a4ef-391bfa6302f3)

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

![](https://gblobscdn.gitbook.com/assets%2F-MVFE6MnOK93sACDCxxx%2F-MY1-I_fzrPWfmX_8TWs%2F-MY11jiQmPq3yhsWTcDj%2Fimage.png?alt=media\&token=f1c3f23d-d07a-4df7-8eab-e59864f1a04e)

### ​Using the API <a href="#undefined" id="undefined"></a>

{% hint style="info" %}
API examples here are just shown for illustrative purposes. Check the [LIBSAFE Go API documentation](../developers-guide/using-the-api) 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"
```
