Hello Support
I have created an app with a database. The Database Items are created or updated by users using the database create and update rest services or by a server code script I created. The problem I am having is whenever a user creates and saves an item into the database, the same user cannot update the same item using the server code script I created. the problem is to with the acl permissions. On the database I set the default permission to @creator. on the database create and update rest services and deleted the default acl "*" and I set the permission using JS
var acl = {};
acl[value] = {"read": true, "write": false};
return acl;
But I do not know how to set the acl permission on the server code script. My script says
var DB_id = "*";
var collectionName = "";
var UserSessionToken = request.get("UserSessionToken");
query = Collection.query(DB_id, collectionName, params, UserSessionToken);
Code: Select all
if (query.length === 0)
{
Collection.createObject(DB_id, collectionName, {
"column1": "1",
"acl": //what do I enter here?
});
}
else
{
for (var keym = 0; keym < query.length; keym++) {
var currentObject = query[keym];
Collection.updateObject(DB_id, collectionName, UserSessionToken, currentObject["_id"], {
"column1": "101",
"acl": //what do I enter here?
});
Code: Select all
}}
Please help