Closed herflis closed 4 years ago
The businesscat user hasn't got the required permission (Delete) on the related content(s). I think the problem is the "not userfriendly" error message from the backend. As the comment says: We should handle permission related error messages on a different way:
catch (Exception e)
{
//TODO: we should log only relevant exceptions here and skip
// business logic-related errors, e.g. lack of permissions or
// existing target content path.
SnLog.WriteException(e);
errors.Add(new ErrorContent
{
Content = new {node?.Id, node?.Path},
Error = new Error
{
Code = "NotSpecified",
ExceptionType = e.GetType().FullName,
InnerError = new StackInfo {Trace = e.StackTrace},
Message = new ErrorMessage
{
Lang = System.Globalization.CultureInfo.CurrentUICulture.Name.ToLower(),
Value = e.Message
}
}
});
}
If a user tries to delete a content with moving it into the Trash the following error message is shown
There was an error deleting content '<テストファイル>.xlsx': Error moving item to the trash
Steps to reproduce:
Solution
if the user does not have Delete permission to the content, we should provide a more informative error message. Catch
SenseNetSecurityException
here and look into theData
property for the missing permission. https://github.com/SenseNet/sensenet/blob/8cbb5bd9ddb8eeee387144b3c519d7b70ca1b599/src/ContentRepository/TrashBag.cs#L234add the
AddNew
permission for the user to the trashbag when creating it, so that the code can move the content into it later. https://github.com/SenseNet/sensenet/blob/8cbb5bd9ddb8eeee387144b3c519d7b70ca1b599/src/ContentRepository/TrashBag.cs#L225