fix: allow coreflow deployment input reads
This commit is contained in:
@@ -172,4 +172,20 @@ export class CloudlyAuthManager {
|
||||
name: 'adminIdentityGuard',
|
||||
},
|
||||
);
|
||||
|
||||
public adminOrClusterIdentityGuard = new plugins.smartguard.Guard<{
|
||||
identity: plugins.servezoneInterfaces.data.IIdentity;
|
||||
}>(
|
||||
async (dataArg) => {
|
||||
await plugins.smartguard.passGuardsOrReject(dataArg, [this.validIdentityGuard]);
|
||||
const jwt = dataArg.identity.jwt;
|
||||
const jwtData: IJwtData = await this.smartjwtInstance.verifyJWTAndGetData(jwt);
|
||||
const user = await this.CUser.getInstance({ id: jwtData.userId });
|
||||
return user.data.role === 'admin' || user.data.role === 'cluster';
|
||||
},
|
||||
{
|
||||
failedHint: 'user is not admin or cluster.',
|
||||
name: 'adminOrClusterIdentityGuard',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user