diff --git a/api/Services/migrations/lib/mysql-import.js b/api/Services/migrations/lib/mysql-import.js index fe3cc067..8bf39268 100644 --- a/api/Services/migrations/lib/mysql-import.js +++ b/api/Services/migrations/lib/mysql-import.js @@ -61,7 +61,7 @@ class Importer { * @returns {undefined} */ setEncoding(encoding) { - var supported_encodings = [ + const supported_encodings = [ 'utf8', 'ucs2', 'utf16le', @@ -106,8 +106,8 @@ class Importer { return new Promise(async (resolve, reject) => { try { await this._connect(); - var files = await this._getSQLFilePaths(...input); - var error = null; + const files = await this._getSQLFilePaths(...input); + const error = null; await slowLoop(files, (file, index, next) => { if (error) { next(); @@ -163,8 +163,8 @@ class Importer { reject(err); return; } - var queries = new queryParser(queriesString).queries; - var error = null; + const queries = new queryParser(queriesString).queries; + const error = null; slowLoop(queries, (query, index, next) => { if (error) { next(); @@ -260,8 +260,8 @@ class Importer { */ _getSQLFilePaths(...paths) { return new Promise(async (resolve, reject) => { - var full_paths = []; - var error = null; + const full_paths = []; + const error = null; paths = [].concat.apply([], paths); // flatten array of paths await slowLoop(paths, async (filepath, index, next) => { if (error) { @@ -270,16 +270,16 @@ class Importer { } try { await this._fileExists(filepath); - var stat = await this._statFile(filepath); + const stat = await this._statFile(filepath); if (stat.isFile()) { if (filepath.toLowerCase().substring(filepath.length - 4) === '.sql') { full_paths.push(path.resolve(filepath)); } next(); } else if (stat.isDirectory()) { - var more_paths = await this._readDir(filepath); + const more_paths = await this._readDir(filepath); more_paths = more_paths.map(p => path.join(filepath, p)); - var sql_files = await this._getSQLFilePaths(...more_paths); + const sql_files = await this._getSQLFilePaths(...more_paths); full_paths.push(...sql_files); next(); } else { @@ -394,12 +394,12 @@ class queryParser { // Check to see if a new delimiter is being assigned checkNewDelimiter(char) { - var buffer_str = this.buffer.join('').toLowerCase().trim(); + const buffer_str = this.buffer.join('').toLowerCase().trim(); if (buffer_str === 'delimiter' && !this.quoteType) { this.seekingDelimiter = true; this.buffer = []; } else { - var isNewLine = char === "\n" || char === "\r"; + const isNewLine = char === "\n" || char === "\r"; if (isNewLine && this.seekingDelimiter) { this.seekingDelimiter = false; this.delimiter = this.buffer.join('').trim(); @@ -410,7 +410,7 @@ class queryParser { // Check if the current char is a quote checkQuote(char) { - var isQuote = (char === '"' || char === "'") && !this.escaped; + const isQuote = (char === '"' || char === "'") && !this.escaped; if (isQuote && this.quoteType === char) { this.quoteType = false; } else if (isQuote && !this.quoteType) { @@ -420,7 +420,7 @@ class queryParser { // Check if we're at the end of the query checkEndOfQuery() { - var demiliterFound = false; + const demiliterFound = false; if (!this.quoteType && this.buffer.length >= this.delimiter.length) { demiliterFound = this.buffer.slice(-this.delimiter.length).join('') === this.delimiter; } diff --git a/api/Services/poamMilestoneService.js b/api/Services/poamMilestoneService.js index 6046f2ed..dc7c3706 100644 --- a/api/Services/poamMilestoneService.js +++ b/api/Services/poamMilestoneService.js @@ -188,7 +188,7 @@ exports.deletePoamMilestone = async function deletePoamMilestone(poamId, milesto let sql = "DELETE FROM cpat.poammilestones WHERE poamId= ? AND milestoneId = ?"; await connection.query(sql, [poamId, milestoneId]); - const action = `Milestone Deleted.`; + let action = `Milestone Deleted.`; if (requestBody.requestorId) { if (requestBody.extension == true) { action = `Extension milestone deleted.`; diff --git a/client/src/app/Shared/notifications/notifications-popover/notifications-popover.component.html b/client/src/app/Shared/notifications/notifications-popover/notifications-popover.component.html index e70252d9..4d111613 100644 --- a/client/src/app/Shared/notifications/notifications-popover/notifications-popover.component.html +++ b/client/src/app/Shared/notifications/notifications-popover/notifications-popover.component.html @@ -19,7 +19,7 @@

{{ notification.title }}

- +

{{ notification.message }}

{{ notification.timestamp | date:'short' }} diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index 45dcf401..b5b99629 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -24,7 +24,7 @@ const routes: Routes = [ { path: 'poam-processing', canActivate: [AuthGuard], loadChildren: () => import('./pages/poam-processing/poam-processing.module').then(m => m.PoamProcessingModule) }, { path: 'marketplace', canActivate: [AuthGuard], loadChildren: () => import('./pages/marketplace/marketplace.module').then(m => m.MarketplaceModule) }, { path: 'unauthorized', component: UnauthorizedComponent }, - { path: '' || '**', redirectTo: 'consent' }, + { path: '**', redirectTo: 'consent' }, ]; @NgModule({ imports: [RouterModule.forRoot(routes)], diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html index 5a135083..0ca56940 100644 --- a/client/src/app/app.component.html +++ b/client/src/app/app.component.html @@ -12,7 +12,7 @@
- C-PAT + C-PAT
@@ -20,6 +20,7 @@ icon="pi pi-bell text-2xl" [badge]="notificationCount" (click)="op.toggle($event)" + (onKeyUp)="op.toggle($event)" styleClass="p-button-text p-button-rounded p-button-plain notification-button"> diff --git a/client/src/app/pages/admin-processing/admin-processing.component.html b/client/src/app/pages/admin-processing/admin-processing.component.html index 64d56f11..05f93d11 100644 --- a/client/src/app/pages/admin-processing/admin-processing.component.html +++ b/client/src/app/pages/admin-processing/admin-processing.component.html @@ -3,7 +3,8 @@ + (click)="statusCard.component ? openModal(statusCard.component) : triggerFileInput()" + (onKeyUp)="statusCard.component ? openModal(statusCard.component) : triggerFileInput()">
diff --git a/client/src/app/pages/admin-processing/collection-processing/collection-processing.component.html b/client/src/app/pages/admin-processing/collection-processing/collection-processing.component.html index 36aeb26d..43061c52 100644 --- a/client/src/app/pages/admin-processing/collection-processing/collection-processing.component.html +++ b/client/src/app/pages/admin-processing/collection-processing/collection-processing.component.html @@ -22,7 +22,7 @@ - + {{col}} diff --git a/client/src/app/pages/admin-processing/collection-processing/collection/collection.component.html b/client/src/app/pages/admin-processing/collection-processing/collection/collection.component.html index 53d5995b..273ab71e 100644 --- a/client/src/app/pages/admin-processing/collection-processing/collection/collection.component.html +++ b/client/src/app/pages/admin-processing/collection-processing/collection/collection.component.html @@ -59,7 +59,7 @@
- - + +
diff --git a/client/src/app/pages/admin-processing/stigmanager-admin/stigmanager-admin.component.html b/client/src/app/pages/admin-processing/stigmanager-admin/stigmanager-admin.component.html index d7e76cb3..d15e1286 100644 --- a/client/src/app/pages/admin-processing/stigmanager-admin/stigmanager-admin.component.html +++ b/client/src/app/pages/admin-processing/stigmanager-admin/stigmanager-admin.component.html @@ -28,6 +28,7 @@ class="import-button" styleClass="p-button-info" (click)="importSTIGManagerCollection()" + (onKeyUp)="importSTIGManagerCollection()" pTooltip="If a STIG Manager collection has previously been imported, importing again will update the collection and relative assets with current data from STIG Manager." tooltipPosition="left" [style]="{'width':'100%'}" diff --git a/client/src/app/pages/admin-processing/user-processing/user-processing.component.html b/client/src/app/pages/admin-processing/user-processing/user-processing.component.html index 2f6412e3..4d870643 100644 --- a/client/src/app/pages/admin-processing/user-processing/user-processing.component.html +++ b/client/src/app/pages/admin-processing/user-processing/user-processing.component.html @@ -22,7 +22,7 @@
- + {{col}} @@ -42,7 +42,7 @@ - + {{col}} diff --git a/client/src/app/pages/admin-processing/user-processing/user/user.component.html b/client/src/app/pages/admin-processing/user-processing/user/user.component.html index 501a3a89..435a928f 100644 --- a/client/src/app/pages/admin-processing/user-processing/user/user.component.html +++ b/client/src/app/pages/admin-processing/user-processing/user/user.component.html @@ -86,10 +86,10 @@ - + - + {{col.header}} diff --git a/client/src/app/pages/asset-processing/asset-processing.component.html b/client/src/app/pages/asset-processing/asset-processing.component.html index 546e0573..6ca0e8da 100644 --- a/client/src/app/pages/asset-processing/asset-processing.component.html +++ b/client/src/app/pages/asset-processing/asset-processing.component.html @@ -19,7 +19,7 @@ - +
- +
Asset ID
- +
Asset Name
- +
Description
- +
IP Address
- +
MAC Address @@ -64,7 +64,7 @@ - + {{asset.assetId}} {{asset.assetName}} {{asset.description}} diff --git a/client/src/app/pages/asset-processing/asset/asset.component.html b/client/src/app/pages/asset-processing/asset/asset.component.html index dc856720..df9035d3 100644 --- a/client/src/app/pages/asset-processing/asset/asset.component.html +++ b/client/src/app/pages/asset-processing/asset/asset.component.html @@ -56,10 +56,10 @@ - + - Label + Label @@ -105,6 +105,6 @@

{{invalidDataMessage}}

- +
diff --git a/client/src/app/pages/import-processing/stigmanager-import/stigmanager-import.component.html b/client/src/app/pages/import-processing/stigmanager-import/stigmanager-import.component.html index 415b7857..fc6759e6 100644 --- a/client/src/app/pages/import-processing/stigmanager-import/stigmanager-import.component.html +++ b/client/src/app/pages/import-processing/stigmanager-import/stigmanager-import.component.html @@ -9,7 +9,7 @@ - + {{col}} diff --git a/client/src/app/pages/label-processing/label-processing.component.html b/client/src/app/pages/label-processing/label-processing.component.html index bd13d038..2e8c16ea 100644 --- a/client/src/app/pages/label-processing/label-processing.component.html +++ b/client/src/app/pages/label-processing/label-processing.component.html @@ -17,7 +17,7 @@ - +
- +
Label ID
- +
Name
- +
Description @@ -50,7 +50,7 @@ - + {{label.labelId}} {{label.labelName}} {{label.description}} diff --git a/client/src/app/pages/marketplace/marketplace.component.html b/client/src/app/pages/marketplace/marketplace.component.html index d59aac4d..ee53f647 100644 --- a/client/src/app/pages/marketplace/marketplace.component.html +++ b/client/src/app/pages/marketplace/marketplace.component.html @@ -24,7 +24,7 @@
- +

{{ theme.themeDescription }}

@@ -44,7 +44,7 @@
- +

{{ theme.themeDescription }}

diff --git a/client/src/app/pages/poam-processing/poam-components/poam-assigned-grid/poam-assigned-grid.component.html b/client/src/app/pages/poam-processing/poam-components/poam-assigned-grid/poam-assigned-grid.component.html index 54738287..3566621a 100644 --- a/client/src/app/pages/poam-processing/poam-components/poam-assigned-grid/poam-assigned-grid.component.html +++ b/client/src/app/pages/poam-processing/poam-components/poam-assigned-grid/poam-assigned-grid.component.html @@ -21,7 +21,7 @@ - + {{ col }} diff --git a/client/src/app/pages/poam-processing/poam-components/poam-grid/poam-grid.component.html b/client/src/app/pages/poam-processing/poam-components/poam-grid/poam-grid.component.html index 2f49460c..a8e26903 100644 --- a/client/src/app/pages/poam-processing/poam-components/poam-grid/poam-grid.component.html +++ b/client/src/app/pages/poam-processing/poam-components/poam-grid/poam-grid.component.html @@ -15,49 +15,49 @@ - +
- +
POAM ID
- +
POAM Status
- +
Adjusted Severity
- +
Submitter
- +
Submitted Date
- +
Scheduled Completion Date
- + Manage diff --git a/client/src/app/pages/poam-processing/poam-details/poam-details.component.html b/client/src/app/pages/poam-processing/poam-details/poam-details.component.html index a8c48e2e..dbf1f0b4 100644 --- a/client/src/app/pages/poam-processing/poam-details/poam-details.component.html +++ b/client/src/app/pages/poam-processing/poam-details/poam-details.component.html @@ -151,8 +151,8 @@ - Members Assigned - + Members Assigned + @@ -191,11 +191,11 @@ - Approver - Approval Status - Approved Date - Comments - + Approver + Approval Status + Approved Date + Comments + @@ -240,8 +240,8 @@ - Asset - + Asset + @@ -363,10 +363,10 @@ - Milestone Comments - Milestone Date - Milestone Status - + Milestone Comments + Milestone Date + Milestone Status + @@ -432,8 +432,8 @@ - Label - + Label + @@ -490,6 +490,6 @@

{{errorMessage}}

- +
diff --git a/client/src/app/pages/poam-processing/poam-details/poam-details.component.ts b/client/src/app/pages/poam-processing/poam-details/poam-details.component.ts index 022f8b2a..c9f804bf 100644 --- a/client/src/app/pages/poam-processing/poam-details/poam-details.component.ts +++ b/client/src/app/pages/poam-processing/poam-details/poam-details.component.ts @@ -25,6 +25,21 @@ import { ImportService } from '../../import-processing/import.service'; import { ConfirmationService, MessageService } from 'primeng/api'; import { Table } from 'primeng/table'; +function getRoleFromAccessLevel(accessLevel: number): string { + switch (accessLevel) { + case 1: + return 'viewer'; + case 2: + return 'submitter'; + case 3: + return 'approver'; + case 4: + return 'cat1approver'; + default: + return 'none'; + } +} + interface Permission { userId: number; collectionId: number; @@ -223,18 +238,18 @@ export class PoamDetailsComponent implements OnInit, OnDestroy { }; const selectedPermissions = this.payload.collections.find((x: { collectionId: any; }) => x.collectionId == this.payload.lastCollectionAccessedId); - let myRole = ''; + let myRole: string; if (!selectedPermissions && !this.user.isAdmin) { myRole = 'none'; + } else if (this.user.isAdmin) { + myRole = 'admin'; + } else if (selectedPermissions) { + myRole = getRoleFromAccessLevel(selectedPermissions.accessLevel); } else { - myRole = (this.user.isAdmin) ? 'admin' : - (selectedPermissions.accessLevel === 1) ? 'viewer' : - (selectedPermissions.accessLevel === 2) ? 'submitter' : - (selectedPermissions.accessLevel === 3) ? 'approver' : - (selectedPermissions.accessLevel === 4) ? 'cat1approver' : - 'none'; + myRole = 'none'; } + this.payload.role = myRole; this.showApprove = ['admin', 'cat1approver', 'approver'].includes(this.payload.role); this.showClose = ['admin', 'cat1approver', 'approver', 'submitter'].includes(this.payload.role); diff --git a/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.html b/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.html index 27d7cc46..d8e69112 100644 --- a/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.html +++ b/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.html @@ -43,10 +43,10 @@ - Milestone Comments - Milestone Date - Milestone Status - + Milestone Comments + Milestone Date + Milestone Status + diff --git a/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss b/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss index 2c82a160..d6d62e11 100644 --- a/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss +++ b/client/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss @@ -21,13 +21,6 @@ margin-bottom: 0.5rem; } -.p-field input, -.p-field p-dropdown, -.p-field p-autoComplete, -.p-field textarea { - width: 100%; -} - p-table { margin-top: 1rem; } diff --git a/client/src/app/pages/poam-processing/poam-log/poam-log.component.html b/client/src/app/pages/poam-processing/poam-log/poam-log.component.html index 983292a9..aeb8e7a6 100644 --- a/client/src/app/pages/poam-processing/poam-log/poam-log.component.html +++ b/client/src/app/pages/poam-processing/poam-log/poam-log.component.html @@ -13,9 +13,9 @@ - Timestamp - User - Action + Timestamp + User + Action