How to check user permissions with a site collection?

I want to check if the user is the administrator of a site collection of a particular site collection. When I look at 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 bind SPUser and SPReusableAcl ?

Any ideas?

+4
source share
1 answer

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

 SPContext.Current.Site.RootWeb.CurrentUser.IsSiteAdmin 

Also check out the SPWeb.SiteAdministrators collection.

Actually, there are some good suggestions on how to check if a user is an administrator of a site collection here .

+8
source

Source: https://habr.com/ru/post/1332202/


All Articles