Posts Tagged ‘Permissions’

Retrieving all (nested) members of a Group

Membership-teaser

You can assign permissions to users, SharePoint groups and Active Directory groups in SharePoint. While SharePoint groups cannot contain other SharePoint groups, it is possible to nest Active Directory Groups. The SharePoint method SPGroup.Users only returns users that are added directly to the SharePoint Group. I have written a small function that is able to retrieve all users of a SPPrincipal object, included nested users.

(more…)

Conditionally enable/disable Ribbon buttons based on user permissions

Conditionally enable-disable Ribbon buttons based on user permissions

Using custom action you can create your own ribbon elements. In a post I have published a while ago I showed how to add a button to the ribbon to generate a QR-Code. But what if you want your button only to be enabled under certain circumstances. For example; if the user has sufficient privileges.

(more…)

Checking user permissions: DoesUserHavePermissions vs. CatchAccessDeniedException

Checking user permissions DoesUserHavePermissions vs CatchAccessDeniedException

I recently had a nice discussion with a colleague about the best way to check if the current user has permissions to view a specified SharePoint list in a SP2010 site using C#.

 

 

Basically there are 2 ways to check for permissions:

1) SPSecurableObject.DoesUserHavePermissions

2) SPSecurity.CatchAccessDeniedException

This post  discusses both methods, proposes implementations and discusses the pro’s and cons.

(more…)