refacto rules & folders
This commit is contained in:
parent
12ce8ddff4
commit
c722edc013
@ -52,7 +52,7 @@
|
||||
"cron": "^2.3.1",
|
||||
"express": "^4.18.2",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.69",
|
||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.71",
|
||||
"module-alias": "^2.2.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"next": "^13.1.5",
|
||||
|
@ -175,7 +175,6 @@ export default class OfficeFoldersController extends ApiController {
|
||||
this.httpInternalError(response, error);
|
||||
return;
|
||||
}
|
||||
this.httpSuccess(response, await this.officeFoldersService.getByUid("uid"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,11 @@ export default async function ruleHandler(req: Request, response: Response, next
|
||||
const rules = req.body.user.rules;
|
||||
const service = req.path && req.path.split("/")[4];
|
||||
|
||||
if (!rules) {
|
||||
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized without rules");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rules.includes(req.method + " " + service)) {
|
||||
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with those rules");
|
||||
return;
|
||||
|
@ -8,7 +8,6 @@ import { BackendVariables } from "@Common/config/variables/Variables";
|
||||
import { Readable } from "stream";
|
||||
import { v4 } from "uuid";
|
||||
import { Files, Prisma } from "@prisma/client";
|
||||
import fetch from "node-fetch";
|
||||
|
||||
@Service()
|
||||
export default class FilesService extends BaseService {
|
||||
|
Loading…
x
Reference in New Issue
Block a user