-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from CEN3031-SIT-WEB-APP/CEN3031-dev
Cen3031 dev
- Loading branch information
Showing
191 changed files
with
24,038 additions
and
10,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
"project": { | ||
"name": "ufInfoSec_webapp" | ||
}, | ||
"apps": [ | ||
{ | ||
"root": "src", | ||
"outDir": "static", | ||
"assets": [ | ||
"assets", | ||
"favicon.ico" | ||
], | ||
"index": "index.html", | ||
"main": "main.ts", | ||
"polyfills": "polyfills.ts", | ||
"test": "test.ts", | ||
"tsconfig": "tsconfig.app.json", | ||
"testTsconfig": "tsconfig.spec.json", | ||
"prefix": "app", | ||
"styles": [ | ||
"assets/css/bootstrap.min.css", | ||
"assets/css/bootstrap-grid.min.css", | ||
"assets/css/github-markdown.css", | ||
"styles.css" | ||
], | ||
"scripts": [], | ||
"environmentSource": "environments/environment.ts", | ||
"environments": { | ||
"dev": "environments/environment.ts", | ||
"prod": "environments/environment.prod.ts" | ||
} | ||
} | ||
], | ||
"e2e": { | ||
"protractor": { | ||
"config": "./protractor.conf.js" | ||
} | ||
}, | ||
"lint": [ | ||
{ | ||
"project": "src/tsconfig.app.json", | ||
"exclude": "**/node_modules/**" | ||
}, | ||
{ | ||
"project": "src/tsconfig.spec.json", | ||
"exclude": "**/node_modules/**" | ||
}, | ||
{ | ||
"project": "e2e/tsconfig.e2e.json", | ||
"exclude": "**/node_modules/**" | ||
} | ||
], | ||
"test": { | ||
"karma": { | ||
"config": "./karma.conf.js" | ||
} | ||
}, | ||
"defaults": { | ||
"styleExt": "css", | ||
"component": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
'use strict'; | ||
|
||
const routes = require('express').Router(); // eslint-disable-line new-cap | ||
const admin_mgmt = require('./db/admin_mgmt.js'); // App-specific module imports | ||
const util = require.main.require('./util'); | ||
|
||
/* App-specific module imports */ | ||
const admin = require('./db/admin.js'); | ||
|
||
routes.get('/admin/list_users', async (req, res, next) => { | ||
if (util.account_has_admin(req.account)) { | ||
res.status(200).json(await admin.list_users()); | ||
} else { | ||
res.status(403).send('Access denied'); | ||
} | ||
if (util.account_has_admin(req.account)) { | ||
return res.status(200).json(await admin_mgmt.list_users()); | ||
} else { | ||
return res.status(403).send('Access denied'); | ||
} | ||
}); | ||
|
||
routes.post('/admin/add_tile', async (req, res, next) => { | ||
if (util.account_has_admin(req.account)) { | ||
try { | ||
await admin_mgmt.add_tile( | ||
req.body.name, | ||
req.body.description, | ||
req.body.link | ||
); | ||
res.status(200).send('Success'); | ||
} catch (error) { return next(error) } | ||
} else { | ||
res.status(403).send('Access denied'); | ||
} | ||
}); | ||
|
||
routes.post('/admin/delete_tile', async (req, res, next) => { | ||
if (util.account_has_admin(req.account)) { | ||
try { | ||
await admin_mgmt.delete_tile(req.body.id); | ||
res.status(200).send('Success'); | ||
} catch (error) { return next(error) } | ||
} else { | ||
res.status(403).send('Access denied'); | ||
} | ||
}); | ||
|
||
module.exports = routes; |
Oops, something went wrong.