Modify Page Properties using Fluent API
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?
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();