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

Forums / Security / Restricting pages to only one role

Restricting pages to only one role

6 posts, 0 answered
  1. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    16 Jul 2010
    Link to this post
    Is there an easy way to restrict access to a sitefinity page to only one particular role without having to go through every single role and explicitly denying access? I should note that I am working off of Active Directory and there are quite a few roles. When I select "everyone" from the SiteFinity roles, the deny box for all permissions is greyed out, and I have broken the inheritance from the parent.

    Thanks,
    Eric
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jul 2010
    Link to this post
    Hi Eric Wallace,

    Everyone role us a built-in role. When you set a permissions over this role they apply to all other roles you have created. If the deny checkboxes are grayed out this means that the role does not have permissions of a given object. In this case it is not necessary to click on "Deny", because this is the default value.

    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. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    19 Jul 2010
    Link to this post
    Understood about the Everyone role, but back to my original question, is there an easy way to restrict access to a sitefinity page to only one particular role without having to go through every single role and explicitly denying access?

    Thanks,
    Eric
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jul 2010
    Link to this post
    Hi Eric Wallace,

    You have to do this through Sitefinity's UI or you can do it programmatically

    ICmsPage p;
    ISecured sec = p as ISecured;
    sec.SetPermissions(PageRights.View, PageRights.Modify, new string[] {  "role1", "role2" });


    Kind regards,
    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
  5. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    19 Jul 2010
    Link to this post
    When you say "through Sitefinity's UI", do you mean I would have to deny access to every role except for the one I want to have access to the page?
  6. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    20 Jul 2010
    Link to this post
    As a follow-up, to deny "view" access to all roles, use the following line:

    sec.SetPermissions(0, 1, System.Web.Security.Roles.GetAllRoles());
Register for webinar
6 posts, 0 answered