public ListAuthorityGroupsResponse ListAuthorityGroups(ListAuthorityGroupsRequest request) { var criteria = new AuthorityGroupSearchCriteria(); criteria.Name.SortAsc(0); if (request.DataGroup.HasValue) { criteria.DataGroup.EqualTo(request.DataGroup.Value); } var assembler = new AuthorityGroupAssembler(); if (request.Details.HasValue && request.Details.Value) { var authorityGroups = CollectionUtils.Map( PersistenceContext.GetBroker <IAuthorityGroupBroker>().Find(criteria, request.Page), (AuthorityGroup authorityGroup) => assembler.CreateAuthorityGroupDetail(authorityGroup)); return(new ListAuthorityGroupsResponse(authorityGroups)); } else { var authorityGroups = CollectionUtils.Map( PersistenceContext.GetBroker <IAuthorityGroupBroker>().Find(criteria, request.Page), (AuthorityGroup authorityGroup) => assembler.CreateAuthorityGroupSummary(authorityGroup)); return(new ListAuthorityGroupsResponse(authorityGroups)); } }
public ListAuthorityGroupsResponse ListAuthorityGroups(ListAuthorityGroupsRequest request) { var criteria = new AuthorityGroupSearchCriteria(); criteria.Name.SortAsc(0); if (request.DataGroup.HasValue) criteria.DataGroup.EqualTo(request.DataGroup.Value); var broker = PersistenceContext.GetBroker<IAuthorityGroupBroker>(); var assembler = new AuthorityGroupAssembler(); if (request.Details.HasValue && request.Details.Value) { var authorityGroups = CollectionUtils.Map( broker.Find(criteria, request.Page), (AuthorityGroup authorityGroup) => assembler.CreateAuthorityGroupDetail(authorityGroup)); var total = broker.Count(criteria); return new ListAuthorityGroupsResponse(authorityGroups, (int)total); } else { var authorityGroups = CollectionUtils.Map( broker.Find(criteria, request.Page), (AuthorityGroup authorityGroup) => assembler.CreateAuthorityGroupSummary(authorityGroup)); var total = broker.Count(criteria); return new ListAuthorityGroupsResponse(authorityGroups, (int)total); } }
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))); }
public LoadAuthorityGroupForEditResponse LoadAuthorityGroupForEdit(LoadAuthorityGroupForEditRequest request) { var authorityGroup = PersistenceContext.Load <AuthorityGroup>(request.AuthorityGroupRef); var assembler = new AuthorityGroupAssembler(); return(new LoadAuthorityGroupForEditResponse(assembler.CreateAuthorityGroupDetail(authorityGroup))); }
internal UserDetail GetUserDetail(User user) { var assembler = new AuthorityGroupAssembler(); var groups = CollectionUtils.Map( user.AuthorityGroups, (AuthorityGroup group) => assembler.CreateAuthorityGroupSummary(group)); return(new UserDetail(user.UserName, user.DisplayName, user.EmailAddress, user.CreationTime, user.ValidFrom, user.ValidUntil, user.LastLoginTime, user.Enabled, user.Password.ExpiryTime, groups)); }
internal UserDetail GetUserDetail(User user) { var assembler = new AuthorityGroupAssembler(); var groups = CollectionUtils.Map( user.AuthorityGroups, (AuthorityGroup group) => assembler.CreateAuthorityGroupSummary(group)); return new UserDetail(user.UserName, user.DisplayName, user.EmailAddress, user.CreationTime, user.ValidFrom, user.ValidUntil, user.LastLoginTime, user.Enabled, user.Password.ExpiryTime, groups); }
public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request) { // create new group var authorityGroup = new AuthorityGroup(); // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); // save PersistenceContext.Lock(authorityGroup, DirtyState.New); PersistenceContext.SynchState(); return(new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup))); }
internal UserDetail GetUserDetail(User user) { var assembler = new AuthorityGroupAssembler(); var groups = CollectionUtils.Map( user.AuthorityGroups, (AuthorityGroup group) => assembler.CreateAuthorityGroupSummary(group)); return(new UserDetail( EnumUtils.GetEnumValueInfo(user.AccountType, PersistenceScope.CurrentContext), user.UserName, user.DisplayName, user.EmailAddress, user.CreationTime, user.ValidFrom, user.ValidUntil, user.LastLoginTime, user.Enabled, user.Password.ExpiryTime, groups)); }
internal UserDetail GetUserDetail(User user) { var assembler = new AuthorityGroupAssembler(); var groups = CollectionUtils.Map( user.AuthorityGroups, (AuthorityGroup group) => assembler.CreateAuthorityGroupSummary(group)); return new UserDetail( EnumUtils.GetEnumValueInfo(user.AccountType, PersistenceScope.CurrentContext), user.UserName, user.DisplayName, user.EmailAddress, user.CreationTime, user.ValidFrom, user.ValidUntil, user.LastLoginTime, user.Enabled, user.Password.ExpiryTime, groups); }
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 AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail"); if (request.AuthorityGroupDetail.BuiltIn) { throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups); } // create new group var authorityGroup = new AuthorityGroup(); // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); // save PersistenceContext.Lock(authorityGroup, DirtyState.New); PersistenceContext.SynchState(); return(new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup))); }
public LoadAuthorityGroupForEditResponse LoadAuthorityGroupForEdit(LoadAuthorityGroupForEditRequest request) { var authorityGroup = PersistenceContext.Load<AuthorityGroup>(request.AuthorityGroupRef); var assembler = new AuthorityGroupAssembler(); return new LoadAuthorityGroupForEditResponse(assembler.CreateAuthorityGroupDetail(authorityGroup)); }
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 AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request) { // create new group var authorityGroup = new AuthorityGroup(); // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); // save PersistenceContext.Lock(authorityGroup, DirtyState.New); PersistenceContext.SynchState(); return new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)); }
public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail"); if (request.AuthorityGroupDetail.BuiltIn) throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups); // create new group var authorityGroup = new AuthorityGroup(); // set properties from request var assembler = new AuthorityGroupAssembler(); assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext); // save PersistenceContext.Lock(authorityGroup, DirtyState.New); PersistenceContext.SynchState(); return new AddAuthorityGroupResponse(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)); }