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

Reference pull request for full details. #43

Merged
merged 1 commit into from
Mar 7, 2024
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
10 changes: 5 additions & 5 deletions Api/Models/poamMilestone.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.INTEGER,
allowNull: false
},
milestoneTitle: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: ''
},
milestoneDate: {
type: DataTypes.DATEONLY,
allowNull: true,
Expand All @@ -24,6 +19,11 @@ module.exports = (sequelize, DataTypes) => {
allowNull: true,
defaultValue: ''
},
milestoneStatus: {
type: DataTypes.STRING(10),
allowNull: true,
defaultValue: 'Pending'
},
}, {
freezeTableName: true,
timestamps: false,
Expand Down
14 changes: 7 additions & 7 deletions Api/Services/mysql/poamMilestoneService.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ exports.postPoamMilestone = async function postPoamMilestone(req, res, next) {
});
}

if (!req.body.milestoneTitle) req.body.milestoneTitle = null;
if (!req.body.milestoneDate) req.body.milestoneDate = null;
if (!req.body.milestoneComments) req.body.milestoneComments = null;
if (!req.body.milestoneStatus) req.body.milestoneStatus = null;
let connection;
try {
connection = await dbUtils.pool.getConnection();

let sql_query = `INSERT INTO poamtracking.poamMilestones (poamId, milestoneTitle, milestoneDate, milestoneComments) values (?, ?, ?, ?)`;
let sql_query = `INSERT INTO poamtracking.poamMilestones (poamId, milestoneDate, milestoneComments, milestoneStatus) values (?, ?, ?, ?)`;

await connection.query(sql_query, [
req.params.poamId,
req.body.milestoneTitle,
req.body.milestoneDate,
req.body.milestoneComments,
req.body.milestoneStatus,
]);

let sql =
Expand Down Expand Up @@ -134,19 +134,19 @@ exports.putPoamMilestone = async function putPoamMilestone(req, res, next) {
});
}

