1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2026-05-06 21:04:14 +02:00
Files
OpenIntegrations/docs/en/examples/MongoDB/CreateRole.txt
T

28 lines
886 B
Plaintext
Vendored

Address = "127.0.0.1:1234";
Login = "bayselonarrend";
Password = "12we...";
Base = "admin";
ConnectionParams = New Structure("authSource", "admin");
ConnectionString = OPI_MongoDB.GenerateConnectionString(Address, , Login, Password, ConnectionParams);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);
RoleArray = New Array;
RoleArray.Add("read");
RoleArray.Add("userAdmin");
Resource = New Structure("db,collection", Base, "new_collection");
Actions = New Array;
Actions.Add("find");
Actions.Add("insert");
Actions.Add("update");
Privilege = OPI_MongoDB.GetRolePrivilegeStructure(Resource, Actions);
PrivilegesArray = New Array;
PrivilegesArray.Add(Privilege);
RoleName = "newrole";
Result = OPI_MongoDB.CreateRole(Connection, RoleName, Base, PrivilegesArray, RoleArray);