Exemple #1
0
        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();
            });
        }
Exemple #2
0
        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();
            });
        }