Get added member roles before persisting in the saving event.
Hello everyone,
The project I am currently working on requires me to check the roles that were added before the _memberService.Save() gets called. I need to perform a check and cancel the operation if the check fails.
Currently I am working on a solution using the MemberSavingNotification, but I am unable to find a way to retrieve the newly added roles on the IMember.
private readonly IMemberService _memberService;
public MemberSavingNotificationHandler(IMemberService memberService)
{
_memberService = memberService;
}
public void Handle(MemberSavingNotification notification)
{
foreach (IMember entity in notification.SavedEntities)
{
// only gives already saved roles ... not the ones just added in backoffice
IEnumerable<string> roles = _memberService.GetAllRoles(entity.Id);
}
}
I also tried using the AssignedMemberRolesNotification Notification, but it seems to fire after the member has been saved because it doesent allow me to cancel the operation.
Get added member roles before persisting in the saving event.
Hello everyone,
The project I am currently working on requires me to check the roles that were added before the _memberService.Save() gets called. I need to perform a check and cancel the operation if the check fails.
Currently I am working on a solution using the MemberSavingNotification, but I am unable to find a way to retrieve the newly added roles on the IMember.
I also tried using the AssignedMemberRolesNotification Notification, but it seems to fire after the member has been saved because it doesent allow me to cancel the operation.
is working on a reply...