+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Get User Permissions for a Page

Get User Permissions for a Page

3 posts, 1 answered
  1. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    30 Sep 2010
    Link to this post
    Good Afternoon,

    I want to check whether a user has permission to create or modify a particular page. How do I do it?

    Two classes in the manual seem to be useful toward this goal but I don't know how to use them: PagePermission and PageRights.

    Some sample code would be great.

    Thanks,
    Jeff
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Sep 2010
    Link to this post
    Hello Jeff,

    Take a look at Check permission for particular role . If you want to get the permissions for the currently logged in user you can use the following code

    var manager = newCmsManager();
    ICmsUrlContext urlContext = CmsUrlContext.Current;
    ICmsPage cmsPage = manager.GetPage(urlContext.PageID) as ICmsPage;
      
      
    Telerik.Cms.Security.PagePermission perm = new Telerik.Cms.Security.PagePermission(cmsPage, Telerik.Cms.Security.PageRights.View);
    if(!perm.CheckDemand())
    {
      // you do not have view rights
    }


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Jeff
    Jeff avatar
    124 posts
    Registered:
    05 Aug 2007
    18 Oct 2010
    Link to this post
    Thanks for the response. I wasn't able to test it until now (issues upgrading to SP4).

    I'm happy to report it works.

    Thanks,
    Jeff
Register for webinar
3 posts, 1 answered