Deleting Roles

Deleting Roles

The Backend Services .NET SDK allows you to delete a role from any .NET based application. The operation requires Master Key authentication.

You can delete roles in Backend Services using these operations:

Deleting a role deletes all permissions granted to the role over content types, content type items, or Business Logic items.

You cannot delete the application's default role not can you delete roles that have users assigned to them.

All operations require Master Kay authorization.

Deleting a Role by ID

To delete a role by ID:

public async Task<bool> DeleteRoleByIdAsync(Guid applicationId, Guid roleId, string masterKey)
{
    var metadata = new EverliveAccount(new EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
    return await metadata.WorkWith().Application(applicationId).Roles().Delete(roleId).ExecuteAsync();
}

On success, you receive the following response:

STATUS 200 OK
{
    "Result": 1
}

Deleting All Roles

To delete all roles, execute the following code snippet:

public async Task<bool> DeleteRolesAsync(Guid applicationId, string masterKey)
{
    var metadata = new EverliveAccount(new EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
    return await metadata.WorkWith().Application(applicationId).Roles().Delete().ExecuteAsync();
}

On success, you receive the following response, where Result contains the number of deleted roles:

STATUS 200 OK
{
    "Result": 3
}

See Also

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.