[Fixes #5745] Calling RoleService.Renamed() after it's been renamed (#7653)

[Fixes #5745]
This commit is contained in:
ViRuSTriNiTy 2017-04-13 21:29:47 +02:00 committed by Sébastien Ros
parent 5eef9c654c
commit a200e35923

View File

@ -90,10 +90,6 @@ namespace Orchard.Roles.Services {
roleRecord.Name = roleName;
roleRecord.RolesPermissions.Clear();
if (!String.Equals(currentRoleName, roleName)) {
_roleEventHandlers.Renamed(new RoleRenamedContext {Role = roleRecord, NewRoleName = roleName, PreviousRoleName = currentRoleName});
}
foreach (var rolePermission in rolePermissions) {
string permission = rolePermission;
if (_permissionRepository.Get(x => x.Name == permission) == null) {
@ -116,6 +112,10 @@ namespace Orchard.Roles.Services {
foreach(var permission in currentPermissions.Values)
_roleEventHandlers.PermissionRemoved(new PermissionRemovedContext { Role = roleRecord, Permission = permission.Permission });
if (!String.Equals(currentRoleName, roleName)) {
_roleEventHandlers.Renamed(new RoleRenamedContext {Role = roleRecord, NewRoleName = roleName, PreviousRoleName = currentRoleName});
}
TriggerSignal();
}