Read queryMode from the microsoftGraphOrg config
Closes: backstage/backstage#13638 Signed-off-by: Niels Henrik Hagen <nhhagen@gmail.com>
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user