What is calling BreakRoleInheritance? Let's say it is an Event Receiver, but whatever it is, you need to make sure that the user has adequate permissions. Just because a user can add or update items in a list, doesn't mean that user has rights to call BreakRoleInheritance. For that, the user must have Manage Permissions rights.
To ensure the proper permissions, it is safest to call BreakRoleInheritance in the context of the site collection system account:
if (!listitem.HasUniqueRoleAssignments)
{
Guid siteId = listitem.Web.Site.ID;
Guid webId = listitem.Web.ID;
Guid listId = listitem.ParentList.ID;
int itemId = listitem.ID;
SPUserToken token = listitem.Web.Site.SystemAccount.UserToken;
using (SPSite site = new SPSite(siteId, token))
{
using (SPWeb web = site.OpenWeb(webId))
{
SPList list = web.Lists[listId];
SPListItem item = list.GetItemById(itemId);
item.BreakRoleInheritance(false);
}
}
}
A couple other things to check:
- If you are using elevated privileges, set allow unsafe updates to true.
- If versioning is enabled, be sure the item is checked in.