authscape 1.0.564 → 1.0.570
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/index.js +29 -19
- package/package.json +1 -1
- package/src/components/AuthScapeApp.js +36 -22
package/index.js
CHANGED
|
@@ -350,26 +350,36 @@ function AuthScapeApp(_ref) {
|
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
352
|
var GetSignedInUser = function GetSignedInUser() {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
353
|
+
if (signedInUser != null) {
|
|
354
|
+
var _signedInUser = signedInUser.current;
|
|
355
|
+
if (_signedInUser != null) {
|
|
356
|
+
_signedInUser.HasRole = function (name) {
|
|
357
|
+
if (_signedInUser.roles != null) {
|
|
358
|
+
if (_signedInUser.roles.find(function (r) {
|
|
359
|
+
return r.name === name;
|
|
360
|
+
}) != null) {
|
|
361
|
+
return true;
|
|
362
|
+
} else {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
_signedInUser.HasPermission = function (name) {
|
|
368
|
+
if (_signedInUser.permissions != null) {
|
|
369
|
+
if (_signedInUser.permissions.find(function (r) {
|
|
370
|
+
return r === name;
|
|
371
|
+
}) != null) {
|
|
372
|
+
return true;
|
|
373
|
+
} else {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
};
|
|
370
378
|
}
|
|
371
|
-
|
|
372
|
-
|
|
379
|
+
return _signedInUser;
|
|
380
|
+
} else {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
373
383
|
};
|
|
374
384
|
var useStore = (0, _zustand.create)(function (set) {
|
|
375
385
|
return store;
|
package/package.json
CHANGED
|
@@ -337,35 +337,49 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
|
|
|
337
337
|
|
|
338
338
|
const GetSignedInUser = () => {
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
if (signedInUser != null)
|
|
341
|
+
{
|
|
342
|
+
let _signedInUser = signedInUser.current;
|
|
343
343
|
|
|
344
|
-
if (
|
|
344
|
+
if (_signedInUser != null)
|
|
345
345
|
{
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
else
|
|
349
|
-
{
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
346
|
+
_signedInUser.HasRole = function(name) {
|
|
352
347
|
|
|
353
|
-
|
|
348
|
+
if (_signedInUser.roles != null)
|
|
349
|
+
{
|
|
350
|
+
if (_signedInUser.roles.find(r => r.name === name) != null)
|
|
351
|
+
{
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
else
|
|
355
|
+
{
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
354
360
|
|
|
355
|
-
|
|
361
|
+
_signedInUser.HasPermission = function(name) {
|
|
356
362
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
363
|
+
if (_signedInUser.permissions != null)
|
|
364
|
+
{
|
|
365
|
+
if (_signedInUser.permissions.find(r => r === name) != null)
|
|
366
|
+
{
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
else
|
|
370
|
+
{
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
364
375
|
}
|
|
365
376
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
377
|
+
return _signedInUser;
|
|
378
|
+
}
|
|
379
|
+
else
|
|
380
|
+
{
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
369
383
|
}
|
|
370
384
|
|
|
371
385
|
|