Skip to content

Commit

Permalink
feat: new appinfo implementation (NUWCDIVNPT#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig authored Oct 10, 2024
1 parent f584df5 commit f9cc74a
Show file tree
Hide file tree
Showing 52 changed files with 9,915 additions and 748 deletions.
1 change: 1 addition & 0 deletions .github/workflows/api-audit-test-coverage-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ env:
STIGMAN_SWAGGER_SERVER: http://localhost:64001/api
STIGMAN_SWAGGER_REDIRECT: http://localhost:64001/api-docs/oauth2-redirect.html
STIGMAN_DEV_RESPONSE_VALIDATION: logOnly
STIGMAN_EXPERIMENTAL_APPDATA: 'true'
NODE_V8_COVERAGE: /home/runner/work/stig-manager/stig-manager/api/source/coverage/tmp/

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/api-container-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
-e STIGMAN_DB_PASSWORD=stigman \
-e STIGMAN_API_AUTHORITY=http://127.0.0.1:8080/auth/realms/stigman \
-e STIGMAN_DEV_RESPONSE_VALIDATION=logOnly \
-e STIGMAN_EXPERIMENTAL_APPDATA=true \
${{ matrix.container.name }}
- name: Install test dependencies
Expand Down
12 changes: 10 additions & 2 deletions api/source/controllers/Operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ module.exports.setConfigurationItem = async function setConfigurationItem (req,

module.exports.getAppData = async function getAppData (req, res, next) {
try {
if (!config.experimental.appData) {
throw new SmError.NotFoundError('endpoint disabled, to enable set STIGMAN_EXPERIMENTAL_APPDATA=true')
}
let elevate = req.query.elevate
if ( elevate ) {
let collections = await Collection.exportCollections( ['grants', 'labels', 'stigs'], elevate, req.userObject )
Expand Down Expand Up @@ -81,6 +84,9 @@ module.exports.getAppData = async function getAppData (req, res, next) {

module.exports.replaceAppData = async function replaceAppData (req, res, next) {
try {
if (!config.experimental.appData) {
throw new SmError.NotFoundError('endpoint disabled, to enable set STIGMAN_EXPERIMENTAL_APPDATA=true')
}
req.noCompression = true
let elevate = req.query.elevate
let appdata
Expand Down Expand Up @@ -129,11 +135,11 @@ module.exports.getDefinition = async function getDefinition (req, res, next) {
}
}

module.exports.getDetails = async function getDetails (req, res, next) {
module.exports.getAppInfo = async function getAppInfo (req, res, next) {
try {
let elevate = req.query.elevate
if ( elevate ) {
const response = await OperationService.getDetails()
const response = await OperationService.getAppInfo()
res.json(response)
}
else {
Expand All @@ -144,3 +150,5 @@ module.exports.getDetails = async function getDetails (req, res, next) {
next(err)
}
}

module.exports.getDetails = module.exports.getAppInfo
5 changes: 4 additions & 1 deletion api/source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ app.use((err, req, res, next) => {
})
}
// Expose selected error properties in the response
res.errorBody = { error: err.message, detail: err.detail, stack: err.stack}
res.errorBody = { error: err.message, code: err.code, detail: err.detail, stack: err.stack}
if (!res._headerSent) {
res.status(err.status || 500).header(err.headers).json(res.errorBody)
}
Expand Down Expand Up @@ -224,6 +224,9 @@ const STIGMAN = {
privileges: "${config.oauth.claims.privileges}",
email: "${config.oauth.claims.email}"
}
},
experimental: {
appData: "${config.experimental.appData}"
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions api/source/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f9cc74a

Please sign in to comment.