authscape 1.0.550 → 1.0.554

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.550",
3
+ "version": "1.0.554",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -333,6 +333,30 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
333
333
  toast.error(message);
334
334
  }
335
335
  }
336
+
337
+ const HasRole = (roleName) => {
338
+
339
+ if (currentUser.roles.find(r => r.name === roleName) != null)
340
+ {
341
+ return true;
342
+ }
343
+ else
344
+ {
345
+ return false;
346
+ }
347
+ }
348
+
349
+ const HasPermission = (permissionName) => {
350
+
351
+ if (currentUser.permissions.find(r => r === permissionName) != null)
352
+ {
353
+ return true;
354
+ }
355
+ else
356
+ {
357
+ return false;
358
+ }
359
+ }
336
360
 
337
361
 
338
362
  const useStore = create((set) => (store));
@@ -364,11 +388,13 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
364
388
  setInfoToastMessage: setInfoToastMessage,
365
389
  setSuccessToastMessage: setSuccessToastMessage,
366
390
  setWarnToastMessage: setWarnToastMessage,
367
- setErrorToastMessage: setErrorToastMessage
391
+ setErrorToastMessage: setErrorToastMessage,
392
+ hasRole: HasRole,
393
+ hasPermission: HasPermission
368
394
  })}
369
395
 
370
396
  {layout == null &&
371
- <Component {...pageProps} currentUser={signedInUser.current} loadedUser={frontEndLoadedState} setIsLoading={setIsLoading} logEvent={logEvent} logPurchase={logPurchase} store={useStore} setToastMessage={setToastMessage} setInfoToastMessage={setInfoToastMessage} setSuccessToastMessage={setSuccessToastMessage} setWarnToastMessage={setWarnToastMessage} setErrorToastMessage={setErrorToastMessage} />
397
+ <Component {...pageProps} currentUser={signedInUser.current} loadedUser={frontEndLoadedState} setIsLoading={setIsLoading} logEvent={logEvent} logPurchase={logPurchase} store={useStore} setToastMessage={setToastMessage} setInfoToastMessage={setInfoToastMessage} setSuccessToastMessage={setSuccessToastMessage} setWarnToastMessage={setWarnToastMessage} setErrorToastMessage={setErrorToastMessage} hasRole={HasRole} hasPermission={HasPermission} />
372
398
  }
373
399
  </>
374
400
  }
@@ -190,61 +190,61 @@ export const FileUploader = ({
190
190
 
191
191
  {variant == "filemanager" &&
192
192
  <Grid container spacing={2}>
193
- <Grid ref={refOveride} item xs={4} onClick={handleUploadFileInput}>
194
- <Grid
195
- container
196
- sx={{
197
- padding: 2,
198
- backgroundColor: "#ECEDED",
199
- fontSize: "14px",
200
- cursor: "pointer",
201
- borderRadius: "8px",
202
- border: "1px dashed #C8D4D5",
203
- }}
204
- >
205
- <Grid item xs={2}>
206
- <Box>
207
- <FileCopyRoundedIcon
208
- sx={{ fill: "#C8D4D5", width: 50, height: 50 }}
209
- />
210
- </Box>
211
- </Grid>
212
- <Grid item xs={10}>
213
- <Box>Drag and drop files here or</Box>
214
- <Box sx={{ marginTop: 1 }}>
215
- <Stack direction="row" spacing={2}>
216
- <UploadRoundedIcon
217
- sx={{ fill: primaryColor, width: 30, height: 30 }}
218
- />
219
- <Typography
220
- variant="h3"
221
- component={"span"}
222
- sx={{ color: primaryColor, paddingTop: 0.6 }}
223
- >
224
- Upload
225
- </Typography>
226
- </Stack>
227
- </Box>
228
- </Grid>
229
- <Grid item xs={12}>
230
- {loaded > 0 && (
231
- <LinearProgress
232
- variant="buffer"
233
- value={loaded}
234
- sx={{ marginTop: 2 }}
235
- />
236
- )}
237
-
238
- {loaded == 100 && (
239
- <Typography
240
- variant="h3"
241
- component={"span"}
242
- sx={{ color: primaryColor, paddingTop: 0.6 }}>
243
- Completed
244
- </Typography>
245
- )}
246
- </Grid>
247
- </Grid>
193
+ <Grid ref={refOveride} item xs={12} onClick={handleUploadFileInput}>
194
+ <Grid
195
+ container
196
+ sx={{
197
+ padding: 2,
198
+ backgroundColor: "#ECEDED",
199
+ fontSize: "14px",
200
+ cursor: "pointer",
201
+ borderRadius: "8px",
202
+ border: "1px dashed #C8D4D5",
203
+ }}
204
+ >
205
+ <Grid item xs={2}>
206
+ <Box>
207
+ <FileCopyRoundedIcon
208
+ sx={{ fill: "#C8D4D5", width: 50, height: 50 }}
209
+ />
210
+ </Box>
211
+ </Grid>
212
+ <Grid item xs={10}>
213
+ <Box>Drag and drop files here or</Box>
214
+ <Box sx={{ marginTop: 1 }}>
215
+ <Stack direction="row" spacing={2}>
216
+ <UploadRoundedIcon
217
+ sx={{ fill: primaryColor, width: 30, height: 30 }}
218
+ />
219
+ <Typography
220
+ variant="h3"
221
+ component={"span"}
222
+ sx={{ color: primaryColor, paddingTop: 0.6 }}
223
+ >
224
+ Upload
225
+ </Typography>
226
+ </Stack>
227
+ </Box>
228
+ </Grid>
229
+ <Grid item xs={12}>
230
+ {loaded > 0 && (
231
+ <LinearProgress
232
+ variant="buffer"
233
+ value={loaded}
234
+ sx={{ marginTop: 2 }}
235
+ />
236
+ )}
237
+
238
+ {loaded == 100 && (
239
+ <Typography
240
+ variant="h3"
241
+ component={"span"}
242
+ sx={{ color: primaryColor, paddingTop: 0.6 }}>
243
+ Completed
244
+ </Typography>
245
+ )}
246
+ </Grid>
247
+ </Grid>
248
248
  </Grid>
249
249
 
250
250
  {children}