Tweaked LOA API RBAC to allow full command group access
This commit is contained in:
@@ -26,7 +26,7 @@ router.post("/", async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//admin posts LOA
|
//admin posts LOA
|
||||||
router.post("/admin", [requireRole("17th Administrator")], async (req: Request, res: Response) => {
|
router.post("/admin", [requireRole(['17th Administrator', '17th HQ', '17th Command'])], async (req: Request, res: Response) => {
|
||||||
let LOARequest = req.body as LOARequest;
|
let LOARequest = req.body as LOARequest;
|
||||||
LOARequest.created_by = req.user.id;
|
LOARequest.created_by = req.user.id;
|
||||||
LOARequest.filed_date = new Date();
|
LOARequest.filed_date = new Date();
|
||||||
@@ -67,7 +67,7 @@ router.get("/history", async (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/all', [requireRole("17th Administrator")], async (req: Request, res: Response) => {
|
router.get('/all', [requireRole(['17th Administrator', '17th HQ', '17th Command'])], async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const page = Number(req.query.page) || undefined;
|
const page = Number(req.query.page) || undefined;
|
||||||
const pageSize = Number(req.query.pageSize) || undefined;
|
const pageSize = Number(req.query.pageSize) || undefined;
|
||||||
@@ -107,7 +107,7 @@ router.post('/cancel/:id', async (req: Request, res: Response) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
//TODO: enforce admin only
|
//TODO: enforce admin only
|
||||||
router.post('/adminCancel/:id', [requireRole("17th Administrator")], async (req: Request, res: Response) => {
|
router.post('/adminCancel/:id', [requireRole(['17th Administrator', '17th HQ', '17th Command'])], async (req: Request, res: Response) => {
|
||||||
let closer = req.user.id;
|
let closer = req.user.id;
|
||||||
try {
|
try {
|
||||||
await closeLOA(Number(req.params.id), closer);
|
await closeLOA(Number(req.params.id), closer);
|
||||||
@@ -119,7 +119,7 @@ router.post('/adminCancel/:id', [requireRole("17th Administrator")], async (req:
|
|||||||
})
|
})
|
||||||
|
|
||||||
// TODO: Enforce admin only
|
// TODO: Enforce admin only
|
||||||
router.post('/extend/:id', [requireRole("17th Administrator")], async (req: Request, res: Response) => {
|
router.post('/extend/:id', [requireRole(['17th Administrator', '17th HQ', '17th Command'])], async (req: Request, res: Response) => {
|
||||||
const to: Date = req.body.to;
|
const to: Date = req.body.to;
|
||||||
|
|
||||||
if (!to) {
|
if (!to) {
|
||||||
|
|||||||
Reference in New Issue
Block a user