In this article, you will learn, how to update the users role assignment in SharePoint, using JavaScript Object Model.
Security management is a prime concern in SharePoint, as the right content has to be served to the right people with the adequate permissions. SharePoint recommends assigning role-based permissions. All the permissions are managed through the roles. Roles are classified into two sections:
Role definition, also known as a permission level, is the list of permissions, associated with the role. Full control, contribute, read, design, and limited access are some of the role definitions available. Role assignment is the relationship established between users/groups and the role definition. Hence, when we assign a role programmatically, it is a two-step process: instantiation of the role definition and an implementation of the role assignment to the user/group. You can check out, how to create a new role definition in this article. Through this article, let’s see how we can add a role to user using JavaScript object model. Internal Implementation
Full Code: The full code to update the role definition is shown below:
Output: Before running JSOM code in the client side Browser, the screen will look, as shown below: After running JSOM code in the client side browser, Custom Role Definition has been added to the user. Summary Thus, we have seen, how to add the new role definition to SharePoint Users. This has been tested in both SharePoint 2016 and Office 365.
Getting Started With Workflow Manager Installation Guide