Skip to content

Commit

Permalink
Deploying to gh-pages from @ 22e83bf 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dlen committed Apr 4, 2024
1 parent 19227da commit c7415ce
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 9 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@



window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.d29908dc.iframe.bundle.js"></script><script src="792.d8326fa2.iframe.bundle.js"></script><script src="main.7a3b483f.iframe.bundle.js"></script></body></html>
window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./.storybook/stories","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook\\/stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.d29908dc.iframe.bundle.js"></script><script src="792.a27ec283.iframe.bundle.js"></script><script src="main.ae025225.iframe.bundle.js"></script></body></html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@



window['DOCS_MODE'] = false;</script><script src="runtime~main.a351fec40080f5c29fba.manager.bundle.js"></script><script src="312.a38e9adacebe814d33fb.manager.bundle.js"></script><script src="main.e509b04e2cf55ec299af.manager.bundle.js"></script></body></html>
window['DOCS_MODE'] = false;</script><script src="runtime~main.a351fec40080f5c29fba.manager.bundle.js"></script><script src="312.daccb0b2256fc94ed49e.manager.bundle.js"></script><script src="main.e509b04e2cf55ec299af.manager.bundle.js"></script></body></html>

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"generatedAt":1711647115208,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.2.4"},"language":"javascript","storybookPackages":{},"framework":{},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"backgrounds":false},"version":"6.5.16"}}}
{"generatedAt":1712244101479,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"10.2.4"},"language":"javascript","storybookPackages":{},"framework":{},"addons":{"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"backgrounds":false},"version":"6.5.16"}}}
6 changes: 6 additions & 0 deletions shared/services/rbacs/canUseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default class CanUse {
* @returns {boolean}
*/
static canRoleUseUiAction(user, rbacs, actionName) {
// Desktop action should always be driven by rbac
if (window.chrome?.webview) {
const rbac = rbacs.findRbacByActionName(actionName);
return this.getByRbacOrDefault(rbac, actionName);
}

const role = new RoleEntity(user.role);
// Administrator action are not controlled by rbac.
if (role.isAdmin()) {
Expand Down
14 changes: 14 additions & 0 deletions shared/services/rbacs/canUseService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ describe("CanUseService", () => {
expect(CanUse.getByRbacOrDefault).toHaveBeenCalled();
});

it('should return true for desktop action with RBAC control function', () => {
expect.assertions(3);
global.window.chrome = {webview: true};

jest.spyOn(rbacs, "findRbacByActionName");
jest.spyOn(GetControlFunctionService, "getByRbac");

const result = CanUse.canRoleUseUiAction(user, rbacs, uiActions.RESOURCES_EXPORT);

expect(result).toBe(true);
expect(rbacs.findRbacByActionName).toHaveBeenCalledWith(uiActions.RESOURCES_EXPORT);
expect(GetControlFunctionService.getByRbac).toHaveBeenCalled();
});

it('should return false if rbac is Deny', () => {
expect.assertions(1);

Expand Down
6 changes: 6 additions & 0 deletions webAccessibleResources/shared/services/rbacs/canUseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default class CanUse {
* @returns {boolean}
*/
static canRoleUseUiAction(user, rbacs, actionName) {
// Desktop action should always be driven by rbac
if (window.chrome?.webview) {
const rbac = rbacs.findRbacByActionName(actionName);
return this.getByRbacOrDefault(rbac, actionName);
}

const role = new RoleEntity(user.role);
// Administrator action are not controlled by rbac.
if (role.isAdmin()) {
Expand Down
14 changes: 14 additions & 0 deletions webAccessibleResources/shared/services/rbacs/canUseService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ describe("CanUseService", () => {
expect(CanUse.getByRbacOrDefault).toHaveBeenCalled();
});

it('should return true for desktop action with RBAC control function', () => {
expect.assertions(3);
global.window.chrome = {webview: true};

jest.spyOn(rbacs, "findRbacByActionName");
jest.spyOn(GetControlFunctionService, "getByRbac");

const result = CanUse.canRoleUseUiAction(user, rbacs, uiActions.RESOURCES_EXPORT);

expect(result).toBe(true);
expect(rbacs.findRbacByActionName).toHaveBeenCalledWith(uiActions.RESOURCES_EXPORT);
expect(GetControlFunctionService.getByRbac).toHaveBeenCalled();
});

it('should return false if rbac is Deny', () => {
expect.assertions(1);

Expand Down

0 comments on commit c7415ce

Please sign in to comment.