Merge pull request #10613 from pedroparraortega/allow-group-select
Allow group select
This commit is contained in:
@@ -72,6 +72,9 @@ catalog:
|
||||
# Optional search for groups, see Microsoft Graph API for the syntax
|
||||
# See https://docs.microsoft.com/en-us/graph/search-query-parameter
|
||||
groupSearch: '"description:One" AND ("displayName:Video" OR "displayName:Drive")'
|
||||
# Optional select for groups, this will allow you work with schemaExtensions in order to add extra information to your groups that can be used on you custom groupTransformers
|
||||
# See https://docs.microsoft.com/en-us/graph/api/resources/schemaextension?view=graph-rest-1.0
|
||||
groupSelect: ['id', 'displayName', 'description']
|
||||
```
|
||||
|
||||
`userFilter` and `userGroupMemberFilter` are mutually exclusive, only one can be provided. If both are provided, an error will be thrown.
|
||||
|
||||
@@ -182,6 +182,7 @@ export type MicrosoftGraphProviderConfig = {
|
||||
groupExpand?: string;
|
||||
groupFilter?: string;
|
||||
groupSearch?: string;
|
||||
groupSelect?: string[];
|
||||
queryMode?: 'basic' | 'advanced';
|
||||
};
|
||||
|
||||
@@ -219,6 +220,7 @@ export function readMicrosoftGraphOrg(
|
||||
groupExpand?: string;
|
||||
groupSearch?: string;
|
||||
groupFilter?: string;
|
||||
groupSelect?: string[];
|
||||
queryMode?: 'basic' | 'advanced';
|
||||
userTransformer?: UserTransformer;
|
||||
groupTransformer?: GroupTransformer;
|
||||
|
||||
@@ -79,6 +79,14 @@ export interface Config {
|
||||
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
||||
*/
|
||||
groupSearch?: string;
|
||||
|
||||
/**
|
||||
* The fields to be fetched on query.
|
||||
*
|
||||
* E.g. ["id", "displayName", "description"]
|
||||
*/
|
||||
groupSelect?: string[];
|
||||
|
||||
/**
|
||||
* The filter to apply to extract users by groups memberships.
|
||||
*
|
||||
|
||||
@@ -56,6 +56,7 @@ describe('readMicrosoftGraphConfig', () => {
|
||||
userExpand: 'manager',
|
||||
userFilter: 'accountEnabled eq true',
|
||||
groupExpand: 'member',
|
||||
groupSelect: ['id', 'displayName', 'description'],
|
||||
groupFilter: 'securityEnabled eq false',
|
||||
},
|
||||
],
|
||||
@@ -71,6 +72,7 @@ describe('readMicrosoftGraphConfig', () => {
|
||||
userExpand: 'manager',
|
||||
userFilter: 'accountEnabled eq true',
|
||||
groupExpand: 'member',
|
||||
groupSelect: ['id', 'displayName', 'description'],
|
||||
groupFilter: 'securityEnabled eq false',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -88,6 +88,14 @@ export type MicrosoftGraphProviderConfig = {
|
||||
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
||||
*/
|
||||
groupSearch?: string;
|
||||
|
||||
/**
|
||||
* The fields to be fetched on query.
|
||||
*
|
||||
* E.g. ["id", "displayName", "description"]
|
||||
*/
|
||||
groupSelect?: string[];
|
||||
|
||||
/**
|
||||
* By default, the Microsoft Graph API only provides the basic feature set
|
||||
* for querying. Certain features are limited to advanced query capabilities
|
||||
@@ -145,6 +153,7 @@ export function readMicrosoftGraphConfig(
|
||||
);
|
||||
}
|
||||
|
||||
const groupSelect = providerConfig.getOptionalStringArray('groupSelect');
|
||||
const queryMode = providerConfig.getOptionalString('queryMode');
|
||||
if (
|
||||
queryMode !== undefined &&
|
||||
@@ -167,6 +176,7 @@ export function readMicrosoftGraphConfig(
|
||||
groupExpand,
|
||||
groupFilter,
|
||||
groupSearch,
|
||||
groupSelect,
|
||||
queryMode,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ export async function readMicrosoftGraphGroups(
|
||||
groupExpand?: string;
|
||||
groupFilter?: string;
|
||||
groupSearch?: string;
|
||||
groupSelect?: string[];
|
||||
groupTransformer?: GroupTransformer;
|
||||
organizationTransformer?: OrganizationTransformer;
|
||||
},
|
||||
@@ -373,6 +374,7 @@ export async function readMicrosoftGraphGroups(
|
||||
expand: options?.groupExpand,
|
||||
search: options?.groupSearch,
|
||||
filter: options?.groupFilter,
|
||||
select: options?.groupSelect,
|
||||
},
|
||||
options?.queryMode,
|
||||
)) {
|
||||
@@ -535,6 +537,7 @@ export async function readMicrosoftGraphOrg(
|
||||
groupExpand?: string;
|
||||
groupSearch?: string;
|
||||
groupFilter?: string;
|
||||
groupSelect?: string[];
|
||||
queryMode?: 'basic' | 'advanced';
|
||||
userTransformer?: UserTransformer;
|
||||
groupTransformer?: GroupTransformer;
|
||||
@@ -571,6 +574,7 @@ export async function readMicrosoftGraphOrg(
|
||||
queryMode: options.queryMode,
|
||||
groupSearch: options.groupSearch,
|
||||
groupFilter: options.groupFilter,
|
||||
groupSelect: options.groupSelect,
|
||||
groupTransformer: options.groupTransformer,
|
||||
organizationTransformer: options.organizationTransformer,
|
||||
});
|
||||
|
||||
+1
-1
@@ -176,7 +176,6 @@ export class MicrosoftGraphOrgEntityProvider implements EntityProvider {
|
||||
const provider = this.options.provider;
|
||||
const { markReadComplete } = trackProgress(logger);
|
||||
const client = MicrosoftGraphClient.create(this.options.provider);
|
||||
|
||||
const { users, groups } = await readMicrosoftGraphOrg(
|
||||
client,
|
||||
provider.tenantId,
|
||||
@@ -186,6 +185,7 @@ export class MicrosoftGraphOrgEntityProvider implements EntityProvider {
|
||||
userGroupMemberSearch: provider.userGroupMemberSearch,
|
||||
groupFilter: provider.groupFilter,
|
||||
groupSearch: provider.groupSearch,
|
||||
groupSelect: provider.groupSelect,
|
||||
queryMode: provider.queryMode,
|
||||
groupTransformer: this.options.groupTransformer,
|
||||
userTransformer: this.options.userTransformer,
|
||||
|
||||
+1
@@ -113,6 +113,7 @@ export class MicrosoftGraphOrgReaderProcessor implements CatalogProcessor {
|
||||
groupExpand: provider.groupExpand,
|
||||
groupFilter: provider.groupFilter,
|
||||
groupSearch: provider.groupSearch,
|
||||
groupSelect: provider.groupSelect,
|
||||
queryMode: provider.queryMode,
|
||||
userTransformer: this.userTransformer,
|
||||
groupTransformer: this.groupTransformer,
|
||||
|
||||
Reference in New Issue
Block a user