Skip to content

Commit

Permalink
fix: provide roleScopingEntityURN in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Mar 14, 2024
1 parent 2e81c9f commit 8efcc97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ USER node
ARG APP_HOME=/home/node/srv
WORKDIR $APP_HOME

COPY package.json package.json
COPY package-lock.json package-lock.json

COPY --chown=node:node . $APP_HOME
COPY --chown=node:node ./cfg $APP_HOME/cfg
COPY --chown=node:node --from=build $APP_HOME/lib $APP_HOME/lib

EXPOSE 50051
Expand Down
8 changes: 4 additions & 4 deletions src/utilts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { Logger } from 'winston';

// Create a ids client instance
let idsClientInstance: UserServiceClient;
const cfg = createServiceConfig(process.cwd());
const getUserServiceClient = async () => {
if (!idsClientInstance) {
const cfg = createServiceConfig(process.cwd());
// identity-srv client to resolve subject ID by token
const grpcIDSConfig = cfg.get('client:user');
const loggerCfg = cfg.get('logger');
Expand Down Expand Up @@ -124,7 +124,7 @@ export async function checkAccessRequest(ctx: GQLClientContext, resource: Resour

let result: DecisionResponse | PolicySetRQResponse;
try {
result = await accessRequest(subject, resource, action, ctx, operation);
result = await accessRequest(subject, resource, action, ctx, { operation, roleScopingEntityURN: cfg?.get('authorization:urns:organization') });
} catch (err) {
return {
decision: Response_Decision.DENY,
Expand All @@ -148,11 +148,11 @@ export function _filterJobData(data: Data, encode: boolean, logger: Logger): Pic
}
}

if(picked?.meta?.created && typeof picked.meta.created === 'string') {
if (picked?.meta?.created && typeof picked.meta.created === 'string') {
picked.meta.created = new Date(picked.meta.created);
}

if(picked?.meta?.modified && typeof picked.meta.modified === 'string') {
if (picked?.meta?.modified && typeof picked.meta.modified === 'string') {
picked.meta.modified = new Date(picked.meta.modified);
}

Expand Down

0 comments on commit 8efcc97

Please sign in to comment.