asab_webui_shell 25.1.11 → 25.1.13
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/dist/components/locationReplace.js +4 -16
- package/dist/config/ConfigReducer.js +1 -1
- package/dist/config/ConfigService.js +116 -137
- package/dist/containers/AdvancedMode/reducer.js +2 -2
- package/dist/containers/Alerts/index.js +18 -30
- package/dist/containers/Alerts/reducer.js +5 -6
- package/dist/containers/Application.js +531 -663
- package/dist/containers/AttentionRequired/reducer.js +2 -2
- package/dist/containers/FullscreenMode/reducer.js +2 -2
- package/dist/containers/Header/ApplicationScreenTitle/ApplicationScreenTitle.js +15 -16
- package/dist/containers/Header/ApplicationScreenTitle/index.js +6 -6
- package/dist/containers/Header/Help/HelpButton.js +17 -27
- package/dist/containers/Header/Help/HelpService.js +13 -24
- package/dist/containers/Header/Preview/PreviewFlag.js +6 -5
- package/dist/containers/Header/Preview/PreviewService.js +13 -24
- package/dist/containers/Header/index.js +15 -17
- package/dist/containers/Header/reducer.js +4 -4
- package/dist/containers/Navigation/index.js +35 -55
- package/dist/containers/Navigation/reducer.js +7 -13
- package/dist/containers/RouteErrorHandler/ErrorContainer.js +17 -19
- package/dist/containers/RouteErrorHandler/index.js +28 -44
- package/dist/containers/Router/ApplicationRouter.js +14 -16
- package/dist/containers/Router/index.js +26 -42
- package/dist/containers/Router/reducer.js +3 -3
- package/dist/containers/Sidebar/NavbarBrand.js +14 -23
- package/dist/containers/Sidebar/SidebarBottomItem.js +16 -15
- package/dist/containers/Sidebar/SidebarIcon.js +9 -7
- package/dist/containers/Sidebar/SidebarItem.js +70 -85
- package/dist/containers/Sidebar/SidebarItemRenderer.js +20 -20
- package/dist/containers/Sidebar/index.js +20 -36
- package/dist/containers/Sidebar/reducer.js +3 -3
- package/dist/containers/Sidepanel/Sidepanel.js +18 -26
- package/dist/containers/Toast/ToastComponent.js +12 -12
- package/dist/containers/Toast/ToastContainer.js +19 -30
- package/dist/containers/Toast/reducer.js +3 -6
- package/dist/index.js +5 -5
- package/dist/modules/about/AboutScreen.js +30 -38
- package/dist/modules/about/index.js +8 -26
- package/dist/modules/auth/api.js +110 -156
- package/dist/modules/auth/components/SessionExpirationAlert.js +10 -9
- package/dist/modules/auth/header.js +25 -23
- package/dist/modules/auth/index.js +440 -692
- package/dist/modules/auth/reducer.js +2 -2
- package/dist/modules/auth/screens/AccessControlScreen.js +24 -25
- package/dist/modules/auth/screens/InvitationScreen.js +89 -128
- package/dist/modules/i18n/dropdown.js +24 -23
- package/dist/modules/i18n/index.js +20 -33
- package/dist/modules/i18n/reducer.js +2 -2
- package/dist/modules/i18n/service.js +48 -102
- package/dist/modules/tenant/TenantDropdown.js +28 -27
- package/dist/modules/tenant/access/AccessDeniedCard.js +28 -54
- package/dist/modules/tenant/index.js +16 -29
- package/dist/modules/tenant/reducer.js +1 -1
- package/dist/modules/tenant/service.js +123 -207
- package/dist/screens/InvalidRouteScreen.js +10 -9
- package/dist/screens/SuspenseScreen.js +11 -20
- package/dist/screens/UnauthorizedAccessScreen.js +18 -21
- package/dist/services/AttentionRequiredService.js +117 -142
- package/dist/services/BrandingService.js +63 -80
- package/dist/services/HeaderService.js +47 -66
- package/dist/services/ReduxService.js +11 -17
- package/dist/services/TitleService.js +13 -24
- package/dist/theme/ThemeButton.js +13 -10
- package/dist/theme/ThemeReducer.js +1 -1
- package/dist/theme/ThemeService.js +25 -38
- package/package.json +1 -1
package/dist/modules/auth/api.js
CHANGED
|
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.SeaCatAuthApi = exports.GoogleOAuth2Api = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
9
|
var _axios = _interopRequireDefault(require("axios"));
|
|
13
10
|
var _locationReplace = require("../../components/locationReplace");
|
|
14
|
-
|
|
11
|
+
class SeaCatAuthApi {
|
|
15
12
|
/*
|
|
16
13
|
SeaCat Auth Open ID Connect / OAuth2.0
|
|
17
14
|
|
|
@@ -24,8 +21,7 @@ var SeaCatAuthApi = exports.SeaCatAuthApi = /*#__PURE__*/function () {
|
|
|
24
21
|
...
|
|
25
22
|
*/
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
(0, _classCallCheck2["default"])(this, SeaCatAuthApi);
|
|
24
|
+
constructor(app) {
|
|
29
25
|
this.App = app;
|
|
30
26
|
var scope = this.App.Config.get('seacat.auth.scope');
|
|
31
27
|
this.Scope = scope ? scope : "openid tenant userinfo:* batman";
|
|
@@ -35,104 +31,84 @@ var SeaCatAuthApi = exports.SeaCatAuthApi = /*#__PURE__*/function () {
|
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
// This method will cause a navigation from the app to the OAuth2 login screen
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Adding tenant directly to scope (if available).
|
|
48
|
-
*/
|
|
49
|
-
currentTenant = null;
|
|
50
|
-
if (this.App.Services.TenantService) {
|
|
51
|
-
currentTenant = this.App.Services.TenantService.getCurrentTenant();
|
|
52
|
-
}
|
|
53
|
-
scopeArray = this.Scope.split(" ");
|
|
54
|
-
tenantValue = scopeArray.find(function (str) {
|
|
55
|
-
return str.includes("tenant");
|
|
56
|
-
});
|
|
57
|
-
loginScope = currentTenant != null && tenantValue != undefined ? this.Scope.replace("".concat(tenantValue), "tenant:".concat(currentTenant)) : this.Scope; // Generate random state
|
|
58
|
-
typedArray = new Uint32Array(10);
|
|
59
|
-
crypto.getRandomValues(typedArray);
|
|
60
|
-
randomIndex = Math.floor(Math.random() * typedArray.length);
|
|
61
|
-
stateIndex = typedArray[randomIndex];
|
|
62
|
-
/*
|
|
63
|
-
As per OAuth2 specs, the redirect_uri must *exactly* match one of the URIs pre-registered
|
|
64
|
-
at the authorization server, hence it cannot contain variable components (query, hash).
|
|
65
|
-
Here we use the application's base URL as the redirect_uri and store the variable parts in the state.
|
|
66
|
-
*/
|
|
67
|
-
redirectUri = new URL(redirect_uri);
|
|
68
|
-
state = redirectUri.search + redirectUri.hash;
|
|
69
|
-
localStorage.setItem("oauth2_state_".concat(stateIndex), state);
|
|
70
|
-
params = new URLSearchParams({
|
|
71
|
-
response_type: "code",
|
|
72
|
-
scope: loginScope,
|
|
73
|
-
client_id: this.ClientId,
|
|
74
|
-
redirect_uri: redirectUri.origin + redirectUri.pathname,
|
|
75
|
-
state: stateIndex
|
|
76
|
-
});
|
|
77
|
-
if (force_login_prompt === true) {
|
|
78
|
-
params.append("prompt", "login");
|
|
79
|
-
}
|
|
80
|
-
oidcURL = this.App.getServiceURL('openidconnect');
|
|
81
|
-
_context.next = 17;
|
|
82
|
-
return (0, _locationReplace.locationReplace)(oidcURL + "/authorize?" + params.toString());
|
|
83
|
-
case 17:
|
|
84
|
-
case "end":
|
|
85
|
-
return _context.stop();
|
|
86
|
-
}
|
|
87
|
-
}, _callee, this);
|
|
88
|
-
}));
|
|
89
|
-
function login(_x, _x2) {
|
|
90
|
-
return _login.apply(this, arguments);
|
|
34
|
+
login(redirect_uri, force_login_prompt) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
return (0, _asyncToGenerator2.default)(function* () {
|
|
37
|
+
/*
|
|
38
|
+
Adding tenant directly to scope (if available).
|
|
39
|
+
*/
|
|
40
|
+
var currentTenant = null;
|
|
41
|
+
if (_this.App.Services.TenantService) {
|
|
42
|
+
currentTenant = _this.App.Services.TenantService.getCurrentTenant();
|
|
91
43
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var headers = {};
|
|
108
|
-
// Add access bearer token to the Authorization headers
|
|
109
|
-
if (access_token != null) {
|
|
110
|
-
headers.Authorization = 'Bearer ' + access_token;
|
|
111
|
-
}
|
|
112
|
-
return this.OidcAPI.get(userinfoPath, {
|
|
113
|
-
headers: headers
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "token_authorization_code",
|
|
118
|
-
value: function token_authorization_code(authorization_code, redirect_uri) {
|
|
44
|
+
var scopeArray = _this.Scope.split(" ");
|
|
45
|
+
var tenantValue = scopeArray.find(str => str.includes("tenant"));
|
|
46
|
+
var loginScope = currentTenant != null && tenantValue != undefined ? _this.Scope.replace("".concat(tenantValue), "tenant:".concat(currentTenant)) : _this.Scope;
|
|
47
|
+
|
|
48
|
+
// Generate random state
|
|
49
|
+
var typedArray = new Uint32Array(10);
|
|
50
|
+
crypto.getRandomValues(typedArray);
|
|
51
|
+
var randomIndex = Math.floor(Math.random() * typedArray.length);
|
|
52
|
+
var stateIndex = typedArray[randomIndex];
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
As per OAuth2 specs, the redirect_uri must *exactly* match one of the URIs pre-registered
|
|
56
|
+
at the authorization server, hence it cannot contain variable components (query, hash).
|
|
57
|
+
Here we use the application's base URL as the redirect_uri and store the variable parts in the state.
|
|
58
|
+
*/
|
|
119
59
|
var redirectUri = new URL(redirect_uri);
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
redirect_uri: redirectUri.origin + redirectUri.pathname
|
|
60
|
+
var state = redirectUri.search + redirectUri.hash;
|
|
61
|
+
localStorage.setItem("oauth2_state_".concat(stateIndex), state);
|
|
62
|
+
var params = new URLSearchParams({
|
|
63
|
+
response_type: "code",
|
|
64
|
+
scope: loginScope,
|
|
65
|
+
client_id: _this.ClientId,
|
|
66
|
+
redirect_uri: redirectUri.origin + redirectUri.pathname,
|
|
67
|
+
state: stateIndex
|
|
129
68
|
});
|
|
130
|
-
|
|
69
|
+
if (force_login_prompt === true) {
|
|
70
|
+
params.append("prompt", "login");
|
|
71
|
+
}
|
|
72
|
+
var oidcURL = _this.App.getServiceURL('openidconnect');
|
|
73
|
+
yield (0, _locationReplace.locationReplace)(oidcURL + "/authorize?" + params.toString());
|
|
74
|
+
})();
|
|
75
|
+
}
|
|
76
|
+
logout(access_token) {
|
|
77
|
+
return this.OidcAPI.get('/logout', {
|
|
78
|
+
headers: {
|
|
79
|
+
'Authorization': 'Bearer ' + access_token
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
userinfo(access_token) {
|
|
84
|
+
var userinfoPath = '/userinfo';
|
|
85
|
+
var headers = {};
|
|
86
|
+
// Add access bearer token to the Authorization headers
|
|
87
|
+
if (access_token != null) {
|
|
88
|
+
headers.Authorization = 'Bearer ' + access_token;
|
|
131
89
|
}
|
|
132
|
-
|
|
133
|
-
|
|
90
|
+
return this.OidcAPI.get(userinfoPath, {
|
|
91
|
+
headers: headers
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
token_authorization_code(authorization_code, redirect_uri) {
|
|
95
|
+
var redirectUri = new URL(redirect_uri);
|
|
96
|
+
var qs = new URLSearchParams({
|
|
97
|
+
grant_type: "authorization_code",
|
|
98
|
+
code: authorization_code,
|
|
99
|
+
client_id: this.ClientId,
|
|
100
|
+
/*
|
|
101
|
+
As per OAuth2 specs, the redirect_uri must *exactly* match the one provided
|
|
102
|
+
at the authorization endpoint, hence the application base URL.
|
|
103
|
+
*/
|
|
104
|
+
redirect_uri: redirectUri.origin + redirectUri.pathname
|
|
105
|
+
});
|
|
106
|
+
return this.OidcAPI.post('/token', qs.toString());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.SeaCatAuthApi = SeaCatAuthApi;
|
|
134
110
|
;
|
|
135
|
-
|
|
111
|
+
class GoogleOAuth2Api {
|
|
136
112
|
/*
|
|
137
113
|
Google OAuth2 API is configured at Google API Console > Credentials > OAuth 2.0 Client IDs
|
|
138
114
|
|
|
@@ -144,9 +120,8 @@ var GoogleOAuth2Api = exports.GoogleOAuth2Api = /*#__PURE__*/function () {
|
|
|
144
120
|
...
|
|
145
121
|
*/
|
|
146
122
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.Axios = _axios["default"].create({
|
|
123
|
+
constructor(config) {
|
|
124
|
+
this.Axios = _axios.default.create({
|
|
150
125
|
timeout: 10000
|
|
151
126
|
});
|
|
152
127
|
var scope = config.get('google.oauth2.scope');
|
|
@@ -156,59 +131,38 @@ var GoogleOAuth2Api = exports.GoogleOAuth2Api = /*#__PURE__*/function () {
|
|
|
156
131
|
}
|
|
157
132
|
|
|
158
133
|
// This method will cause a navigation from the app to the OAuth2 login screen
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
case 0:
|
|
167
|
-
params = new URLSearchParams({
|
|
168
|
-
response_type: "code",
|
|
169
|
-
scope: this.Scope,
|
|
170
|
-
client_id: this.ClientId,
|
|
171
|
-
redirect_uri: redirect_uri
|
|
172
|
-
});
|
|
173
|
-
_context2.next = 3;
|
|
174
|
-
return (0, _locationReplace.locationReplace)("https://accounts.google.com/o/oauth2/auth" + "?" + params.toString());
|
|
175
|
-
case 3:
|
|
176
|
-
case "end":
|
|
177
|
-
return _context2.stop();
|
|
178
|
-
}
|
|
179
|
-
}, _callee2, this);
|
|
180
|
-
}));
|
|
181
|
-
function login(_x3) {
|
|
182
|
-
return _login2.apply(this, arguments);
|
|
183
|
-
}
|
|
184
|
-
return login;
|
|
185
|
-
}()
|
|
186
|
-
}, {
|
|
187
|
-
key: "logout",
|
|
188
|
-
value: function logout(access_token) {
|
|
189
|
-
// There is no Google logout API URL, to our best knowledge
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
}, {
|
|
193
|
-
key: "userinfo",
|
|
194
|
-
value: function userinfo(access_token) {
|
|
195
|
-
var qs = new URLSearchParams({
|
|
196
|
-
alt: "json",
|
|
197
|
-
access_token: access_token
|
|
198
|
-
});
|
|
199
|
-
return this.Axios.get('https://www.googleapis.com/oauth2/v1/userinfo?' + qs.toString());
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "token_authorization_code",
|
|
203
|
-
value: function token_authorization_code(authorization_code, redirect_uri) {
|
|
204
|
-
var qs = new URLSearchParams({
|
|
205
|
-
grant_type: "authorization_code",
|
|
206
|
-
code: authorization_code,
|
|
207
|
-
client_id: this.ClientId,
|
|
208
|
-
client_secret: this.ClientSecret,
|
|
134
|
+
login(redirect_uri) {
|
|
135
|
+
var _this2 = this;
|
|
136
|
+
return (0, _asyncToGenerator2.default)(function* () {
|
|
137
|
+
var params = new URLSearchParams({
|
|
138
|
+
response_type: "code",
|
|
139
|
+
scope: _this2.Scope,
|
|
140
|
+
client_id: _this2.ClientId,
|
|
209
141
|
redirect_uri: redirect_uri
|
|
210
142
|
});
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
143
|
+
yield (0, _locationReplace.locationReplace)("https://accounts.google.com/o/oauth2/auth" + "?" + params.toString());
|
|
144
|
+
})();
|
|
145
|
+
}
|
|
146
|
+
logout(access_token) {
|
|
147
|
+
// There is no Google logout API URL, to our best knowledge
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
userinfo(access_token) {
|
|
151
|
+
var qs = new URLSearchParams({
|
|
152
|
+
alt: "json",
|
|
153
|
+
access_token: access_token
|
|
154
|
+
});
|
|
155
|
+
return this.Axios.get('https://www.googleapis.com/oauth2/v1/userinfo?' + qs.toString());
|
|
156
|
+
}
|
|
157
|
+
token_authorization_code(authorization_code, redirect_uri) {
|
|
158
|
+
var qs = new URLSearchParams({
|
|
159
|
+
grant_type: "authorization_code",
|
|
160
|
+
code: authorization_code,
|
|
161
|
+
client_id: this.ClientId,
|
|
162
|
+
client_secret: this.ClientSecret,
|
|
163
|
+
redirect_uri: redirect_uri
|
|
164
|
+
});
|
|
165
|
+
return this.Axios.post('https://oauth2.googleapis.com/token', qs.toString());
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.GoogleOAuth2Api = GoogleOAuth2Api;
|
|
@@ -10,20 +10,21 @@ var _reactI18next = require("react-i18next");
|
|
|
10
10
|
var _reactstrap = require("reactstrap");
|
|
11
11
|
// Session expiration custom Alert component
|
|
12
12
|
function SessionExpirationAlert(_ref) {
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var {
|
|
14
|
+
alert,
|
|
15
|
+
store
|
|
16
|
+
} = _ref;
|
|
17
|
+
var {
|
|
18
|
+
t
|
|
19
|
+
} = (0, _reactI18next.useTranslation)(); // Use the hook inside the functional component
|
|
17
20
|
|
|
18
|
-
return /*#__PURE__*/_react
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Alert, {
|
|
19
22
|
key: alert.key,
|
|
20
23
|
color: alert.level,
|
|
21
24
|
fade: true,
|
|
22
25
|
isOpen: !alert.acked
|
|
23
|
-
}, /*#__PURE__*/_react
|
|
24
|
-
onClick:
|
|
25
|
-
return window.location.reload();
|
|
26
|
-
},
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h5", null, t(alert.message)), /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
onClick: () => window.location.reload(),
|
|
27
28
|
className: "mt-2",
|
|
28
29
|
style: {
|
|
29
30
|
whiteSpace: 'pre-wrap',
|
|
@@ -34,76 +34,78 @@ require("./header.scss");
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
function AuthHeaderInvitation(props) {
|
|
37
|
-
var resources = (0, _reactRedux.useSelector)(
|
|
37
|
+
var resources = (0, _reactRedux.useSelector)(state => {
|
|
38
38
|
var _state$auth;
|
|
39
39
|
return (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.resources;
|
|
40
40
|
});
|
|
41
|
-
var tenant = (0, _reactRedux.useSelector)(
|
|
41
|
+
var tenant = (0, _reactRedux.useSelector)(state => {
|
|
42
42
|
var _state$tenant;
|
|
43
43
|
return (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
|
|
44
44
|
});
|
|
45
45
|
var navigate = (0, _reactRouterDom.useNavigate)();
|
|
46
|
-
var
|
|
47
|
-
t
|
|
46
|
+
var {
|
|
47
|
+
t
|
|
48
|
+
} = (0, _reactI18next.useTranslation)();
|
|
48
49
|
if (!tenant || !(0, _asab_webui_components.isAuthorized)(['seacat:tenant:assign'])) {
|
|
49
50
|
return null;
|
|
50
51
|
}
|
|
51
52
|
;
|
|
52
|
-
return /*#__PURE__*/_react
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
53
54
|
outline: true,
|
|
54
|
-
onClick:
|
|
55
|
+
onClick: e => {
|
|
55
56
|
e.preventDefault(), navigate('/auth/invite');
|
|
56
57
|
},
|
|
57
58
|
title: t('AuthHeader|Invite other users'),
|
|
58
59
|
className: "invite-nav-button",
|
|
59
60
|
color: "primary"
|
|
60
|
-
}, /*#__PURE__*/_react
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
61
62
|
className: "bi bi-person-plus me-2"
|
|
62
63
|
}), t('AuthHeader|Invite other users'));
|
|
63
64
|
}
|
|
64
65
|
function AuthHeaderDropdown(props) {
|
|
65
|
-
var
|
|
66
|
-
t
|
|
67
|
-
|
|
66
|
+
var {
|
|
67
|
+
t
|
|
68
|
+
} = (0, _reactI18next.useTranslation)();
|
|
69
|
+
var userinfo = (0, _reactRedux.useSelector)(state => {
|
|
68
70
|
var _state$auth2;
|
|
69
71
|
return (_state$auth2 = state.auth) === null || _state$auth2 === void 0 ? void 0 : _state$auth2.userinfo;
|
|
70
72
|
});
|
|
71
73
|
var isSuperuser = (0, _asab_webui_components.isAuthorized)(['authz:superuser']);
|
|
72
|
-
var logout =
|
|
74
|
+
var logout = () => {
|
|
73
75
|
props.AuthModule.logout();
|
|
74
76
|
};
|
|
75
|
-
return /*#__PURE__*/_react
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledDropdown, {
|
|
76
78
|
direction: "down"
|
|
77
|
-
}, /*#__PURE__*/_react
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
|
|
78
80
|
nav: true,
|
|
79
81
|
caret: true,
|
|
80
82
|
title: isSuperuser ? t('AuthHeader|You have superuser privileges. Act responsibly.') : userinfo === null || userinfo === void 0 ? void 0 : userinfo.sub,
|
|
81
83
|
className: isSuperuser ? 'text-warning' : ''
|
|
82
|
-
}, userinfo !== null && userinfo !== void 0 && userinfo.picture ? /*#__PURE__*/_react
|
|
84
|
+
}, userinfo !== null && userinfo !== void 0 && userinfo.picture ? /*#__PURE__*/_react.default.createElement("img", {
|
|
83
85
|
src: userinfo === null || userinfo === void 0 ? void 0 : userinfo.picture,
|
|
84
86
|
className: "img-avatar",
|
|
85
87
|
alt: userinfo === null || userinfo === void 0 ? void 0 : userinfo.username
|
|
86
|
-
}) : /*#__PURE__*/_react
|
|
88
|
+
}) : /*#__PURE__*/_react.default.createElement("i", {
|
|
87
89
|
alt: userinfo === null || userinfo === void 0 ? void 0 : userinfo.username,
|
|
88
90
|
className: "pe-2 bi ".concat(isSuperuser ? 'bi-universal-access' : 'bi-person-gear')
|
|
89
|
-
}), /*#__PURE__*/_react
|
|
91
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, (userinfo === null || userinfo === void 0 ? void 0 : userinfo.username) || (userinfo === null || userinfo === void 0 ? void 0 : userinfo.sub))), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
|
|
90
92
|
className: "shadow"
|
|
91
|
-
}, /*#__PURE__*/_react
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
92
94
|
header: true
|
|
93
|
-
}, t('AuthHeader|My account')), /*#__PURE__*/_react
|
|
95
|
+
}, t('AuthHeader|My account')), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
94
96
|
tag: _reactRouterDom.Link,
|
|
95
97
|
to: "/auth/access-control"
|
|
96
|
-
}, t('AuthHeader|Access control')), /*#__PURE__*/_react
|
|
98
|
+
}, t('AuthHeader|Access control')), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
97
99
|
tag: _reactRouterDom.Link,
|
|
98
100
|
to: "/account"
|
|
99
|
-
}, t('AuthHeader|Account settings')), /*#__PURE__*/_react
|
|
101
|
+
}, t('AuthHeader|Account settings')), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
100
102
|
tag: _reactRouterDom.Link,
|
|
101
103
|
to: "/account/password"
|
|
102
|
-
}, t('AuthHeader|Change password')), /*#__PURE__*/_react
|
|
103
|
-
onClick:
|
|
104
|
+
}, t('AuthHeader|Change password')), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
105
|
+
onClick: () => {
|
|
104
106
|
logout();
|
|
105
107
|
}
|
|
106
|
-
}, /*#__PURE__*/_react
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
107
109
|
className: "text-danger"
|
|
108
110
|
}, t('AuthHeader|Log out')))));
|
|
109
111
|
}
|