edit permission

This commit is contained in:
kittapath 2024-12-14 01:04:37 +07:00
parent 8d38768494
commit 53302147ef

View file

@ -183,7 +183,7 @@ class CheckAuth {
return false; return false;
}); });
} }
public async checkOrg(token: any,keycloakId: string) { public async checkOrg(token: any, keycloakId: string) {
const redisClient = await this.redis.createClient({ const redisClient = await this.redis.createClient({
host: process.env.REDIS_HOST, host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT, port: process.env.REDIS_PORT,
@ -194,14 +194,15 @@ class CheckAuth {
reply = JSON.parse(reply); reply = JSON.parse(reply);
} else { } else {
try { try {
if (!keycloakId) throw "Error calling API No KeycloakId";
const x = await new CallAPI().GetData( const x = await new CallAPI().GetData(
{ {
headers: { authorization: token }, headers: { authorization: token },
}, },
`/org/permission/checkOrg/${keycloakId}`, `/org/permission/checkOrg/${keycloakId}`,
false false,
); );
const data = { const data = {
orgRootId: x.orgRootId, orgRootId: x.orgRootId,
orgChild1Id: x.orgChild1Id, orgChild1Id: x.orgChild1Id,
@ -209,7 +210,7 @@ class CheckAuth {
orgChild3Id: x.orgChild3Id, orgChild3Id: x.orgChild3Id,
orgChild4Id: x.orgChild4Id, orgChild4Id: x.orgChild4Id,
}; };
return data; return data;
} catch (error) { } catch (error) {
console.error("Error calling API:", error); console.error("Error calling API:", error);