Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Changing Item-Level Permissions

Changing Item-Level Permissions

The Backend Services JavaScript SDK allows you to update or delete item-level permissions from any JavaScript-based application.

Setting the ACL property

This will set the UsersCanUpdate array of the item's ACL to an array with one id and set EveryoneCanRead to false.

var el = new Everlive('your-app-id');
//login with the user who owns the item.
//...
var acl = {
    EveryoneCanRead: false
    UsersCanUpdate: [ user.Id ]
};
var data = el.data('type-name');
data.setAcl(acl, item.Id);

Adding single id to an array

In order to add single id to the arrays in the ACL object use the $push modifier.

var el = new Everlive('your-app-id');
var acl = {
    $push: {
        UsersCanUpdate: user.Id
    }
};
var data = el.data('type-name');
data.setAcl(acl, item.Id);

Adding multiple ids to an array

In order to add new ids to the arrays in the ACL object use the $pushAll modifier.

var el = new Everlive('your-app-id');
var acl = {
    $pushAll: {
        UsersCanUpdate: [ user.Id, user2.Id ]
    }
};
var data = el.data('type-name');
data.setAcl(acl, item.Id);

Removing a single item from an array

In order to remove a single id from the arrays in the ACL object use the $pull modifier.

var el = new Everlive('your-app-id');
var acl = {
    $pull: {
        UsersCanUpdate: user.Id
    }
};
var data = el.data('type-name');
data.setAcl(acl, item.Id);

Removing multiple items from an array

In order to remove ids from the arrays in the ACL object use the $pullAll modifier.

var el = new Everlive('your-app-id');
var acl = {
    $pullAll: {
        UsersCanUpdate: [ user.Id, user2.Id ]
    }
};
var data = el.data('type-name');
data.setAcl(acl, item.Id);

Note: The difference between $push/$pull and $pushAll/$pullAll is that the former work by providing a single id and the latter by providing an array of ids. Telerik Platform will try to provide you with messages if you specify a wrong value for the respective modifier.

You can also use the $set and $unset modifiers to completely replace or remove properties from the ACL object.

Delete item-level permissions

Set the ACL to null if you need to delete the item-level permission for an item.

var el = new Everlive('your-app-id');
var data = el.data('type-name');
data.setAcl(null, item.Id);
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.