Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/actions/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ echo "::endgroup::"

echo "::group::MongoBI"
yarn lerna run --concurrency 1 --stream --no-prefix smoke:mongobi
echo "::endgroup::"
echo "::endgroup::"

echo "::group::RBAC"
yarn lerna run --concurrency 1 --stream --no-prefix smoke:rbac
echo "::endgroup::"
2 changes: 1 addition & 1 deletion packages/cubejs-server-core/src/core/CompilerApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class CompilerApi {
if (typeof b !== 'boolean') {
throw new Error(`Access policy condition must return boolean, got ${JSON.stringify(b)}`);
}
return a || b;
return a && b;
});
}
return true;
Expand Down
21 changes: 21 additions & 0 deletions packages/cubejs-testing/birdbox-fixtures/rbac/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ module.exports = {
},
};
}
if (user === 'manager') {
if (password && password !== 'manager_password') {
throw new Error(`Password doesn't match for ${user}`);
}
return {
password,
superuser: false,
securityContext: {
auth: {
username: 'manager',
userAttributes: {
region: 'CA',
city: 'Fresno',
canHaveAdmin: false,
minDefaultId: 10000,
},
roles: ['manager'],
},
},
};
}
throw new Error(`User "${user}" doesn't exist`);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,23 @@ cube('line_items', {
excludes: ['created_at'],
},
},
{
role: 'manager',
conditions: [
{
if: security_context.auth?.userAttributes?.region === 'CA',
},
{
// This condition should not match the one defined in the "manager" mock context
if: security_context.auth?.userAttributes?.region === 'San Francisco',
},
],
rowLevel: {
allowAll: true,
},
memberLevel: {
excludes: ['created_at'],
},
},
],
});
2 changes: 1 addition & 1 deletion packages/cubejs-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"smoke:postgres": "jest --verbose -i dist/test/smoke-postgres.test.js",
"smoke:redshift": "jest --verbose -i dist/test/smoke-redshift.test.js",
"smoke:redshift:snapshot": "jest --verbose --updateSnapshot -i dist/test/smoke-redshift.test.js",
"smoke:rbac": "TZ=UTC jest --verbose --forceExit -i dist/test/smoke-rbac.test.js",
"smoke:rbac": "TZ=UTC jest --verbose -i dist/test/smoke-rbac.test.js",
"smoke:cubesql": "TZ=UTC jest --verbose --forceExit -i dist/test/smoke-cubesql.test.js",
"smoke:cubesql:snapshot": "TZ=UTC jest --verbose --forceExit --updateSnapshot -i dist/test/smoke-cubesql.test.js",
"smoke:prestodb": "jest --verbose -i dist/test/smoke-prestodb.test.js",
Expand Down
Loading
Loading