fix: wording and small adjustment
This commit is contained in:
parent
7f440c40e9
commit
0f694ea777
4 changed files with 75 additions and 14 deletions
|
|
@ -38,7 +38,7 @@ export async function expressAuthentication(
|
|||
? request.headers["authorization"].split(" ")[1]
|
||||
: null;
|
||||
|
||||
if (!token) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "ไม่พบข้อมูลสำหัรบบืนบันตัวตน");
|
||||
if (!token) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "ไม่พบข้อมูลสำหรับยินยันตัวตน");
|
||||
|
||||
let payload: JwtPayload = {};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export async function expressAuthentication(
|
|||
scopes.length > 0 &&
|
||||
scopes
|
||||
.map((v) => (v === "management-role" ? process.env.MANAGEMENT_ROLE : v))
|
||||
.every((v) => !payload.resource_access[payload.azp].roles.includes(v))
|
||||
.every((v) => !payload.role.includes(v))
|
||||
) {
|
||||
throw new HttpError(HttpStatusCode.FORBIDDEN, "คุณไม่มีสิทธิในเข้าถึงข้อมูลนี้");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue