Skip to main content

Get role privilege structure

Forms the privilege information structure for use when working with roles

Function GetRolePrivilegeStructure(Val Resource, Val ActionsArray) Export

ParameterCLI optionTypeRequiredDescription
Resource--resStructure Of KeyAndValuePrivilege resource
ActionsArray--actArray Of StringArray of available privilege actions
Returns

Structure - Privilege structure

tip

Resource can be defined in one of the following formats:
Structure for collection: { db: "database", collection: "collection name" }

Structure for cluster: { cluster : true }


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);
# 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']"
Result
{
"resource": {
"db": "main",
"collection": "new_collection"
},
"actions": [
"find",
"insert",
"update"
]
}