---
sidebar_position: 7
description: Get role privilege structure and other functions to work with MongoDB in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MongoDB]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get role privilege structure
 Forms the privilege information structure for use when working with roles



`Function GetRolePrivilegeStructure(Val Resource, Val ActionsArray) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Resource | --res | Structure Of KeyAndValue | &#x2714; | Privilege resource |
  | ActionsArray | --act | Array Of String | &#x2714; | Array of available privilege actions |

  
  Returns:  Structure - Privilege structure

:::tip
Resource can be defined in one of the following formats:<br/>Structure for collection: `{ db: "database", collection: "collection name" }`

Structure for toлawithтерa: `{ cluster : true }`
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    Base     = "main";
    Resource = New Structure("db,collection", Base, "new_collection");
    Actions  = New Array;

    Actions.Add("find");
    Actions.Add("insert");
    Actions.Add("update");

    Result = OPI_MongoDB.GetRolePrivilegeStructure(Resource, Actions);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint mongodb GetRolePrivilegeStructure \
             --res "{'db':'main','collection':'new_collection'}" \
             --act "['find','insert','update']"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint mongodb GetRolePrivilegeStructure ^
             --res "{'db':'main','collection':'new_collection'}" ^
             --act "['find','insert','update']"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "resource": {
  "db": "main",
  "collection": "new_collection"
 },
 "actions": [
  "***",
  "***",
  "***"
 ]
}
```
