Merge pull request #13737 from nhhagen/fix-msgraph-querymode

Read queryMode from the microsoftGraphOrg config
This commit is contained in:
Johan Haals
2022-09-20 08:59:24 +02:00
committed by GitHub
4 changed files with 35 additions and 0 deletions
+18
View File
@@ -144,6 +144,15 @@ export interface Config {
*/
clientSecret?: string;
/**
* By default, the Microsoft Graph API only provides the basic feature set
* for querying. Certain features are limited to advanced query capabilities
* (see https://docs.microsoft.com/en-us/graph/aad-advanced-queries)
* and need to be enabled.
*
* Some features like `$expand` are not available for advanced queries, though.
*/
queryMode?: string;
user?: {
/**
* The "expand" argument to apply to users.
@@ -230,6 +239,15 @@ export interface Config {
*/
clientSecret: string;
/**
* By default, the Microsoft Graph API only provides the basic feature set
* for querying. Certain features are limited to advanced query capabilities
* (see https://docs.microsoft.com/en-us/graph/aad-advanced-queries)
* and need to be enabled.
*
* Some features like `$expand` are not available for advanced queries, though.
*/
queryMode?: string;
user?: {
/**
* The filter to apply to extract users.
@@ -162,6 +162,7 @@ describe('readProviderConfigs', () => {
clientId: 'clientId',
clientSecret: 'clientSecret',
authority: 'https://login.example.com/',
queryMode: 'advanced',
user: {
expand: 'manager',
filter: 'accountEnabled eq true',
@@ -185,6 +186,7 @@ describe('readProviderConfigs', () => {
clientId: 'clientId',
clientSecret: 'clientSecret',
authority: 'https://login.example.com/',
queryMode: 'advanced',
userExpand: 'manager',
userFilter: 'accountEnabled eq true',
groupExpand: 'member',
@@ -261,6 +261,15 @@ export function readProviderConfig(
const groupSearch = config.getOptionalString('group.search');
const groupSelect = config.getOptionalStringArray('group.select');
const queryMode = config.getOptionalString('queryMode');
if (
queryMode !== undefined &&
queryMode !== 'basic' &&
queryMode !== 'advanced'
) {
throw new Error(`queryMode must be one of: basic, advanced`);
}
const userGroupMemberFilter = config.getOptionalString(
'userGroupMember.filter',
);
@@ -300,6 +309,7 @@ export function readProviderConfig(
groupFilter,
groupSearch,
groupSelect,
queryMode,
userGroupMemberFilter,
userGroupMemberSearch,
};