private async Task <IEnumerable <IFabricPrincipal> > GetUserPrincipalsAsync(string searchText, string tenantId = null) { string queryText = null; var principals = new List <IFabricPrincipal>(); queryText = _azureQuery.QueryText(searchText, PrincipalType.User); var users = await GetAllUsersFromTenantsAsync(queryText, tenantId).ConfigureAwait(false); foreach (var result in users) { principals.Add(CreateUserPrincipal(result)); } return(principals); }
public async Task <IEnumerable <IFabricGroup> > SearchGroupsAsync(string searchText, string searchType, string tenantId = null) { var fabricGroups = new List <IFabricGroup>(); switch (searchType) { case SearchTypes.Wildcard: _azureQuery = new AzureWildcardQuery(); break; case SearchTypes.Exact: _azureQuery = new AzureExactMatchQuery(); break; default: throw new DirectorySearchException($"{searchType} is not a valid search type"); } var queryText = _azureQuery.QueryText(searchText, PrincipalType.Group); var fabricGraphApiGroups = await GetAllGroupsFromTenantsAsync(queryText, tenantId); foreach (var fabricGraphApiGroup in fabricGraphApiGroups) { fabricGroups.Add(CreateFabricGroup(fabricGraphApiGroup)); } return(fabricGroups); }