From 4f352db650dff080b821148d3d4075394d39f65d Mon Sep 17 00:00:00 2001 From: prakharlowanshi Date: Fri, 16 Jan 2026 12:27:58 +0530 Subject: [PATCH] provide the include and exculde filter in the script --- apps/proxy-auth/src/app/app.component.ts | 14 +++--- apps/proxy-auth/src/app/element.module.ts | 2 + .../app/otp/send-otp/send-otp.component.html | 2 + .../app/otp/send-otp/send-otp.component.ts | 2 + .../src/app/otp/service/otp.service.ts | 6 ++- .../src/app/otp/store/actions/otp.action.ts | 9 +++- .../src/app/otp/store/effects/otp.effects.ts | 44 ++++++++++--------- .../user-management.component.ts | 4 ++ 8 files changed, 54 insertions(+), 29 deletions(-) diff --git a/apps/proxy-auth/src/app/app.component.ts b/apps/proxy-auth/src/app/app.component.ts index a16f3920..916668d9 100644 --- a/apps/proxy-auth/src/app/app.component.ts +++ b/apps/proxy-auth/src/app/app.component.ts @@ -26,14 +26,16 @@ export class AppComponent extends BaseComponent implements OnInit, OnDestroy { public initOtpProvider() { if (!environment.production) { const sendOTPConfig = { - referenceId: '4512365m176216342869087ae458e09', - type: 'authorization', + // referenceId: '4512365m176216342869087ae458e09', + // type: 'authorization', // loginRedirectUrl: 'https://www.google.com', // showCompanyDetails: false, - // authToken: - // 'clV0YUt4UURVbzJYZTRwMHdBNkZ6QjZoay9qMmRRcjZhMGVXMGtCT1ZtdGNaelFxMmlNaGdNcEJuRy9UWmFSZHQvMHc0YnJYUHExakh5NDNGVjZMOEdXVmg3OG82R094Yk5tdE9XckxjUTV1dlNzUERXRWxaOWIwWm5JRmlMVHl5UmpZUHVDK2piOURJUi9IdytncFZBRWc5QnRyRDRVeUFOZlBCY1FST0FOZStISUVtK055VWNxaGduZWpGeUZxVWxYWjd6YXI2YTF0aGxHZTNka1BlQT09', - // type: 'user-management', - // theme: 'system', + authToken: + 'clV0YUt4UURVbzJYZTRwMHdBNkZ6QjZoay9qMmRRcjZhMGVXMGtCT1ZtdGNaelFxMmlNaGdNcEJuRy9UWmFSZHQvMHc0YnJYUHExakh5NDNGVjZMOEdXVmg3OG82R094Yk5tdE9XckxjUTV1dlNzUERXRWxaOWIwWm5JRmlMVHl5UmpZUHVDK2piOURJUi9IdytncFZBRWc5QnRyRDRVeUFOZlBCY1FST0FOZStISUVtK055VWNxaGduZWpGeUZxVWxYWjd6YXI2YTF0aGxHZTNka1BlQT09', + type: 'user-management', + exclude_role_ids: [2], + include_role_ids: [1], + theme: 'light', // isPreview: true, isLogin: true, target: '_self', diff --git a/apps/proxy-auth/src/app/element.module.ts b/apps/proxy-auth/src/app/element.module.ts index 8f5cca7c..fd28d85b 100644 --- a/apps/proxy-auth/src/app/element.module.ts +++ b/apps/proxy-auth/src/app/element.module.ts @@ -48,6 +48,8 @@ window['initVerification'] = (config: any) => { sendOtpElement.version = config?.version; sendOtpElement.input_fields = config?.input_fields; sendOtpElement.show_social_login_icons = config?.show_social_login_icons; + sendOtpElement.exclude_role_ids = config?.exclude_role_ids; + sendOtpElement.include_role_ids = config?.include_role_ids; sendOtpElement.target = config?.target ?? '_self'; sendOtpElement.css = config.style; if (!config.success || typeof config.success !== 'function') { diff --git a/apps/proxy-auth/src/app/otp/send-otp/send-otp.component.html b/apps/proxy-auth/src/app/otp/send-otp/send-otp.component.html index 201795b0..e1003946 100644 --- a/apps/proxy-auth/src/app/otp/send-otp/send-otp.component.html +++ b/apps/proxy-auth/src/app/otp/send-otp/send-otp.component.html @@ -63,6 +63,8 @@ [userToken]="authToken" [pass]="isRolePermission" [theme]="theme" + [exclude_role_ids]="exclude_role_ids" + [include_role_ids]="include_role_ids" >
> { this.options.headers['proxy_auth_token'] = authToken; const url = otpVerificationUrls.getCompanyUsers(this.clientUrl); @@ -150,6 +152,8 @@ export class OtpService { if (itemsPerPage) queryParams.itemsPerPage = itemsPerPage; if (pageNo !== undefined) queryParams.pageNo = pageNo + 1; // Convert 0-based to 1-based index if (search) queryParams.search = search; + if (exclude_role_ids?.length) queryParams.exclude_role_ids = exclude_role_ids.join(','); + if (include_role_ids?.length) queryParams.role_ids = include_role_ids.join(','); return this.http.get(url, queryParams, this.options); } public createPermission( diff --git a/apps/proxy-auth/src/app/otp/store/actions/otp.action.ts b/apps/proxy-auth/src/app/otp/store/actions/otp.action.ts index 38667183..b907313e 100644 --- a/apps/proxy-auth/src/app/otp/store/actions/otp.action.ts +++ b/apps/proxy-auth/src/app/otp/store/actions/otp.action.ts @@ -100,7 +100,14 @@ export const getPermissionsError = createAction( export const getCompanyUsers = createAction( '[OTP] Get Company Users', - props<{ authToken: string; itemsPerPage?: number; pageNo?: number; search?: string }>() + props<{ + authToken: string; + itemsPerPage?: number; + pageNo?: number; + search?: string; + exclude_role_ids?: number[]; + include_role_ids?: number[]; + }>() ); export const getCompanyUsersComplete = createAction('[OTP] Get Company Users Complete', props<{ response: any }>()); export const getCompanyUsersError = createAction( diff --git a/apps/proxy-auth/src/app/otp/store/effects/otp.effects.ts b/apps/proxy-auth/src/app/otp/store/effects/otp.effects.ts index ccdb3ff6..d6a0ade9 100644 --- a/apps/proxy-auth/src/app/otp/store/effects/otp.effects.ts +++ b/apps/proxy-auth/src/app/otp/store/effects/otp.effects.ts @@ -339,28 +339,30 @@ export class OtpEffects { getCompanyUsers$ = createEffect(() => this.actions$.pipe( ofType(otpActions.getCompanyUsers), - switchMap(({ authToken, itemsPerPage, pageNo, search }) => { - return this.otpService.getCompanyUsers(authToken, itemsPerPage, pageNo, search).pipe( - map((res: any) => { - if (res.status === 'success') { - return otpActions.getCompanyUsersComplete({ - response: res, + switchMap(({ authToken, itemsPerPage, pageNo, search, exclude_role_ids, include_role_ids }) => { + return this.otpService + .getCompanyUsers(authToken, itemsPerPage, pageNo, search, exclude_role_ids, include_role_ids) + .pipe( + map((res: any) => { + if (res.status === 'success') { + return otpActions.getCompanyUsersComplete({ + response: res, + }); + } + return otpActions.getCompanyUsersError({ + errors: errorResolver(res.message), + errorResponse: res, }); - } - return otpActions.getCompanyUsersError({ - errors: errorResolver(res.message), - errorResponse: res, - }); - }), - catchError((err) => { - return of( - otpActions.getCompanyUsersError({ - errors: errorResolver(err.errors), - errorResponse: err, - }) - ); - }) - ); + }), + catchError((err) => { + return of( + otpActions.getCompanyUsersError({ + errors: errorResolver(err.errors), + errorResponse: err, + }) + ); + }) + ); }) ) ); diff --git a/apps/proxy-auth/src/app/otp/user-management/user-management.component.ts b/apps/proxy-auth/src/app/otp/user-management/user-management.component.ts index 4724c24a..01048e6b 100644 --- a/apps/proxy-auth/src/app/otp/user-management/user-management.component.ts +++ b/apps/proxy-auth/src/app/otp/user-management/user-management.component.ts @@ -46,6 +46,8 @@ export class UserManagementComponent extends BaseComponent implements OnInit, Af @Input() public userToken: string; @Input() public pass: string; @Input() public theme: string; + @Input() public exclude_role_ids: any[] = []; + @Input() public include_role_ids: any[] = []; @ViewChild('addUserDialog') addUserDialog!: TemplateRef; @ViewChild('editPermissionDialog') editPermissionDialog!: TemplateRef; @ViewChild('addPermissionDialog') addPermissionDialog!: TemplateRef; @@ -871,6 +873,8 @@ export class UserManagementComponent extends BaseComponent implements OnInit, Af itemsPerPage: pageSize, pageNo: pageIndex, search: searchTerm, + exclude_role_ids: this.exclude_role_ids, + include_role_ids: this.include_role_ids, }) ); }