I had to revoke some of the permissions of a role definition but there’s no out of the box functionality to do so. After some searching on the web I couldn’t find any suitable methods either.
So I decided to create on myself and thought creating an extension method would be the best option.
/// <summary>
/// Revokes the given permission from the BasePermission set.
/// </summary>
/// <param name="roleDefinition">The role definition.</param>
/// <param name="revokePermission">The permission you want tor revoke.</param>
public static void RevokePermission(this SPRoleDefinition roleDefinition, SPBasePermissions revokePermission)
{
// Remove space, because BasePermissions contains spaces between entries
string originalPermissionsString = roleDefinition.BasePermissions.ToString().Replace(" ", "");
// Split orignal permission entries
string[] originalPermissions = originalPermissionsString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
roleDefinition.BasePermissions = new SPBasePermissions();
foreach (string originalPermission in originalPermissions)
{
if (originalPermission == revokePermission.ToString())
continue;
SPBasePermissions newPermission = (SPBasePermissions)Enum.Parse(typeof(SPBasePermissions), originalPermission);
roleDefinition.BasePermissions = roleDefinition.BasePermissions | newPermission;
}
}
After implementing this extension into your project/solution/class you can now revoke permissions from your permission set like this.
SPRoleDefinition roleDefinition = web.RoleDefinitions["YourRoleDef"];
roleDefinition.RevokePermission(SPBasePermissions.BrowseUserInfo);
roleDefinition.Update();
Out of the box you’re not able to group your libraries by content type.
One way to achieve this is to activate the “Metadata Navigation and Filtering” feature under the site collection features.

Metadata navigation and filtering feature
Afterwards go to “document library settings”, beneath “General Settings” click “Metadata navigation settings” and add the “Content Type” to the “Selected Hierarchy Fields”.

Configure Navigation Hierarchies
If you return to your library, you’ll find an extra navigation panel which allows you to navigate through your library by the fields earlier selected.

Metadata navigation
But another way to achieve content type grouping is to change your field schema xml of the content type field in your site collection. The following code example shows how to achieve this. Within the code example we change the sortable property on the field, out of the box the property is set to false but if we change is we are able to sort and group our views by content type.
private void ModifyContentTypeField(SPWeb web)
{
SPFieldCollection fields = web.Fields;
if (fields.Contains(SPBuiltInFieldId.ContentType))
{
SPField contentTypeField = fields[SPBuiltInFieldId.ContentType];
if (contentTypeField != null)
{
string fieldSchemaXml = contentTypeField.SchemaXml;
string replacedSchemaXml = Regex.Replace(fieldSchemaXml,
"sortable=\"false\"", "Sortable=\"TRUE\"", RegexOptions.IgnoreCase);
contentTypeField.SchemaXml = replacedSchemaXml;
contentTypeField.Update(true);
}
}
}
You can add this to a feature to enable content type field grouping. If you now go to your view modification screen, you can now select content type from the Group By drop down box.

Group by content type
After selecting the content type field as group by field your view will look something like this.

View grouped content types