Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions apps/proxy-auth/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions apps/proxy-auth/src/app/element.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 2 additions & 0 deletions apps/proxy-auth/src/app/otp/send-otp/send-otp.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
[userToken]="authToken"
[pass]="isRolePermission"
[theme]="theme"
[exclude_role_ids]="exclude_role_ids"
[include_role_ids]="include_role_ids"
></proxy-user-management>
<div [ngClass]="{ 'subscription-dialog': type === 'subscription' && isPreview }" *ngIf="type === 'subscription'">
<proxy-subscription-center
Expand Down
2 changes: 2 additions & 0 deletions apps/proxy-auth/src/app/otp/send-otp/send-otp.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class SendOtpComponent extends BaseComponent implements OnInit, OnDestroy
@Input() public loginRedirectUrl: string;
@Input() public theme: string;
@Input() public version: string = SendOtpCenterVersion.V1;
@Input() public exclude_role_ids: any[] = [];
@Input() public include_role_ids: any[] = [];
@Input() public input_fields: string = InputFields.TOP;
@Input() public show_social_login_icons: boolean = false;
set css(type: NgStyle['ngStyle']) {
Expand Down
6 changes: 5 additions & 1 deletion apps/proxy-auth/src/app/otp/service/otp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,18 @@ export class OtpService {
authToken: string,
itemsPerPage?: number,
pageNo?: number,
search?: string
search?: string,
exclude_role_ids?: number[],
include_role_ids?: number[]
): Observable<BaseResponse<IWidgetResponse, IGetWidgetData>> {
this.options.headers['proxy_auth_token'] = authToken;
const url = otpVerificationUrls.getCompanyUsers(this.clientUrl);
const queryParams: any = {};
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<any>(url, queryParams, this.options);
}
public createPermission(
Expand Down
9 changes: 8 additions & 1 deletion apps/proxy-auth/src/app/otp/store/actions/otp.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
44 changes: 23 additions & 21 deletions apps/proxy-auth/src/app/otp/store/effects/otp.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
);
})
);
})
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
@ViewChild('editPermissionDialog') editPermissionDialog!: TemplateRef<any>;
@ViewChild('addPermissionDialog') addPermissionDialog!: TemplateRef<any>;
Expand Down Expand Up @@ -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,
})
);
}
Expand Down
Loading