public override void Start() { Platform.GetService <IAuthorityGroupAdminService>( delegate(IAuthorityGroupAdminService service) { ListAuthorityTokensResponse authorityTokenResponse = service.ListAuthorityTokens(new ListAuthorityTokensRequest()); _authorityTokens = CollectionUtils.Map <AuthorityTokenSummary, AuthorityTokenTableEntry>( CollectionUtils.Sort(authorityTokenResponse.AuthorityTokens, (x, y) => x.Name.CompareTo(y.Name)), summary => new AuthorityTokenTableEntry(summary, OnAuthorityTokenChecked)); if (_isNew && !_duplicate) { _authorityGroupDetail = new AuthorityGroupDetail(); } else { LoadAuthorityGroupForEditResponse response = service.LoadAuthorityGroupForEdit(new LoadAuthorityGroupForEditRequest(_authorityGroupSummary.AuthorityGroupRef)); _authorityGroupDetail = response.AuthorityGroupDetail; // if duplicating, append something to the name if (_duplicate) { _authorityGroupDetail.AuthorityGroupRef = null; _authorityGroupDetail.Name = _authorityGroupDetail.Name + " Copy"; _authorityGroupDetail.BuiltIn = false; // built-in groups duplicate to a regular group } } InitialiseTable(); }); base.Start(); }
public bool UpdateUserGroup(UserGroupRowData userGroup) { bool success; using (var service = new AuthorityManagement()) { var detail = new AuthorityGroupDetail { AuthorityGroupRef = new EntityRef(userGroup.Ref), Name = userGroup.Name, Description = userGroup.Description, DataGroup = userGroup.DataGroup }; foreach (TokenSummary token in userGroup.Tokens) { detail.AuthorityTokens.Add(new AuthorityTokenSummary(token.Name, token.Description)); } service.UpdateAuthorityGroup(detail, userGroup.Password); success = true; } //TODO: Catch exception? return(success); }
public void UpdateAuthorityGroup(AuthorityGroupDetail detail, string password) { _service.UpdateAuthorityGroup(new UpdateAuthorityGroupRequest(detail) { Password = password }); }
private static AuthorityGroupDefinition GetAuthorityGroupDefinition(AuthorityGroupDetail detail) { return(new AuthorityGroupDefinition( detail.Name, detail.Description, detail.DataGroup, CollectionUtils.Map(detail.AuthorityTokens, (AuthorityTokenSummary s) => s.Name).ToArray(), detail.BuiltIn)); }
public void AddAuthorityGroup(string name, string description, bool dataGroup, List <AuthorityTokenSummary> tokens) { var details = new AuthorityGroupDetail { Name = name, Description = description, DataGroup = dataGroup, AuthorityTokens = tokens }; _service.AddAuthorityGroup(new AddAuthorityGroupRequest(details)); }
public UserGroupRowData(AuthorityGroupDetail group) { Ref = group.AuthorityGroupRef.Serialize(); Name = group.Name; Description = group.Description; DataGroup = group.DataGroup; foreach (AuthorityTokenSummary token in group.AuthorityTokens) { Tokens.Add(new TokenSummary(token.Name, token.Description)); } TokenCount = group.AuthorityTokens.Count; }
public AuthorityGroupStudyAccessInfo(AuthorityGroupDetail detail) { AuthorityOID = detail.AuthorityGroupRef.ToString(false, false); Name = detail.Name; Description = detail.Description; IsDataAccessAuthorityGroup = detail.DataGroup; CanAccessToAllPartitions = HasToken(detail.AuthorityTokens, MatrixPACS.Enterprise.Common.AuthorityTokens.DataAccess.AllPartitions); CanAccessToAllStudies = HasToken(detail.AuthorityTokens, MatrixPACS.Enterprise.Common.AuthorityTokens.DataAccess.AllStudies); }
internal void UpdateAuthorityGroup(AuthorityGroup authorityGroup, AuthorityGroupDetail detail, IPersistenceContext persistenceContext) { authorityGroup.Name = detail.Name; authorityGroup.Description = detail.Description; authorityGroup.DataGroup = detail.DataGroup; authorityGroup.AuthorityTokens.Clear(); if (detail.AuthorityTokens.Count > 0) { // process authority tokens List <string> tokenNames = CollectionUtils.Map <AuthorityTokenSummary, string>( detail.AuthorityTokens, token => token.Name); AuthorityTokenSearchCriteria where = new AuthorityTokenSearchCriteria(); where.Name.In(tokenNames); IList <AuthorityToken> authTokens = persistenceContext.GetBroker <IAuthorityTokenBroker>().Find(where); authorityGroup.AuthorityTokens.AddAll(authTokens); } }
public DataAccessGroupInfo(AuthorityGroupDetail detail) { Name = detail.Name; Description = detail.Description; AuthorityGroupRef = detail.AuthorityGroupRef.ToString(false, false); }