Changing Item-Level Permissions

Changing Item-Level Permissions

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

Updating Item-Level Permissions

public bool AllowSingleUserToUpdate(EverliveApp app, Book book, Guid userId) 
{
    var newBookAcl = new AccessControlList()
    {
        UsersCanUpdate = new List()
        {
            userId
        }
    };
    //We need to have logged in with the user who is the owner of the book or use MasterKey authentication.
    var result = app.WorkWith().Data<Book>().SetAcl(book.Id, newBookAcl).ExecuteSync();
    
    //setAcl will replace the acl object and leave only the properties that have been set in the newBookAcl
    return result;
}

Deleting Item-Level Permissions

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

public bool DeleteItemPermissions(EverliveApp app, Book book) 
{
    //We need to have logged in with the user who is the owner of the book or use MasterKey authentication.
    var result = app.WorkWith().Data<Book>().SetAcl(book.Id, null).ExecuteSync();
    //We set the acl to null.
    return result;
}
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.