Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fleet api integration and mfa page changes #1156

Merged
merged 4 commits into from
Mar 3, 2023
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
8 changes: 5 additions & 3 deletions Auth0Templates/Mfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ <h2 class="govuk-cookie-banner__heading govuk-heading-m">Cookies on Public Procu
<div class="govuk-breadcrumbs">
<ol class="govuk-breadcrumbs__list">
<li class="govuk-breadcrumbs__list-item">
<a style="color:#0b0c0c" class="govuk-breadcrumbs__link navigation-text" href="javascript:;" onclick="goBack()">Sign in</a>
<a style="color: #0b0c0c !important;" class="govuk-breadcrumbs__link navigation-text" href="javascript:;" onclick="goBack()">Sign in</a>
</li>
<li class="govuk-breadcrumbs__list-item">
<span class="govuk-breadcrumbs__link">Additional security</span>
Expand Down Expand Up @@ -960,9 +960,11 @@ <h2 class="govuk-heading-l mfa-head-l">New User Instructions</h2>
<p class="govuk-body-s">Follow the instructions on screen to download the app.</p>
</li>
<li data-title="3">
<p class="govuk-body-s">When it has downloaded, open the app.</p>
<p class="govuk-body-s">When it has downloaded, open the app.<br>
Use the app to scan the QR code on the right hand side of this page.
</p>
</li>
<li data-title="3">
<li data-title="4">
<p class="govuk-body-s">Enter the passcode displayed on your device, in the box under the QR code on the right hand side of this page.</p>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1 *ngIf="isEdit!= true" class="govuk-heading-xl page-title">{{ 'ADD_USERS_GROU
</button>
<button type="button" (click)="onCancelClick()" class="govuk-button govuk-button--secondary"
data-module="govuk-button" *ngIf="!isEdit">
Create group with no users and roles
Create group with no users and {{showRoleView === true ? 'roles': (showRoleView == false ? 'services' : '')}}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class ManageGroupEditUsersComponent
usersTableHeaders = ['NAME', 'EMAIL', 'SELECT_USER'];
usersColumnsToDisplay = ['name', 'userName'];
userGridSource: CheckBoxUserListGridSource[] = [];

public showRoleView:boolean = environment.appSetting.hideSimplifyRole
constructor(
protected uiStore: Store<UIState>,
private router: Router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">
There is a problem
</h2>
<div class="govuk-error-summary__body">
<a href="javascript:;" (click)="navigateBackToGroups()"> This group is configured with multifactor(additional security) enabled roles. However, there are users who are not configured for additional security. Please review users and roles in the group</a>
<a href="javascript:;" (click)="navigateBackToGroups()"> This group is configured with multifactor(additional security) enabled {{showRoleView === true ? 'roles': (showRoleView == false ? 'services' : '')}}. However, there are users who are not configured for additional security. Please review users and {{showRoleView === true ? 'roles': (showRoleView == false ? 'services' : '')}} in the group</a>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ManageGroupErrorComponent extends BaseComponent {

editingGroupId: number = 0;
routeData: any = {};
public showRoleView:boolean = environment.appSetting.hideSimplifyRole

constructor(private activatedRoute: ActivatedRoute,private router: Router, protected uiStore: Store<UIState>,private authService: AuthService, protected viewportScroller: ViewportScroller, protected scrollHelper: ScrollHelper) {
super(uiStore,viewportScroller,scrollHelper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<h1 class="govuk-heading-xl page-title">{{ 'MANAGE_GROUPS' | translate }}</h1>
<div class="manage-groups-bg">
<p>Manage large numbers of users all at once. You can give your group a name, add users and assign them roles.</p>
<p>Manage large numbers of users all at once. You can give your group a name, add users and assign them {{showRoleView === true ? 'roles': (showRoleView == false ? 'services' : '')}}.</p>
</div>
<button type="button" (click)="onAddClick()" class="govuk-button govuk-button--secondary"
data-module="govuk-button">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Group, GroupList } from "src/app/models/organisationGroup";
import { WrapperOrganisationGroupService } from "src/app/services/wrapper/wrapper-org--group-service";
import { ScrollHelper } from "src/app/services/helper/scroll-helper.services";
import { ViewportScroller } from "@angular/common";
import { environment } from "src/environments/environment";

@Component({
selector: 'app-manage-group-list',
Expand All @@ -22,6 +23,7 @@ import { ViewportScroller } from "@angular/common";
]
})
export class ManageGroupListComponent extends BaseComponent implements OnInit {
public showRoleView:boolean = environment.appSetting.hideSimplifyRole
groupList: GroupList;
organisationId: string;
searchText: string = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<div class="fleet_accept">
<h1 class="govuk-heading-xl">Fleet Portal access verification</h1>
<p *ngIf="userInfo.responce === 1" class="govuk-body-l">You have successfully accepted Fleet Portal role for user {{userInfo.userName}}</p>
<p *ngIf="userInfo.responce === 1" class="govuk-body-l">You have successfully accepted Fleet Portal {{showRoleView === true ? 'role': (showRoleView == false ? 'service' : '')}} for user {{userInfo.userName}}</p>
<p *ngIf="userInfo.responce === 2" class="govuk-body-l">You have denied access to Fleet Portal for user {{userInfo.userName}}</p>
<a href="javascript:;" class="navigation-text" routerLink="/home">Return to dashboard</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { environment } from 'src/environments/environment';

@Component({
selector: 'app-role-request-success',
Expand All @@ -10,6 +11,7 @@ export class RoleRequestSuccessComponent implements OnInit {

public userInfo:any;
public isOrgAdmin: boolean = false;
public showRoleView:boolean = environment.appSetting.hideSimplifyRole

constructor(private ActivatedRoute: ActivatedRoute) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { Subscription } from 'rxjs';
})
export class ManageUserAddSingleUserDetailComponent
extends FormBaseComponent
implements OnInit, OnDestroy {
implements OnInit,OnDestroy {
public organisationId: string;
public userProfileRequestInfo: UserProfileRequestInfo;
public userProfileResponseInfo: UserProfileResponseInfo;
Expand Down Expand Up @@ -76,7 +76,7 @@ export class ManageUserAddSingleUserDetailComponent
private selectedRoleIds: number[] = []
public isInvalidDomain: boolean = false
public subscription: Subscription = new Subscription;
public showRoleView: boolean = environment.appSetting.hideSimplifyRole
public showRoleView:boolean = environment.appSetting.hideSimplifyRole
@ViewChildren('input') inputs!: QueryList<ElementRef>;
constructor(
private organisationGroupService: WrapperOrganisationGroupService,
Expand All @@ -93,7 +93,7 @@ export class ManageUserAddSingleUserDetailComponent
private authService: AuthService,
private locationStrategy: LocationStrategy,
private organisationService: WrapperOrganisationService,
private sharedDataService: SharedDataService
private sharedDataService:SharedDataService
) {
super(
viewportScroller,
Expand Down Expand Up @@ -130,7 +130,7 @@ export class ManageUserAddSingleUserDetailComponent
this.ciiOrganisationId = localStorage.getItem('cii_organisation_id') || '';
localStorage.removeItem('user_approved_role');
if (queryParams.data) {
this.subscription = this.sharedDataService.userEditDetails.subscribe((data) => {
this.subscription = this.sharedDataService.userEditDetails.subscribe((data)=>{
this.routeData = JSON.parse(atob(queryParams.data));
this.isEdit = this.routeData['isEdit'];
this.editingUserName = sessionStorage.getItem(SessionStorageKey.ManageUserUserName) ?? '';
Expand Down Expand Up @@ -310,8 +310,6 @@ export class ManageUserAddSingleUserDetailComponent
this.orgRoles = await this.organisationGroupService
.getOrganisationRoles(this.organisationId)
.toPromise();

console.log("this.orgRoles", this.orgRoles)
this.orgRoles.map((role) => {
let userRole =
this.userProfileResponseInfo.detail.rolePermissionInfo &&
Expand Down Expand Up @@ -498,7 +496,8 @@ export class ManageUserAddSingleUserDetailComponent

if (!filterAlreadyExistRole) {
this.selectedApproveRequiredRole.push(role.roleId)
} else {
}else
{
// Remove below line to seperate normal and approval required role. It is added as we will not be using seperate api. Only user update api will be used
this.selectedRoleIds.push(role.roleId);
}
Expand Down Expand Up @@ -794,18 +793,18 @@ export class ManageUserAddSingleUserDetailComponent
onUserRoleChecked(obj: any, isChecked: boolean) {
var roleKey = obj.roleKey;
if (isChecked == true) {
this.setMfaStatus(roleKey, true)
this.setMfaStatus(roleKey,true)
if (obj.pendingStatus === true) {
this.removePendingRole(obj)
}
}
else if (isChecked == false) {
this.setMfaStatus(roleKey, false)
this.addPendingRole(obj)
this.setMfaStatus(roleKey,false)
this.addPendingRole(obj)
}
}

private setMfaStatus(roleKey: any, status: boolean) {
private setMfaStatus(roleKey: any,status:boolean) {
if (roleKey == 'ORG_ADMINISTRATOR') {
this.formGroup.controls['mfaEnabled'].setValue(status);
this.isAutoDisableMFA = status;
Expand All @@ -824,7 +823,7 @@ export class ManageUserAddSingleUserDetailComponent
}

// Removed below logic to avoid approval required seperate delete api call. Delete pending role will be handled in normal role put call.
private addPendingRole(obj: any) {
private addPendingRole(obj:any){
// if (obj.pendingStatus === true) {
// let filterRole = this.pendingRoledeleteDetails.find((element: number) => element == obj.roleId)
// if (filterRole === undefined) {
Expand Down Expand Up @@ -853,12 +852,12 @@ export class ManageUserAddSingleUserDetailComponent
this.subscription.unsubscribe()
}

public getDisbleRoleForService(orgRoleKey: any) {
if (orgRoleKey === 'ORG_DEFAULT_USER') {
return true
} else {
return null
}
public getDisbleRoleForService(orgRoleKey:any){
if(orgRoleKey === 'ORG_DEFAULT_USER'){
return true
} else {
return null
}

}
}
35 changes: 26 additions & 9 deletions src/app/pages/operation-success/operation-success.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<p class="govuk-body-l">{{ 'MY_ACCOUNT_UPDATE_SUCCESS' | translate }}</p>
<div class="govuk-form-group" *ngIf="approveRequiredRole != 'null'">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following role will be assigned after manual validation has been completed:
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following {{showRoleView === true ? 'role': (showRoleView == false ? 'service' : '')}} will be assigned after manual validation has been completed:
</legend>
<div class="govuk-checkboxes">
<div class="govuk-checkboxes" *ngIf="showRoleView">
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.roleName}}
<label class="govuk-label">{{role.accessRoleName}}
<span
*ngIf=" role.serviceName &&
role.roleKey != 'JAEGGER_SUPPLIER' &&
Expand All @@ -60,6 +60,13 @@
</ng-container>
</div>
</fieldset>
<div class="service_view" *ngIf="!showRoleView">
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.accessRoleName}}</label>
</div>
</ng-container>
</div>
</div>
<a href="javascript:;" class="navigation-text" (click)="onNavigateToProfileClick()">
{{ 'RETURN_TO_MANAGE_MY_ACCOUNT' | translate }}</a>
Expand Down Expand Up @@ -89,12 +96,12 @@
'INSTRUCTIONS_WILL_BE_EMAILED_TO_SETUP_ACCOUNT_PASSWORD' | translate }}</p>
<div class="govuk-form-group" *ngIf="approveRequiredRole != 'null'">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following role will be assigned after manual validation has been completed:
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following {{showRoleView === true ? 'role': (showRoleView == false ? 'service' : '')}} will be assigned after manual validation has been completed:
</legend>
<div class="govuk-checkboxes">
<div class="govuk-checkboxes" *ngIf="showRoleView">
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.roleName}}
<label class="govuk-label">{{role.accessRoleName}}
<span
*ngIf=" role.serviceName &&
role.roleKey != 'JAEGGER_SUPPLIER' &&
Expand All @@ -110,6 +117,11 @@
</ng-container>
</div>
</fieldset>
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.accessRoleName}}</label>
</div>
</ng-container>
</div>
<a href="javascript:;" class="navigation-text" (click)="onNavigateToManageUserClick()">
{{ 'RETURN_MANAGE_YOUR_USER_ACCOUNTS' | translate }}</a>
Expand All @@ -124,12 +136,12 @@
<p class="govuk-body-l">{{ 'USER_UPDATE_SUCCESS' | translate }}</p>
<div class="govuk-form-group" *ngIf="approveRequiredRole != 'null'">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following role will be assigned after manual validation has been completed:
<legend class="govuk-fieldset__legend" style="font-size: 22px;margin-top:30px;" *ngIf="approveRequiredRole.length > 0">The following {{showRoleView === true ? 'role': (showRoleView == false ? 'service' : '')}} will be assigned after manual validation has been completed:
</legend>
<div class="govuk-checkboxes">
<div class="govuk-checkboxes" *ngIf="showRoleView">
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.roleName}}
<label class="govuk-label">{{role.accessRoleName}}
<span
*ngIf=" role.serviceName &&
role.roleKey != 'JAEGGER_SUPPLIER' &&
Expand All @@ -145,6 +157,11 @@
</ng-container>
</div>
</fieldset>
<ng-container *ngFor="let role of approveRequiredRole">
<div class="govuk-__item">
<label class="govuk-label">{{role.accessRoleName}}</label>
</div>
</ng-container>
</div>
<a href="javascript:;" class="navigation-text" (click)="onNavigateToManageUserClick()">
{{ 'RETURN_MANAGE_YOUR_USER_ACCOUNTS' | translate }}</a>
Expand Down
23 changes: 21 additions & 2 deletions src/app/pages/operation-success/operation-success.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ScrollHelper } from 'src/app/services/helper/scroll-helper.services';
import { ViewportScroller } from '@angular/common';
import { Title } from '@angular/platform-browser';
import { SessionStorageKey } from 'src/app/constants/constant';
import { environment } from 'src/environments/environment';

@Component({
selector: 'app-operation-success',
Expand All @@ -24,7 +25,10 @@ import { SessionStorageKey } from 'src/app/constants/constant';
]
})
export class OperationSuccessComponent extends BaseComponent implements OnInit {
public showRoleView:boolean = environment.appSetting.hideSimplifyRole
operation: OperationEnum;
userServiceTableHeaders = ['NAME'];
userServiceColumnsToDisplay = ['accessRoleName',]
operationEnum = OperationEnum;
userName: string = '';
isOrgAdmin: boolean = false;
Expand All @@ -34,10 +38,25 @@ export class OperationSuccessComponent extends BaseComponent implements OnInit {
super(uiStore, viewportScroller, scrollHelper);
this.operation = parseInt(this.activatedRoute.snapshot.paramMap.get('operation') || '0');
this.userName = sessionStorage.getItem(SessionStorageKey.OperationSuccessUserName) ?? '';
this.approveRequiredRole = JSON.parse(localStorage.getItem('user_approved_role') || 'null' );
console.log("this.approveRequiredRole",this.approveRequiredRole)
this.approveRequiredRole = this.getSelectedRole(JSON.parse(localStorage.getItem('user_approved_role') || 'null' ))
}


public getSelectedRole(role:any):void{
let data:any=[]
role.forEach((f:any)=>{
let obj = {
accessRoleName: f.roleName,
serviceName: f.serviceName,
description:f.description,
serviceView:!this.showRoleView
}
data.push(obj)
})
return data
}


ngOnInit() {
this.isOrgAdmin = JSON.parse(localStorage.getItem('isOrgAdmin') || 'false');
let area: string = "";
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/user-profile/user-profile-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
}
}
await this.getApprovalRequriedRoles()
// await this.getPendingApprovalUserRole();
await this.getPendingApprovalUserRole();
await this.getOrgDetails()
await this.orgGroupService
.getOrganisationRoles(this.organisationId)
Expand Down
Loading