public void Handle(RoleEdited evt) { _unitOfWork.WithAuthUserTransaction(tran => { var authUser = _authUserRepository.FindById(evt.EditedBy); var adminLog = AdminLog.EditRoleLog(_idGenerator.ReservePool(), _clock, authUser, evt.RoleId, evt.Rolename); _adminLogRepository.Save(adminLog); tran.Commit(); }); }
public void EditRole(UserId responsibleUserId, RoleId roleId, string rolename, string[] grantedPermissions) { _unitOfWork.WithAuthUserTransaction(tran => { var role = FindRole(roleId); role.Edit(rolename, grantedPermissions.Select(p => new Permission(p))); _roleRepository.Save(role); _unitOfWork.Raise(RoleEdited.Factory(role, responsibleUserId)); tran.Commit(); }); }