if (!req.body.milestoneTitle) req.body.milestoneTitle = null;
if (!req.body.milestoneDate) req.body.milestoneDate = null;
if (!req.body.milestoneComments) req.body.milestoneComments = null;
if (!req.body.milestoneStatus) req.body.milestoneStatus = null;
let connection;
try {
connection = await dbUtils.pool.getConnection();

let sql_query = `UPDATE poamtracking.poammilestones SET milestoneTitle= ?, milestoneDate = ?, milestoneComments = ? WHERE poamId = ? AND milestoneId = ?`;
let sql_query = `UPDATE poamtracking.poammilestones SET milestoneDate = ?, milestoneComments = ?, milestoneStatus = ? WHERE poamId = ? AND milestoneId = ?`;

await connection.query(sql_query, [
req.body.milestoneTitle,
req.body.milestoneDate,
req.body.milestoneComments,
req.body.milestoneStatus,
req.params.poamId,
req.params.milestoneId,
]);
Expand Down Expand Up @@ -192,7 +192,7 @@ exports.deletePoamMilestone = async function deletePoamMilestone(
return next({
status: 422,
errors: {
milestoneTitle: "is required",
milestoneId: "is required",
},
});
}
Expand Down
3 changes: 3 additions & 0 deletions Api/Services/mysql/usersService.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ module.exports.generateJWT = async function (previousPayload, jwtSignOptions, us
} else if (this.lastCollectionAccessedId) {
payload.lastCollectionAccessedId = this.lastCollectionAccessedId;
}
else if (user.accountStataus === 'Pending') {
console.log("User account is pending, not setting payload...");
}
else {
// console.log("No lastCollectionAccessedId, not setting payload.lastCollectionAccessedId at all...")
writeLog.writeLog(4, "usersService", 'info', req.userObject.username, req.userObject.displayName, { event: 'No lastCollectionAccessedId, not setting payload.lastCollectionAccessedId at all...' })
Expand Down
12 changes: 6 additions & 6 deletions Api/specification/poam-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2995,35 +2995,35 @@ components:
type: integer
poamId:
type: integer
milestoneTitle:
type: string
milestoneDate:
type: string
format: date
milestoneComments:
type: string
milestoneStatus:
type: string

PoamMilestoneRequest:
type: object
properties:
poamId:
type: integer
milestoneTitle:
type: string
milestoneDate:
type: string
milestoneComments:
type: string
milestoneStatus:
type: string

PoamMilestoneUpdateRequest:
type: object
properties:
milestoneTitle:
type: string
milestoneDate:
type: string
milestoneComments:
type: string
milestoneStatus:
type: string
description: Schema for updating a milestone. All fields are optional, allowing partial updates.

register:
Expand Down
20 changes: 10 additions & 10 deletions Database/POAM_Tracking_Tool_Data_Model.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ CREATE TABLE `poamtracking`.`user` (
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastAccess` datetime DEFAULT NULL,
`lastCollectionAccessedId` int NOT NULL DEFAULT '0',
`accountStatus` varchar(45) NOT NULL DEFAULT 'Pending',
`fullName` varchar(225) DEFAULT NULL,
`accountStatus` varchar(25) NOT NULL DEFAULT 'Pending',
`fullName` varchar(100) DEFAULT NULL,
`defaultTheme` varchar(20) DEFAULT 'dark',
`isAdmin` int NOT NULL DEFAULT '0',
PRIMARY KEY (`userId`),
Expand All @@ -32,8 +32,8 @@ CREATE TABLE `poamtracking`.`asset` (
`assetName` VARCHAR(255) NOT NULL,
`fullyQualifiedDomainName` VARCHAR(255) DEFAULT NULL,
`collectionId` INT NOT NULL,
`description` VARCHAR(75) DEFAULT NULL,
`ipAddress` VARCHAR(20) DEFAULT NULL,
`description` VARCHAR(255) DEFAULT NULL,
`ipAddress` VARCHAR(50) DEFAULT NULL,
`macAddress` VARCHAR(50) DEFAULT NULL,
`nonComputing` TINYINT(1) DEFAULT '0',
`metadata` JSON,
Expand All @@ -50,7 +50,7 @@ CREATE TABLE `poamtracking`.`asset` (

CREATE TABLE `poamtracking`.`poamassets` (
`poamId` int NOT NULL,
`assetId` varchar(50) NOT NULL,
`assetId` int NOT NULL,
PRIMARY KEY (`poamId`,`assetId`),
KEY `poamAssetsAssetId` (`assetId`) /*!80000 INVISIBLE */,
KEY `poamAssetPoamId` (`poamId`)
Expand All @@ -72,8 +72,8 @@ CREATE TABLE `poamtracking`.`assetlabels` (

CREATE TABLE `poamtracking`.`label` (
`labelId` int NOT NULL AUTO_INCREMENT,
`description` varchar(75) DEFAULT NULL,
`labelName` varchar(30) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`labelName` varchar(50) NOT NULL,
`poamCount` int NOT NULL DEFAULT '0',
PRIMARY KEY (`labelId`),
UNIQUE KEY `labelName_UNIQUE` (`labelName`)
Expand Down Expand Up @@ -103,9 +103,9 @@ CREATE TABLE `poamtracking`.`poamapprovers` (
CREATE TABLE `poamtracking`.`poammilestones` (
`milestoneId` INT NOT NULL AUTO_INCREMENT,
`poamId` int NOT NULL,
`milestoneTitle` varchar(255) DEFAULT NULL,
`milestoneDate` date DEFAULT NULL,
`milestoneComments` varchar(2000) DEFAULT NULL,
`milestoneComments` varchar(2000) DEFAULT '',
`milestoneStatus` varchar(10) DEFAULT 'Pending',
PRIMARY KEY (`milestoneId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Expand Down Expand Up @@ -136,7 +136,7 @@ CREATE TABLE `poamtracking`.`poam` (
`iavmNumber` varchar(25) DEFAULT '',
`aaPackage` varchar(50) DEFAULT '',
`vulnerabilityId` varchar(255) DEFAULT '',
`description` varchar(255) DEFAULT '',
`description` varchar(2000) DEFAULT '',
`rawSeverity` varchar(25) DEFAULT '',
`adjSeverity` varchar(25) DEFAULT '',
`scheduledCompletionDate` date DEFAULT '1900-01-01',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { NbDialogRef } from '@nebular/theme';
selector: 'confirmation-dialog',
styleUrls: ['./confirmation-dialog.component.scss'],
template: `
<nb-card>
<nb-card-header>
<nb-card style="width: auto; max-width: 40vw; height: auto; max-height: 20vh;">
<nb-card-header style="text-align: center;">
<h3> {{ options.header }} </h3>
</nb-card-header>
<nb-card-body>
<nb-card-body style="text-align: center;">
<p> {{ options.body }} </p>
</nb-card-body>
<nb-card-footer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
!#######################################################################
! C-PATTM SOFTWARE
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file
! crane_C_PAT.1_license.txt, which is part of this software package. BY
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND
! CONDITIONS OF THE LICENSE.
!########################################################################
*/

import { Component, OnInit } from '@angular/core';
import { DefaultEditor } from 'angular2-smart-table';
import { parseISO } from 'date-fns';
Expand Down Expand Up @@ -27,12 +37,7 @@ export class SmartTableDatepickerComponent extends DefaultEditor implements OnIn

onChange(event: any) {
const date: Date = event instanceof Date ? event : new Date(event);
const formattedDate = this.formatDate(date);
this.cell.setValue(formattedDate);
this.cell.setValue(date.toString());
this.date = date;
}

private formatDate(date: Date): string {
return date.toISOString().substring(0, 10);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
!#######################################################################
! C-PATTM SOFTWARE
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file
! crane_C_PAT.1_license.txt, which is part of this software package. BY
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND
! CONDITIONS OF THE LICENSE.
!########################################################################
*/

import { Component, OnInit } from '@angular/core';
import { DefaultEditor } from 'angular2-smart-table';

Expand All @@ -21,4 +31,4 @@ export class SmartTableInputComponent extends DefaultEditor implements OnInit {
onChange(event: any) {
this.cell.setValue(event);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
!#######################################################################
! C-PATTM SOFTWARE
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file
! crane_C_PAT.1_license.txt, which is part of this software package. BY
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND
! CONDITIONS OF THE LICENSE.
!########################################################################
*/

import { Component, OnInit } from '@angular/core';
import { DefaultEditor } from 'angular2-smart-table';

Expand All @@ -21,4 +31,4 @@ export class SmartTableInputDisabledComponent extends DefaultEditor implements O
onChange(event: any) {
this.cell.setValue(event);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
!#######################################################################
! C-PATTM SOFTWARE
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file
! crane_C_PAT.1_license.txt, which is part of this software package. BY
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND
! CONDITIONS OF THE LICENSE.
!########################################################################
*/

import { Component, OnInit } from '@angular/core';
import { DefaultEditor, ListEditorSettings } from 'angular2-smart-table';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/*
!#######################################################################
! C-PATTM SOFTWARE
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file
! crane_C_PAT.1_license.txt, which is part of this software package. BY
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND
! CONDITIONS OF THE LICENSE.
!########################################################################
*/

import { Component, OnInit } from '@angular/core';
import { DefaultEditor } from 'angular2-smart-table';

@Component({
selector: 'smart-table-textarea',
template: `
<textarea nbInput fullWidth [(ngModel)]="value" (ngModelChange)="onChange($event)" class="smartTableTextarea"></textarea>
<textarea nbInput fullWidth style="font-size: 14px;" maxlength="2000" [(ngModel)]="value" (ngModelChange)="onChange($event)" class="smartTableTextarea"></textarea>
`,
})
export class SmartTableTextareaComponent extends DefaultEditor implements OnInit {
Expand All @@ -21,4 +31,4 @@ export class SmartTableTextareaComponent extends DefaultEditor implements OnInit
onChange(event: any) {
this.cell.setValue(event);
}
}
}
15 changes: 0 additions & 15 deletions Front End/poam-app/src/app/add-days.pipe.ts

This file was deleted.

4 changes: 0 additions & 4 deletions Front End/poam-app/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ import { PoamApproveComponent } from './pages/poam-processing/poam-approve/poam-
import { PoamExtendComponent } from './pages/poam-processing/poam-extend/poam-extend.component';
import { AuthGuard } from './auth.guard'
import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { LoginCallbackComponent } from './pages/login/loginCallback.component';


const routes: Routes = [
{ 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: 'extend', loadChildren: () => import('./pages/poam-processing/poam-extend/poam-extend.module').then(m => m.PoamExtendModule) },
Expand Down
2 changes: 0 additions & 2 deletions Front End/poam-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,8 @@ export class AppComponent implements OnInit, OnDestroy {
this.userService.postUser(newUser).subscribe(result => {
console.log("User name: " + newUser.userName + " has been added, account status is PENDING");
this.user = newUser;
// Further processing if needed after user creation
});
} else {
// Handle other kinds of errors
console.error('An error occurred:', error.message);
}
}
Expand Down
2 changes: 0 additions & 2 deletions Front End/poam-app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { PoamDetailsComponent } from './pages/poam-processing/poam-details/poam-
import { CoreModule } from '../app/@core/core.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NbActionsModule, NbAutocompleteModule, NbCardModule, NbDialogModule, NbMenuModule, NbSidebarModule, NbLayoutModule, NbAlertModule, NbSelectModule, NbIconModule, NbSpinnerModule, NbThemeModule, NbStepperModule, NbCheckboxModule, NbButtonModule, NbInputModule, NbAccordionModule, NbDatepickerModule} from '@nebular/theme';
import { LoginComponent } from './pages/login/login.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { HttpClientModule } from '@angular/common/http';
import { NbAuthModule, NbOAuth2AuthStrategy, NbOAuth2ResponseType, NbOAuth2GrantType, NbAuthOAuth2Token, } from '@nebular/auth';
Expand Down Expand Up @@ -57,7 +56,6 @@ function initializeKeycloak(keycloak: KeycloakService) {
@NgModule({
declarations: [
AppComponent,
LoginComponent,
PoamDetailsComponent,
],
providers: [AuthGuard,
Expand Down
3 changes: 1 addition & 2 deletions Front End/poam-app/src/app/auth/auth-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

import { PASSWORD_AUTH_OPTIONS } from "./password-strategy-options";
import { NbAuthOptions, NbPasswordAuthStrategy, defaultAuthOptions } from "@nebular/auth";
import { deepExtend } from "@nebular/auth/helpers";

export const AUTH_OPTIONS: NbAuthOptions = {
strategies: [
NbPasswordAuthStrategy.setup(PASSWORD_AUTH_OPTIONS) // try just entering [Strategy, options]
NbPasswordAuthStrategy.setup(PASSWORD_AUTH_OPTIONS)
],
forms: {
login: {
Expand Down
Loading
Loading