@redhat-cloud-services/frontend-components-utilities 3.2.8 → 3.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RBAC/RBAC.js +10 -8
- package/RBACHook/RBACHook.js +3 -3
- package/esm/RBAC/RBAC.js +10 -8
- package/esm/RBACHook/RBACHook.js +3 -3
- package/package.json +1 -1
package/RBAC/RBAC.js
CHANGED
|
@@ -22,6 +22,7 @@ function _getRBAC() {
|
|
|
22
22
|
var _insights$chrome, _insights$chrome$auth, _user$identity, _user$identity$user, _insights$chrome2;
|
|
23
23
|
|
|
24
24
|
var applicationName,
|
|
25
|
+
disableCache,
|
|
25
26
|
insights,
|
|
26
27
|
user,
|
|
27
28
|
_args = arguments;
|
|
@@ -30,34 +31,35 @@ function _getRBAC() {
|
|
|
30
31
|
switch (_context.prev = _context.next) {
|
|
31
32
|
case 0:
|
|
32
33
|
applicationName = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
34
|
+
disableCache = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
33
35
|
insights = window.insights;
|
|
34
|
-
_context.next =
|
|
36
|
+
_context.next = 5;
|
|
35
37
|
return insights === null || insights === void 0 ? void 0 : (_insights$chrome = insights.chrome) === null || _insights$chrome === void 0 ? void 0 : (_insights$chrome$auth = _insights$chrome.auth) === null || _insights$chrome$auth === void 0 ? void 0 : _insights$chrome$auth.getUser();
|
|
36
38
|
|
|
37
|
-
case
|
|
39
|
+
case 5:
|
|
38
40
|
user = _context.sent;
|
|
39
41
|
_context.t0 = (user === null || user === void 0 ? void 0 : (_user$identity = user.identity) === null || _user$identity === void 0 ? void 0 : (_user$identity$user = _user$identity.user) === null || _user$identity$user === void 0 ? void 0 : _user$identity$user.is_org_admin) || false;
|
|
40
|
-
_context.next =
|
|
41
|
-
return insights === null || insights === void 0 ? void 0 : (_insights$chrome2 = insights.chrome) === null || _insights$chrome2 === void 0 ? void 0 : _insights$chrome2.getUserPermissions(applicationName);
|
|
42
|
+
_context.next = 9;
|
|
43
|
+
return insights === null || insights === void 0 ? void 0 : (_insights$chrome2 = insights.chrome) === null || _insights$chrome2 === void 0 ? void 0 : _insights$chrome2.getUserPermissions(applicationName, disableCache);
|
|
42
44
|
|
|
43
|
-
case
|
|
45
|
+
case 9:
|
|
44
46
|
_context.t1 = _context.sent;
|
|
45
47
|
|
|
46
48
|
if (_context.t1) {
|
|
47
|
-
_context.next =
|
|
49
|
+
_context.next = 12;
|
|
48
50
|
break;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
_context.t1 = null;
|
|
52
54
|
|
|
53
|
-
case
|
|
55
|
+
case 12:
|
|
54
56
|
_context.t2 = _context.t1;
|
|
55
57
|
return _context.abrupt("return", {
|
|
56
58
|
isOrgAdmin: _context.t0,
|
|
57
59
|
permissions: _context.t2
|
|
58
60
|
});
|
|
59
61
|
|
|
60
|
-
case
|
|
62
|
+
case 14:
|
|
61
63
|
case "end":
|
|
62
64
|
return _context.stop();
|
|
63
65
|
}
|
package/RBACHook/RBACHook.js
CHANGED
|
@@ -18,7 +18,7 @@ var _react = require("react");
|
|
|
18
18
|
|
|
19
19
|
var _RBAC = require("../RBAC");
|
|
20
20
|
|
|
21
|
-
function usePermissions(appName, permissionsList) {
|
|
21
|
+
function usePermissions(appName, permissionsList, disableCache) {
|
|
22
22
|
var _useState = (0, _react.useState)({
|
|
23
23
|
isLoading: true
|
|
24
24
|
}),
|
|
@@ -38,7 +38,7 @@ function usePermissions(appName, permissionsList) {
|
|
|
38
38
|
switch (_context.prev = _context.next) {
|
|
39
39
|
case 0:
|
|
40
40
|
_context.next = 2;
|
|
41
|
-
return (0, _RBAC.getRBAC)(appName);
|
|
41
|
+
return (0, _RBAC.getRBAC)(appName, disableCache);
|
|
42
42
|
|
|
43
43
|
case 2:
|
|
44
44
|
_yield$getRBAC = _context.sent;
|
|
@@ -58,7 +58,7 @@ function usePermissions(appName, permissionsList) {
|
|
|
58
58
|
}
|
|
59
59
|
}, _callee);
|
|
60
60
|
}))();
|
|
61
|
-
}, [appName]);
|
|
61
|
+
}, [appName, disableCache]);
|
|
62
62
|
return permissions;
|
|
63
63
|
}
|
|
64
64
|
|
package/esm/RBAC/RBAC.js
CHANGED
|
@@ -9,6 +9,7 @@ function _getRBAC() {
|
|
|
9
9
|
var _insights$chrome, _insights$chrome$auth, _user$identity, _user$identity$user, _insights$chrome2;
|
|
10
10
|
|
|
11
11
|
var applicationName,
|
|
12
|
+
disableCache,
|
|
12
13
|
insights,
|
|
13
14
|
user,
|
|
14
15
|
_args = arguments;
|
|
@@ -17,34 +18,35 @@ function _getRBAC() {
|
|
|
17
18
|
switch (_context.prev = _context.next) {
|
|
18
19
|
case 0:
|
|
19
20
|
applicationName = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
21
|
+
disableCache = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
20
22
|
insights = window.insights;
|
|
21
|
-
_context.next =
|
|
23
|
+
_context.next = 5;
|
|
22
24
|
return insights === null || insights === void 0 ? void 0 : (_insights$chrome = insights.chrome) === null || _insights$chrome === void 0 ? void 0 : (_insights$chrome$auth = _insights$chrome.auth) === null || _insights$chrome$auth === void 0 ? void 0 : _insights$chrome$auth.getUser();
|
|
23
25
|
|
|
24
|
-
case
|
|
26
|
+
case 5:
|
|
25
27
|
user = _context.sent;
|
|
26
28
|
_context.t0 = (user === null || user === void 0 ? void 0 : (_user$identity = user.identity) === null || _user$identity === void 0 ? void 0 : (_user$identity$user = _user$identity.user) === null || _user$identity$user === void 0 ? void 0 : _user$identity$user.is_org_admin) || false;
|
|
27
|
-
_context.next =
|
|
28
|
-
return insights === null || insights === void 0 ? void 0 : (_insights$chrome2 = insights.chrome) === null || _insights$chrome2 === void 0 ? void 0 : _insights$chrome2.getUserPermissions(applicationName);
|
|
29
|
+
_context.next = 9;
|
|
30
|
+
return insights === null || insights === void 0 ? void 0 : (_insights$chrome2 = insights.chrome) === null || _insights$chrome2 === void 0 ? void 0 : _insights$chrome2.getUserPermissions(applicationName, disableCache);
|
|
29
31
|
|
|
30
|
-
case
|
|
32
|
+
case 9:
|
|
31
33
|
_context.t1 = _context.sent;
|
|
32
34
|
|
|
33
35
|
if (_context.t1) {
|
|
34
|
-
_context.next =
|
|
36
|
+
_context.next = 12;
|
|
35
37
|
break;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
_context.t1 = null;
|
|
39
41
|
|
|
40
|
-
case
|
|
42
|
+
case 12:
|
|
41
43
|
_context.t2 = _context.t1;
|
|
42
44
|
return _context.abrupt("return", {
|
|
43
45
|
isOrgAdmin: _context.t0,
|
|
44
46
|
permissions: _context.t2
|
|
45
47
|
});
|
|
46
48
|
|
|
47
|
-
case
|
|
49
|
+
case 14:
|
|
48
50
|
case "end":
|
|
49
51
|
return _context.stop();
|
|
50
52
|
}
|
package/esm/RBACHook/RBACHook.js
CHANGED
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { getRBAC, doesHavePermissions } from '../RBAC';
|
|
6
|
-
export function usePermissions(appName, permissionsList) {
|
|
6
|
+
export function usePermissions(appName, permissionsList, disableCache) {
|
|
7
7
|
var _useState = useState({
|
|
8
8
|
isLoading: true
|
|
9
9
|
}),
|
|
@@ -24,7 +24,7 @@ export function usePermissions(appName, permissionsList) {
|
|
|
24
24
|
switch (_context.prev = _context.next) {
|
|
25
25
|
case 0:
|
|
26
26
|
_context.next = 2;
|
|
27
|
-
return getRBAC(appName);
|
|
27
|
+
return getRBAC(appName, disableCache);
|
|
28
28
|
|
|
29
29
|
case 2:
|
|
30
30
|
_yield$getRBAC = _context.sent;
|
|
@@ -44,7 +44,7 @@ export function usePermissions(appName, permissionsList) {
|
|
|
44
44
|
}
|
|
45
45
|
}, _callee);
|
|
46
46
|
}))();
|
|
47
|
-
}, [appName]);
|
|
47
|
+
}, [appName, disableCache]);
|
|
48
48
|
return permissions;
|
|
49
49
|
}
|
|
50
50
|
export default usePermissions;
|