Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the permissions of a user with a site collection?

I want to check if a user is a site collection administrator of a particular site collection. When I go through the member functions I see two functions

site.CheckForPermissions(SPReusableAcl acl, SPBasePermissions perms)
site.DoesUserHavePermissions(SPReusableAcl acl, SPBasePermissions perms)

But how to use them? What is SPReusableAcl? How can I relate SPUser and SPReusableAcl?

Any ideas?

like image 246
NLV Avatar asked Jan 20 '23 22:01

NLV


1 Answers

Do you know about the .isSiteAdmin Property? You can check if the current user is admin by using

SPContext.Current.Site.RootWeb.CurrentUser.IsSiteAdmin

Also check out the SPWeb.SiteAdministrators collection.

Actually there are some nice suggestions on how to check if a user is site collection administrator here.

like image 59
Dennis G Avatar answered Jan 30 '23 23:01

Dennis G