More in this section
Forums / Security / Check page permission from code

Check page permission from code

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. Guyso
    Guyso avatar
    3 posts
    02 Jan 2009
    08 Feb 2010
    Link to this post

    i want to check the permissions for the current page from to allow or deny specific actions for the current user.

    Is it possible to check if the user

    - HasViewPermission(CurrentPage)
    - HasCreatePermission(CurrentPage)
    - HasPublishPermission(CurrentPage)
    - ....

    Thank u

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    08 Feb 2010
    Link to this post
    Hi Guyso,

    Below is a sample code that illustrates how to check the permissions programmatically

    ICmsPage p;
    ISecured sec = p as ISecured;
    PagePermission perm = new PagePermission(sec);
    // check view
    //check create

    You can also use CrudRights.View and CrudRights.Create etc. PageRights class inherits from CrudRights class.

    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
2 posts, 1 answered