Closed Dade-R closed 2 years ago
The goal would be to support something like: permission.copy('Contribute', 'ContributeNoDelete'); permission.remove('ContributeNoDelete', ['Delete Items', 'Delete Versions']);
Added a new copyPermissionLevel helper method. This method will take the following properties:
{
// Permissions to add
AddPermissions?: [number];
// Description of the permission level
Description: string;
// The name of the base permission to copy
BasePermission: string;
// The permission order
Order?: number;
// The name of the permission level to create
Name: string;
// Permissions to not copy over
RemovePermissions?: [number];
// The target site collection, current site by default
WebUrl?: string;
}
Added to v6.9.1
import { Helper, SPTypes } from "gd-sprest";
// Copy and remove permissions
Helper.copyPermissionLevel({
BasePermission: "Contribute",
Name: "Contribute no Delete",
Description: "Edit permissions - Delete",
RemovePermissions: [SPTypes.BasePermissionTypes.DeleteListItems]
});
// Copy and add permissions
Helper.copyPermissionLevel({
BasePermission: "Contribute",
Name: "Contribute add Web",
Description: "Edit permissions + Create Web",
AddPermissions: [SPTypes.BasePermissionTypes.ManageSubwebs]
});
Please develop a method to create and update a custom permission level when defining a new RoleAssignment. Creating a custom permission level should be defined by either calling an .add() or .remove() function, or by calling a .copy() function and specifying an existing permission level with a name for the new permission level. You could then subsequently call either .add() or .remove() on the new permission level. This feature exists OOTB in the UI and would be a great addition to this framework. Below is a complete list of each permission in a permission level.