More in this section

Forums / Developing with Sitefinity / Check if User has page edit permission on page load.

Check if User has page edit permission on page load.

4 posts, 0 answered
  1. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    17 May 2010
    Link to this post
    I would like to add a link to our custom menu called 'Edit Page'.  What I am having trouble with is how to see if the current user has page edit rights.  Basically I'd like a method that I could call that would tell me if the current user is in a Role that has 'Page Modify' rights.  Is there any existing methods I can use to find this info?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 May 2010
    Link to this post
    Hello Scott Harrington,

    Here is a sample code that shows how to check whether the currently authenticated user has modify permissions.

    //GET THE PAGE AND CAST IT TO ICMSPAGE
    var page = (ICmsPage)cmsManager.GetPage(new Guid(node.Key));
    //NEW INSTANCE OF PAGEPERMISSION CLASS
    PagePermission perm = new PagePermission(page);
    if (perm.CheckDemand(CrudRights.Modify))
    {
        // do something
    }


    All the best,
    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.
  3. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    17 May 2010
    Link to this post
    Is there a method off of ICmsPage (Current Page) that I can call via code that will let me know if the current logged in user can edit that page?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 May 2010
    Link to this post
    Hi Scott Harrington,

    You should use instance of PagePermission as shown in the code that I sent you. There is no direct method that you could use.

    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.
Register for webinar
4 posts, 0 answered