More in this section

Forums / General Discussions / Modify Page Properties using Fluent API

Modify Page Properties using Fluent API

2 posts, 0 answered
  1. Vanitha
    Vanitha avatar
    7 posts
    Registered:
    06 Oct 2010
    25 Oct 2010
    Link to this post
    Hi I checked the article from this link

    http://www.sitefinity.com/40/help/developer-manual/fluent-api-pages-modify-page-properties.html

    Is there any way to change the page view permission for specific user through code?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Oct 2010
    Link to this post
    Hi Vanitha,

    Below is a sample code that illustrates how to set permissions for a given page.

    var pageManager = PageManager.GetManager();
    var page = pageManager.GetPageNodes().Where(p => p.Title == "PermissionsTest").SingleOrDefault();
    Permission perm = pageManager.CreatePermission(SecurityConstants.Sets.Pages.SetName, page.Id, SecurityManager.GetCurrentUserId());
    perm.GrantActions(false, SecurityConstants.Sets.Pages.ChangePermissions);
    page.Permissions.Add(perm);
    pageManager.SaveChanges();


    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
2 posts, 0 answered