public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request) { var authorityGroup = PersistenceContext.Load<AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef); if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup) { var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext); if (!user.Password.Verify(request.Password)) { // the error message is deliberately vague throw new UserAccessDeniedException(); } } // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); PersistenceContext.SynchState(); return new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)); }
public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail"); var authorityGroup = PersistenceContext.Load<AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef); if (authorityGroup.BuiltIn || request.AuthorityGroupDetail.BuiltIn) throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups); if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup) { var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext); if (!user.Password.Verify(request.Password)) { // the error message is deliberately vague throw new UserAccessDeniedException(); } } // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); PersistenceContext.SynchState(); return new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)); }