Commit 8bb33ff9 authored by Abhishek Mishra's avatar Abhishek Mishra
Browse files

Admin/User/Search: added (backward compatible) support to configure the search...

Admin/User/Search: added (backward compatible) support to configure the search API pick application IDs from env variable
No related merge requests found
Showing with 19 additions and 1 deletion
+19 -1
......@@ -14,5 +14,6 @@ FUSIONAUTH_HP_ADMIN_CONSOLE_APPLICATION_ID=
FUSIONAUTH_BASE_URL="https://auth.samarth.samagra.io"
FUSIONAUTH_API_KEY="bla"
ENCRYPTION_KEY="bla"
FUSIONAUTH_ADMIN_SEARCH_APPLICATION_IDS=["1", "2"] # JSON array of application IDs
# APP_abcd3f6f_45b8_4928_b978_a9906fd03f22={"host": "dummy.com", "encryption": {"enabled": true, "key": "veryhardkey"}} # the key "application_id" must be underscore(_) separated instead of hyphen(-). Also it must be prefixed with <APP_>
\ No newline at end of file
......@@ -119,10 +119,27 @@ export class FusionauthService {
startRow: number,
numberOfResults: number,
): Promise<{ total: number; users: Array<User> }> {
let allowedApplicationIds: Array<string> = [
process.env.FUSIONAUTH_APPLICATION_ID,
process.env.FUSIONAUTH_SHIKSHA_SATHI_HP_APPLICATION_ID,
];
if (
process.env.FUSIONAUTH_ADMIN_SEARCH_APPLICATION_IDS &&
JSON.parse(process.env.FUSIONAUTH_ADMIN_SEARCH_APPLICATION_IDS)
) {
// if env has configured the variable FUSIONAUTH_ADMIN_SEARCH_APPLICATION_IDS & it's a valid JSON, we use the new list of search
console.log('Dynamic search list found:');
allowedApplicationIds = JSON.parse(
process.env.FUSIONAUTH_ADMIN_SEARCH_APPLICATION_IDS,
);
}
const searchRequest = {
search: {
numberOfResults: numberOfResults,
query: this.queryGenService.queryUsersByApplicationIdAndQueryString([process.env.FUSIONAUTH_APPLICATION_ID, process.env.FUSIONAUTH_SHIKSHA_SATHI_HP_APPLICATION_ID], queryString),
query: this.queryGenService.queryUsersByApplicationIdAndQueryString(
allowedApplicationIds,
queryString,
),
sortFields: [
{
missing: 'username',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment