From e105a5a159f91ed3576d71930e36ee08071760ac Mon Sep 17 00:00:00 2001 From: Chris Rodriguez Date: Wed, 7 Feb 2024 14:41:50 -0500 Subject: [PATCH] General improvements and bug fixes --- Api/Services/mysql/permissionsService.js | 110 +++++++++--------- Api/specification/poam-manager.yaml | 39 ++++++- .../poam-app/src/app/app-routing.module.ts | 26 +---- Front End/poam-app/src/app/app.module.ts | 8 +- Front End/poam-app/src/app/auth.guard.ts | 30 +---- .../asset-processing/asset/asset.component.ts | 20 ++-- .../collection/collection.component.ts | 45 ++++--- .../label/label.component.html | 2 +- .../poam-details/poam-details.component.ts | 7 +- .../user-processing/user/user.component.ts | 66 ++++++----- 10 files changed, 177 insertions(+), 176 deletions(-) diff --git a/Api/Services/mysql/permissionsService.js b/Api/Services/mysql/permissionsService.js index ecb61ca8..2224d198 100644 --- a/Api/Services/mysql/permissionsService.js +++ b/Api/Services/mysql/permissionsService.js @@ -133,59 +133,6 @@ exports.getPermissions_UserCollection = async function getPermissions_UserCollec } exports.postPermission = async function postPermission(req, res, next) { - // res.status(201).json({ message: "postPermission (Service) Method called successfully" }); - // console.log("postPermission req.body: ", req.body) - if (!req.body.userId) { - console.info('postPermissions userId not provided.'); - return next({ - status: 422, - errors: { - userId: 'is required', - } - }); - } - - if (!req.body.collectionId) { - console.info('postPermissions collectionId not provided.'); - return next({ - status: 422, - errors: { - collectionId: 'is required', - } - }); - } - - if (!req.body.canOwn) req.body.canOwn = 0; - if (!req.body.canMaintain) req.body.canMaintain = 0; - if (!req.body.canApprove) req.body.canApprove = 0; - if (!req.body.canView) req.body.canView = 1; - - try { - let connection - connection = await dbUtils.pool.getConnection() - - let sql_query = `INSERT INTO poamtracking.collectionpermissions (userId, collectionId, canOwn, canMaintain, canApprove, canView) values (?, ?, ?, ?, ?, ?)` - - await connection.query(sql_query, [req.body.userId, req.body.collectionId, req.body.canOwn, req.body.canMaintain, req.body.canApprove, req.body.canView]) - await connection.release() - - const message = new Object() - message.userId = req.body.userId - message.collectionId = req.body.collectionId - message.canOwn = req.body.canOwn - message.canMaintain = req.body.canMaintain - message.canApprove = req.body.canApprove - message.canView = req.body.canView - return(message) - } - catch (error) { - let errorResponse = { null: "null" } - await connection.release() - return errorResponse; - } -} - -exports.putPermission = async function putPermission(req, res, next) { // res.status(201).json({ message: "putPermission (Service) Method called successfully" }); // console.log("postPermission req.body: ", req.body) if (!req.body.userId) { @@ -199,11 +146,11 @@ exports.putPermission = async function putPermission(req, res, next) { } if (!req.body.collectionId) { - console.info('postPermissions collectionId not provided.'); + console.info('postPermission collectionId not provided.'); return next({ status: 422, errors: { - collectionId: 'is required', + oldCollectionId: 'is required', } }); } @@ -239,6 +186,59 @@ exports.putPermission = async function putPermission(req, res, next) { } } +exports.putPermission = async function putPermission(req, res, next) { + // res.status(201).json({ message: "postPermission (Service) Method called successfully" }); + // console.log("postPermission req.body: ", req.body) + if (!req.body.userId) { + console.info('postPermissions userId not provided.'); + return next({ + status: 422, + errors: { + userId: 'is required', + } + }); + } + + if (!req.body.oldCollectionId) { + console.info('putPermissions oldCollectionId not provided.'); + return next({ + status: 422, + errors: { + collectionId: 'is required', + } + }); + } + + if (!req.body.canOwn) req.body.canOwn = 0; + if (!req.body.canMaintain) req.body.canMaintain = 0; + if (!req.body.canApprove) req.body.canApprove = 0; + if (!req.body.canView) req.body.canView = 1; + + try { + let connection + connection = await dbUtils.pool.getConnection() + + let sql_query = "UPDATE poamtracking.collectionpermissions SET collectionId= ?, canOwn= ?, canMaintain= ?, canApprove= ?, canView= ? WHERE userId = ? AND collectionId = ?;" + await connection.query(sql_query, [req.body.newCollectionId, req.body.canOwn, req.body.canMaintain, req.body.canApprove, req.body.canView, req.body.userId, req.body.oldCollectionId]) + + await connection.release() + + const message = new Object() + message.userId = req.body.userId + message.collectionId = req.body.collectionId + message.canOwn = req.body.canOwn + message.canMaintain = req.body.canMaintain + message.canApprove = req.body.canApprove + message.canView = req.body.canView + return(message) + } + catch (error) { + let errorResponse = { null: "null" } + await connection.release() + return errorResponse; + } +} + exports.deletePermission = async function deletePermission(req, res, next) { // res.status(201).json({ message: "deletePermission (Service) Method called successfully" }); if (!req.params.userId) { diff --git a/Api/specification/poam-manager.yaml b/Api/specification/poam-manager.yaml index b9459917..589239be 100644 --- a/Api/specification/poam-manager.yaml +++ b/Api/specification/poam-manager.yaml @@ -1261,7 +1261,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/user_Permissions' + $ref: '#/components/schemas/update_user_Permissions' responses: '200': description: return the updated collection permission response @@ -1270,7 +1270,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/user_Permissions' + $ref: '#/components/schemas/update_user_Permissions' default: description: unexpected error content: @@ -3004,6 +3004,41 @@ components: userEmail: type: string + update_user_Permissions: + type: object + required: + - userId + - oldCollectionId + - newCollectionId + - canOwn + - canMaintain + - canApprove + - canView + additionalProperties: true + properties: + userId: + type: integer + oldCollectionId: + type: integer + newCollectionId: + type: integer + canOwn: + type: boolean + canMaintain: + type: boolean + canApprove: + type: boolean + canView: + type: boolean + firstName: + type: string + lastName: + type: string + fullName: + type: string + userEmail: + type: string + userCreateOrReplace: required: - userName diff --git a/Front End/poam-app/src/app/app-routing.module.ts b/Front End/poam-app/src/app/app-routing.module.ts index 6eae5e2b..8518e9c3 100644 --- a/Front End/poam-app/src/app/app-routing.module.ts +++ b/Front End/poam-app/src/app/app-routing.module.ts @@ -10,38 +10,18 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -//import { HomeComponent } from './pages/home/home.component'; -//import { PagesComponent } from './pages/pages.component'; import { PoamDetailsComponent } from './pages/poam-processing/poam-details/poam-details.component'; import { PoamApproveComponent } from './pages/poam-processing/poam-approve/poam-approve.component'; -import { NbAuthComponent, NbLoginComponent, NbRegisterComponent, NbLogoutComponent, NbRequestPasswordComponent, NbResetPasswordComponent } from '@nebular/auth'; import { AuthGuard } from './auth.guard' import { AppComponent } from './app.component'; import { LoginComponent } from './pages/login/login.component'; import { LoginCallbackComponent } from './pages/login/loginCallback.component'; -import { DoDConsentComponent } from './pages/dod-consent/dod-consent.component'; const routes: Routes = [ - //{ path: 'home', canActivate: [AuthGuard], component: PagesComponent}, - { - path: '', canActivate: [AuthGuard], - component: AppComponent, //LoginComponent, //AppComponent, - }, - { - path: 'login', - component: LoginComponent, - }, - { - path: 'callback', - component: LoginCallbackComponent, //AppComponent, - }, - //{ path: 'home', canActivate: [AuthGuard], loadChildren: () => import('./pages/poam-processing/poams.module').then(m => m.PoamsModule) }, - //{path: '', redirectTo: 'poam-processing', pathMatch: 'full'}, - //{ path: '', loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule)}, - //{ path: 'auth', loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule)}, - // { path: 'pages', canActivate: [AuthGuard], loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule)}, - + { path: '', canActivate: [AuthGuard], component: AppComponent }, + { path: 'login', component: LoginComponent }, + { path: 'callback', component: LoginCallbackComponent }, { path: 'consent', loadChildren: () => import('./pages/dod-consent/dod-consent.module').then(m => m.DoDConsentModule) }, { path: 'approve', loadChildren: () => import('./pages/poam-processing/poam-approve/poam-approve.module').then(m => m.PoamApproveModule) }, { path: 'asset-processing', canActivate: [AuthGuard], loadChildren: () => import('./pages/asset-processing/asset-processing.module').then(m => m.AssetProcessingModule) }, diff --git a/Front End/poam-app/src/app/app.module.ts b/Front End/poam-app/src/app/app.module.ts index 0790d4de..1cfcfe09 100644 --- a/Front End/poam-app/src/app/app.module.ts +++ b/Front End/poam-app/src/app/app.module.ts @@ -7,6 +7,7 @@ ! CONDITIONS OF THE LICENSE. !######################################################################## */ + import { TreeGridModule } from '@syncfusion/ej2-angular-treegrid'; import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_BASE_HREF } from "@angular/common"; @@ -15,14 +16,13 @@ import { FormsModule } from '@angular/forms'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { PoamDetailsComponent } from './pages/poam-processing/poam-details/poam-details.component'; -import { DoDConsentComponent } from './pages/dod-consent/dod-consent.component'; import { CoreModule } from '../app/@core/core.module'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NbActionsModule, NbCardModule, NbDialogModule, NbMenuModule, NbSidebarModule, NbLayoutModule, NbAlertModule, NbSelectModule, NbIconModule, NbSpinnerModule, NbThemeModule, NbStepperModule, NbCheckboxModule, NbButtonModule, NbInputModule, NbAccordionModule} from '@nebular/theme'; import { LoginComponent } from './pages/login/login.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { HttpClientModule } from '@angular/common/http'; -import { NbPasswordAuthStrategy, NbAuthModule, NbAuthResult, NbAuthJWTToken, NbOAuth2AuthStrategy, NbOAuth2ResponseType, NbOAuth2GrantType, NbAuthOAuth2Token, } from '@nebular/auth'; +import { NbAuthModule, NbOAuth2AuthStrategy, NbOAuth2ResponseType, NbOAuth2GrantType, NbAuthOAuth2Token, } from '@nebular/auth'; import { AuthGuard } from "./auth.guard"; import { NbSecurityModule } from '@nebular/security'; import { SharedModule } from './Shared/shared.module'; @@ -57,21 +57,19 @@ function initializeKeycloak(keycloak: KeycloakService) { AppComponent, LoginComponent, PoamDetailsComponent, - //DoDConsentComponent ], providers: [AuthGuard, KeycloakService, { provide: APP_BASE_HREF, useValue: "/" }, - //{ provide: APP_INITIALIZER, useFactory: initializeKeycloak, multi: true, deps: [KeycloakService]}, KeycloakService, { provide: APP_INITIALIZER, useFactory: initializeKeycloak, multi: true, deps: [KeycloakService] }, + AuthGuard, KcAuthService, RoleProvider, FileUploadService, ], bootstrap: [AppComponent], exports: [ - // PoamDetailsComponent, ], imports: [ TreeGridModule, diff --git a/Front End/poam-app/src/app/auth.guard.ts b/Front End/poam-app/src/app/auth.guard.ts index 88cdc9f3..fe7dbb30 100644 --- a/Front End/poam-app/src/app/auth.guard.ts +++ b/Front End/poam-app/src/app/auth.guard.ts @@ -10,36 +10,8 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router'; -import { AuthService } from './auth'; -import { tap } from 'rxjs/operators'; import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular'; -// @Injectable() -// export class AuthGuard implements CanActivate { - -// constructor( -// private authService: AuthService, -// private router: Router -// ) {} - -// canActivate() { -// console.log("Can activate...") -// return this.authService.isAuthenticated() -// .pipe( -// tap(authenticated => { -// if (!authenticated) { -// console.log("Can activate navigating to login NOT authenticated") -// this.router.navigate(['login']); -// } else { - -// //authenticated = !authenticated; -// console.log("authenticated: ", authenticated) -// } -// }), -// ); -// } -// } - @Injectable({ providedIn: 'root' }) @@ -58,4 +30,4 @@ isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Prom resolve(granted); }) } -} +} \ No newline at end of file diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts index 0628ffe7..055cf85b 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts +++ b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts @@ -214,20 +214,22 @@ export class AssetComponent implements OnInit { updateLabelEditorConfig() { let settings = this.assetLabelsSettings; - let labelListValues = this.labelList.map((label: any) => ({ - title: label.labelName, - value: label.labelId - })); - if (settings.columns['labelId']?.editor?.type === 'list' && settings.columns['labelId'].editor.config) { let editorConfig = settings.columns['labelId'].editor.config as ListEditorSettings; - editorConfig.list = labelListValues; - this.assetLabelsSettings = Object.assign({}, settings); - } else { - console.error('Editor configuration for labelId is not set or not of type list'); + const labelPlaceholder = { title: 'Select a Label...', value: '' }; + editorConfig.list = [ + labelPlaceholder, + ...this.labelList.map((label: any) => ({ + title: label.labelName, + value: label.labelId + })) + ]; } + this.assetLabelsSettings = Object.assign({}, settings); } + + setCollection(collectionId: any) { this.collection = null; this.tcollectionName = ''; diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts index 14f31faf..d5cbc7ed 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts +++ b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts @@ -17,6 +17,8 @@ import { SubSink } from 'subsink'; //import { LocalDataSource } from 'angular2-smart-table'; import { ExcelDataService } from '../../../Shared/utils/excel-data.service' import { ListEditorSettings, Settings } from 'angular2-smart-table'; +import { isNullOrUndef } from 'chart.js/dist/helpers/helpers.core'; +import { UsersService } from '../../user-processing/users.service'; @Component({ selector: 'ngx-collection', @@ -108,8 +110,10 @@ export class CollectionComponent implements OnInit, OnChanges { }; private subs = new SubSink() + user: any; constructor(private collectionService: CollectionsService, + private userService: UsersService, private dialogService: NbDialogService, ) { } @@ -176,27 +180,32 @@ export class CollectionComponent implements OnInit, OnChanges { } setApprovers() { - let settings = this.collectionApproverSettings; - let approverList: any[] = []; - - if (this.collectionApprovers) { - this.collectionApprovers.forEach((approver: any) => { - let listValue = { - title: approver.fullName, - value: approver.userId - }; - approverList.push(listValue); + + if (this.collectionApprovers) + { + this.collectionApprovers = []; + this.userService.getCurrentUser().subscribe((user: any) => { + this.user = user; + this.collectionService.getCollectionApprovers(this.user.lastCollectionAccessedId).subscribe((response: any) => { + this.collectionApprovers = response.collectionApprovers; }); + }); } - - if (settings.columns['userId']?.editor?.type === 'list' && settings.columns['userId'].editor.config) { - let editorConfig = settings.columns['userId'].editor.config as ListEditorSettings; - editorConfig.list = approverList; - // Trigger change detection if necessary - this.collectionApproverSettings = Object.assign({}, settings); - } else { - console.error('Editor configuration for userId is not set or not of type list'); + + let settings = this.collectionApproverSettings; +if (settings.columns['userId']?.editor?.type === 'list') { + let editorConfig = settings.columns['userId'].editor.config as ListEditorSettings; + const approverPlaceholder = { title: 'Select an Approver...', value: '' }; + + editorConfig.list = [ + approverPlaceholder, + ...this.collectionApprovers.map((approver: any) => ({ + title: approver.fullName, + value: approver.userId, + })) + ]; } + this.collectionApproverSettings = Object.assign({}, settings); } diff --git a/Front End/poam-app/src/app/pages/label-processing/label/label.component.html b/Front End/poam-app/src/app/pages/label-processing/label/label.component.html index cdb5a4b4..c1b00782 100644 --- a/Front End/poam-app/src/app/pages/label-processing/label/label.component.html +++ b/Front End/poam-app/src/app/pages/label-processing/label/label.component.html @@ -30,7 +30,7 @@
-
diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts index 856d615c..91d2636d 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts @@ -143,7 +143,7 @@ export class PoamDetailsComponent implements OnInit { if (userId === undefined || userId === null) { return ''; } - var user = this.collectionApprovers.collectionApprovers.find((tl: any) => tl.userId === userId); + var user = this.collectionApprovers.collectionApprovers.find((tl: any) => tl.userId === parseInt(userId, 10)); return user ? user.fullName : userId.toString(); } catch (error) { console.error("Error in valuePrepareFunction: ", error); @@ -202,7 +202,7 @@ export class PoamDetailsComponent implements OnInit { isEditable: true, isAddable: true, valuePrepareFunction: (_cell: any, row: any) => { - return row.value + return (row.value) ? row.value : ' ' }, }, }, @@ -397,7 +397,6 @@ export class PoamDetailsComponent implements OnInit { this.poamAssignees = []; this.collectionApprovers = []; this.collectionApprovers = collectionApprovers; - this.collectionOwners = []; this.collectionMaintainers = []; if (this.collectionUsers.permissions) { @@ -438,7 +437,7 @@ export class PoamDetailsComponent implements OnInit { this.poamAssets = assets.poamAssets; this.poamAssignees = assignees.poamAssignees; this.poamApprovers = poamApprovers.poamApprovers; - this.collectionApprovers = collectionApprovers.collectionApprovers; + this.collectionApprovers = collectionApprovers; //console.log("Collection Approvers: " + this.collectionApprovers); //console.log("collectionApprovers: ", this.collectionApprovers) if (this.collectionApprovers.length > 0 && (this.poamApprovers == undefined || this.poamApprovers.length ==0)) { diff --git a/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts b/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts index 7b220246..b8ec51bd 100644 --- a/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts +++ b/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts @@ -100,6 +100,7 @@ export class UserComponent implements OnInit { type: 'list', config: { list: [ + { value: '', title: 'Select a Permission...' }, { value: '1', title: 'True' }, { value: '0', title: 'False' } ], @@ -118,6 +119,7 @@ export class UserComponent implements OnInit { type: 'list', config: { list: [ + { value: '', title: 'Select a Permission...' }, { value: '1', title: 'True' }, { value: '0', title: 'False' } ], @@ -135,6 +137,7 @@ export class UserComponent implements OnInit { type: 'list', config: { list: [ + { value: '', title: 'Select a Permission...' }, { value: '1', title: 'True' }, { value: '0', title: 'False' } ], @@ -152,6 +155,7 @@ export class UserComponent implements OnInit { type: 'list', config: { list: [ + { value: '', title: 'Select a Permission...' }, { value: '1', title: 'True' }, { value: '0', title: 'False' } ], @@ -242,16 +246,17 @@ export class UserComponent implements OnInit { // Check if 'editor' and 'config' are defined and if 'config' is of type 'ListEditorSettings' if (collectionIdSettings.editor && collectionIdSettings.editor.type === 'list') { let editorConfig = collectionIdSettings.editor.config as ListEditorSettings; - editorConfig.list = this.collectionList.map((collection: any) => ({ - title: collection.title, - value: collection.value - })); - // Use Object.assign to ensure a new object reference is created - this.collectionPermissionsSettings = Object.assign({}, settings); - } else { - console.error('Editor configuration for collectionId is not set or not of type list'); + const collectionPlaceholder = { title: 'Select a Collection...', value: '' }; + editorConfig.list = [ + collectionPlaceholder, + ...this.collectionList.map((collection: any) => ({ + title: collection.title, + value: collection.value + })) + ]; } - } + this.collectionPermissionsSettings = Object.assign({}, settings); + } onSubmit() { @@ -280,19 +285,21 @@ export class UserComponent implements OnInit { if (Array.isArray(this.collectionList)) { let settings = this.collectionPermissionsSettings; - // Ensure the 'editor' and 'config' properties exist and are of the correct type - if (settings.columns['collectionId']?.editor?.type === 'list') { - let editorConfig = settings.columns['collectionId'].editor.config as ListEditorSettings; - editorConfig.list = this.collectionList.map((collection: any) => ({ - title: collection.title, - value: collection.value - })); - this.collectionPermissionsSettings = { ...settings }; - } else { - console.error('Editor configuration for collectionId is not set or not of type list'); + // Use index signature syntax to access 'collectionId' + let collectionIdSettings = settings.columns['collectionId']; + // Check if 'editor' and 'config' are defined and if 'config' is of type 'ListEditorSettings' + if (collectionIdSettings.editor && collectionIdSettings.editor.type === 'list') { + let editorConfig = collectionIdSettings.editor.config as ListEditorSettings; + const collectionPlaceholder = { title: 'Select a Collection...', value: '' }; + editorConfig.list = [ + collectionPlaceholder, + ...this.collectionList.map((collection: any) => ({ + title: collection.title, + value: collection.value + })) + ]; } - } else { - console.error('Available collection data is not available'); + this.collectionPermissionsSettings = Object.assign({}, settings); } } @@ -303,7 +310,7 @@ export class UserComponent implements OnInit { event.newData.canOwn && event.newData.canMaintain && event.newData.canApprove && - event.netData.canView + event.newData.canView ) { var collection_index = this.collectionList.findIndex((e: any) => e.collectionId == event.newData.collectionId); @@ -315,8 +322,8 @@ export class UserComponent implements OnInit { } let collectionPermission = { - userId: +this.user.userId, - collectionId: +parseInt(event.newData.collectionId, 10), + userId: this.user.userId, + collectionId: parseInt(event.newData.collectionId, 10), canOwn: (+event.newData.canOwn) ? true : false, canMaintain: (+event.newData.canMaintain) ? true : false, canApprove: (+event.newData.canApprove) ? true : false, @@ -332,7 +339,7 @@ export class UserComponent implements OnInit { } else { console.log("Failed to create entry. Invalid input."); - this.invalidData("missing data, unable to insert"); + this.invalidData("Missing data, unable to insert."); event.confirm.reject(); } } @@ -342,7 +349,6 @@ export class UserComponent implements OnInit { if (this.user.userId && event.newData.collectionId ) { - let permission = this.data; var collection_index = this.collectionList.findIndex((e: any) => e.collectionId == event.newData.collectionId); @@ -353,7 +359,8 @@ export class UserComponent implements OnInit { let collectionPermission = { userId: this.user.userId, - collectionId: event.newData.collectionId, + oldCollectionId: parseInt(event.data.collectionId, 10), + newCollectionId: parseInt(event.newData.collectionId, 10), canOwn: (+event.newData.canOwn) ? true : false, canMaintain: (+event.newData.canMaintain) ? true : false, canApprove: (+event.newData.canApprove) ? true : false, @@ -362,15 +369,14 @@ export class UserComponent implements OnInit { this.isLoading = true; this.userService.updatePermission(collectionPermission).subscribe(permissionData => { - //this.data = permissionData; - //console.log("after updatePermission, permissionData: ",permissionData) + this.isLoading = false; event.confirm.resolve(); this.getData(); }); } else { console.log("Failed to update entry. Invalid input."); - this.invalidData("missing data, unable to update"); + this.invalidData("Missing data, unable to update."); event.confirm.reject(); } }