1

Can anyone please explain me with proper examples (not code) the difference between role assignments, role definitions, role definition bindings and roles? The MSDN documentation is not very useful here. Though these are object model classes, I would like to understand them from a SharePoint UI standpoint.

2 Answers 2

5

According to this article on MSDN:

A role consists of two parts: a role definition and a role assignment.

So that (mostly?) answers your question of what is a role. But to get into the details:

The role definition, or permission level, is the list of rights associated with the role.

So from a UI perspective, these are things like "Contribute", "Full Control", etc. If you create a new custom permission level (instructions here), you are essentially creating a new role definition.

The role assignment is what ties together the role definition (permission level) with the specific user or group, and the scope that that permission level will be applied to (i.e. site, list, folder, etc.). It gets a little complicated but it kind of works like this:

  • The role assignment holds a role definition binding that links the permission level (role definition) to a user or group.
  • The object the permissions are going to be applied to (web, list, etc.) holds the role assignment.

So again, from a UI perspective, you are working with role definitions when you are working with permission levels (Contribute, Full Control, etc.). The role definition binding and role assignments happen hand-in-hand when you assign a user or group permissions to a specific object (site, list, folder, etc.).

Hope that clears it up at least a little bit!

2
  • Thanks a lot, Dylan. It does clear up a bit, though not completely. However, it is better than most other comments and hence I am marking it as answer. Please try to add more explanation, if you can.
    – Ven
    Commented Sep 23, 2016 at 6:54
  • @Ven part of the problem is that you are asking for an explanation "from a SharePoint UI standpoint", and the only one of those things that has a clear 1:1 relationship with the UI is the role definition. Role definition bindings and role assignments are at play behind the scenes when you assign someone permissions to something in SharePoint, but there is no clear 1:1 representation of those object model classes in the UI. If I have some time later today I will try to expand my answer a little bit, but it is almost impossible to describe those things without using code examples. Commented Sep 23, 2016 at 13:51
4

Most Probable answer to your question,

Role definition class defines the RoleType of user, it may be reader or contributor.

For e.g.

 RoleDefinition roleDefinition = web.RoleDefinitions.GetByType(RoleType.Contributor);  

To assign a user to a particular role on a Web site, create a RoleDefinitionBindingCollection object for the Web site context,add a role definition to the binding collection object,

RoleDefinitionBindingCollection roleDefinitionBindingCollection = new RoleDefinitionBindingCollection(clientContext);  

roleDefinitionCollection.Add(roleDefinition); 

and then use the Add(principal,RoleDefinitionBindingCollection) method to add the user together with the binding collection to the role assignments for the Web site.

Role Assignments is use to assign principal and RoleDefinitionBindingCollection using Add property for e.g.

Web.RoleAssignments.Add(Principal, RoleDefinitionBindingCollection); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.