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

Forums / Developing with Sitefinity / Remove the "Everyone" view permission for a news item

Remove the "Everyone" view permission for a news item

1 posts, 0 answered
  1. James
    James avatar
    0 posts
    Registered:
    15 Sep 2016
    18 Nov
    Link to this post

    I'm creating a news item through the api and in the same process assign view permission only to certain roles. 

    I've managed to break the inheritance and assign the correct view permission but I'm unable to remove the permission for "Everyone" through the api...

    It seems that if I use:

    var everyonePermission = newsManager.GetPermission(SecurityConstants.Sets.General.SetName, newsItem.Id,
                        SecurityManager.ApplicationRoles[SecurityConstants.AppRoles.Everyone].Id);

    It returns null. So if I then create the permission for everyone and ungrant access to view the item it throws and exception saying that it can't create a duplicate key in the sf_permissions index which means that this permission must already exist.

    I've tried this at various points in the lifecycle of creating the news item, before and after publishing it, using the master item. All to no avail.

    So my question is: how do you possibly remove the Everyone view permission?

1 posts, 0 answered