orc-shared 1.4.0 → 1.5.0-dev.10
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/actions/applications.js +14 -52
- package/dist/actions/authentication.js +10 -45
- package/dist/actions/countries.js +6 -36
- package/dist/actions/locale.js +14 -54
- package/dist/actions/makeApiAction.js +31 -79
- package/dist/actions/makeOrcApiAction.js +3 -26
- package/dist/actions/metadata.js +65 -174
- package/dist/actions/modules.js +0 -26
- package/dist/actions/navigation.js +3 -33
- package/dist/actions/requestState.js +0 -18
- package/dist/actions/requestsApi.js +0 -17
- package/dist/actions/scopes.js +14 -56
- package/dist/actions/timezones.js +6 -36
- package/dist/actions/toasts.js +3 -23
- package/dist/actions/versionInfo.js +6 -39
- package/dist/actions/view.js +0 -38
- package/dist/buildStore.js +3 -53
- package/dist/components/AppFrame/About.js +8 -70
- package/dist/components/AppFrame/Anchor.js +1 -25
- package/dist/components/AppFrame/AppFrame.js +23 -92
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +4 -35
- package/dist/components/AppFrame/ApplicationSelector/Header.js +1 -31
- package/dist/components/AppFrame/ApplicationSelector/index.js +1 -30
- package/dist/components/AppFrame/ConnectedToastList.js +0 -31
- package/dist/components/AppFrame/Help.js +0 -25
- package/dist/components/AppFrame/MenuItem.js +17 -70
- package/dist/components/AppFrame/Preferences.js +17 -79
- package/dist/components/AppFrame/Sidebar.js +8 -53
- package/dist/components/AppFrame/Topbar.js +9 -65
- package/dist/components/AppFrame/index.js +0 -20
- package/dist/components/AppFrame/useApplicationHelpUrl.js +0 -22
- package/dist/components/ApplicationModuleLoader.js +7 -46
- package/dist/components/Authenticate.js +5 -48
- package/dist/components/Button.js +0 -24
- package/dist/components/CategoryList.js +27 -82
- package/dist/components/Checkbox.js +3 -41
- package/dist/components/ColumnWrapper.js +0 -19
- package/dist/components/Culture.js +0 -29
- package/dist/components/DevPages.js +0 -21
- package/dist/components/DropMenu/Menu.js +4 -36
- package/dist/components/DropMenu/index.js +12 -50
- package/dist/components/ErrorPlaceholder.js +3 -31
- package/dist/components/Form/Combination.js +3 -28
- package/dist/components/Form/Field.js +6 -37
- package/dist/components/Form/FieldElements.js +9 -41
- package/dist/components/Form/FieldList.js +28 -92
- package/dist/components/Form/Fieldset.js +1 -27
- package/dist/components/Form/Form.js +6 -37
- package/dist/components/Form/FormElement.js +1 -20
- package/dist/components/Form/InputField.js +17 -66
- package/dist/components/Form/Inputs/Button.js +5 -35
- package/dist/components/Form/Inputs/Date.js +2 -28
- package/dist/components/Form/Inputs/FieldButtons.js +0 -25
- package/dist/components/Form/Inputs/Number.js +7 -46
- package/dist/components/Form/Inputs/ReadOnly.js +0 -29
- package/dist/components/Form/Inputs/SmallButton.js +6 -38
- package/dist/components/Form/Inputs/Text.js +8 -41
- package/dist/components/Form/Inputs/Time.js +4 -33
- package/dist/components/Form/Inputs/Toggles.js +5 -39
- package/dist/components/Form/Inputs/Translation.js +21 -78
- package/dist/components/Form/Inputs/index.js +0 -28
- package/dist/components/Form/index.js +0 -20
- package/dist/components/Head.js +0 -22
- package/dist/components/I18n.js +0 -28
- package/dist/components/Icon.js +1 -27
- package/dist/components/IconButton.js +2 -32
- package/dist/components/Input.js +2 -42
- package/dist/components/InternetExplorerWarningMessage.js +0 -31
- package/dist/components/List/DataCell.js +3 -42
- package/dist/components/List/HeadCell.js +3 -43
- package/dist/components/List/HeadRow.js +2 -25
- package/dist/components/List/List.js +37 -107
- package/dist/components/List/Row.js +7 -38
- package/dist/components/List/enhanceColumnDefs.js +3 -29
- package/dist/components/List/index.js +0 -20
- package/dist/components/Loader.js +5 -48
- package/dist/components/LoadingIcon.js +0 -24
- package/dist/components/MaterialUI/DataDisplay/Badge.js +2 -31
- package/dist/components/MaterialUI/DataDisplay/Chip.js +1 -33
- package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +7 -51
- package/dist/components/MaterialUI/DataDisplay/Divider.js +0 -30
- package/dist/components/MaterialUI/DataDisplay/Icon.js +2 -28
- package/dist/components/MaterialUI/DataDisplay/List.js +16 -55
- package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -37
- package/dist/components/MaterialUI/DataDisplay/Notification.js +17 -69
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +3 -34
- package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +0 -22
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +5 -37
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +1 -33
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +7 -28
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +2 -32
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +17 -57
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +4 -33
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +0 -25
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +14 -60
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +0 -29
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +15 -59
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +23 -70
- package/dist/components/MaterialUI/DataDisplay/Table.js +34 -123
- package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +0 -35
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -49
- package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -21
- package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +4 -32
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -46
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +3 -29
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +0 -21
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +32 -97
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +3 -38
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +3 -37
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +3 -41
- package/dist/components/MaterialUI/DataDisplay/index.js +0 -33
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +3 -36
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +5 -68
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +11 -48
- package/dist/components/MaterialUI/Feedback/NotificationContext.js +5 -40
- package/dist/components/MaterialUI/Feedback/loadingScreen.js +5 -44
- package/dist/components/MaterialUI/Feedback/useNotification.js +0 -21
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -44
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +3 -37
- package/dist/components/MaterialUI/Inputs/Checkbox.js +3 -40
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +3 -43
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +3 -38
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +3 -39
- package/dist/components/MaterialUI/Inputs/DatePicker.js +18 -57
- package/dist/components/MaterialUI/Inputs/InputBase.js +7 -56
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +3 -51
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +12 -65
- package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +3 -31
- package/dist/components/MaterialUI/Inputs/Radio.js +8 -54
- package/dist/components/MaterialUI/Inputs/RadioProps.js +3 -41
- package/dist/components/MaterialUI/Inputs/Select.js +10 -72
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -46
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +3 -35
- package/dist/components/MaterialUI/Inputs/Switch.js +4 -38
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +3 -40
- package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -91
- package/dist/components/MaterialUI/Inputs/createInput.js +5 -30
- package/dist/components/MaterialUI/Inputs/index.js +0 -35
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +3 -41
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +12 -56
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +3 -33
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +2 -27
- package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +4 -31
- package/dist/components/MaterialUI/Navigation/TabBar.js +22 -103
- package/dist/components/MaterialUI/Navigation/TabLabel.js +7 -41
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +7 -42
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +22 -62
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +16 -68
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +15 -55
- package/dist/components/MaterialUI/Surfaces/Paper.js +1 -31
- package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +3 -28
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +19 -62
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +3 -55
- package/dist/components/MaterialUI/Surfaces/paperProps.js +3 -36
- package/dist/components/MaterialUI/componentProps.js +3 -29
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -59
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +8 -44
- package/dist/components/MaterialUI/muiThemes.js +5 -57
- package/dist/components/MaterialUI/textProps.js +3 -33
- package/dist/components/Modal/Background.js +0 -19
- package/dist/components/Modal/Dialog.js +2 -26
- package/dist/components/Modal/Wrapper.js +0 -26
- package/dist/components/Modal/index.js +8 -44
- package/dist/components/Modules.js +21 -93
- package/dist/components/MultiSelector.js +21 -74
- package/dist/components/Navigation/Bar.js +29 -90
- package/dist/components/Navigation/Tab.js +22 -74
- package/dist/components/Navigation/index.js +2 -21
- package/dist/components/Navigation/useNavigationState.js +90 -173
- package/dist/components/Placeholder.js +5 -43
- package/dist/components/Provision.js +4 -36
- package/dist/components/Routing/FullPage.js +14 -37
- package/dist/components/Routing/Page.js +14 -51
- package/dist/components/Routing/Segment.js +5 -30
- package/dist/components/Routing/SegmentPage.js +26 -106
- package/dist/components/Routing/SubPage.js +22 -59
- package/dist/components/Routing/withWaypointing.js +5 -36
- package/dist/components/Scope/ScopeModificationConfirmationDialog.js +3 -30
- package/dist/components/Scope/ScopeNode.js +8 -49
- package/dist/components/Scope/Selector.js +8 -44
- package/dist/components/Scope/index.js +29 -96
- package/dist/components/Scope/useScopeConfirmationModalState.js +33 -100
- package/dist/components/Scope/useScopeData.js +0 -25
- package/dist/components/Scope/useScopeSelect.js +0 -26
- package/dist/components/Selector.js +15 -76
- package/dist/components/Sidepanel.js +0 -28
- package/dist/components/Spritesheet.js +0 -26
- package/dist/components/Switch.js +11 -51
- package/dist/components/Text.js +6 -50
- package/dist/components/ToastList.js +5 -45
- package/dist/components/Toolbar.js +16 -74
- package/dist/components/Tooltip.js +0 -24
- package/dist/components/Treeview/Branch.js +0 -25
- package/dist/components/Treeview/Label.js +0 -29
- package/dist/components/Treeview/Leaf.js +0 -21
- package/dist/components/Treeview/Node.js +17 -55
- package/dist/components/Treeview/index.js +25 -66
- package/dist/components/Treeview/settings.js +0 -17
- package/dist/constants.js +5 -18
- package/dist/content/iconsSheet.svg +22 -0
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/getTheme.js +0 -29
- package/dist/getThemeOverrides.js +3 -22
- package/dist/hocs/routingConnector.js +0 -21
- package/dist/hocs/withAuthentication.js +4 -26
- package/dist/hocs/withClickOutside.js +2 -28
- package/dist/hocs/withErrorBoundary.js +2 -37
- package/dist/hocs/withId.js +1 -30
- package/dist/hocs/withInfiniteScroll.js +15 -32
- package/dist/hocs/withInitialLoad.js +0 -20
- package/dist/hocs/withLocaleSwitch.js +0 -19
- package/dist/hocs/withNavigationLink.js +5 -32
- package/dist/hocs/withRequestActivity.js +0 -21
- package/dist/hocs/withScopeData.js +6 -33
- package/dist/hocs/withScrollBox.js +2 -31
- package/dist/hocs/withToggle.js +9 -37
- package/dist/hocs/withUpdateHandler.js +3 -23
- package/dist/hocs/withViewState.js +5 -32
- package/dist/hooks/useDispatchWithModulesData.js +0 -26
- package/dist/hooks/useEditState.js +10 -105
- package/dist/hooks/useEntityLoader.js +18 -67
- package/dist/hooks/useFullEntityEditState.js +9 -56
- package/dist/hooks/useInfiniteScroll.js +5 -33
- package/dist/hooks/useLabelMessage.js +3 -42
- package/dist/hooks/useLoader.js +0 -27
- package/dist/hooks/useMultipleFieldEditState.js +3 -40
- package/dist/hooks/useNavigationHandler.js +3 -28
- package/dist/hooks/useNotificationRequestState.js +17 -47
- package/dist/hooks/usePreviousModified.js +0 -24
- package/dist/hooks/useRequestState.js +8 -38
- package/dist/hooks/useSelectorAndUnwrap.js +0 -23
- package/dist/hooks/useToggle.js +5 -35
- package/dist/hooks/useViewState.js +0 -23
- package/dist/index.js +1 -2
- package/dist/reducers/applications.js +0 -23
- package/dist/reducers/authentication.js +6 -37
- package/dist/reducers/countries.js +0 -25
- package/dist/reducers/localeFactory.js +0 -30
- package/dist/reducers/metadata.js +3 -63
- package/dist/reducers/modules.js +0 -36
- package/dist/reducers/navigation.js +8 -47
- package/dist/reducers/request.js +0 -28
- package/dist/reducers/requestStates.js +0 -42
- package/dist/reducers/scopes.js +0 -28
- package/dist/reducers/settings.js +4 -39
- package/dist/reducers/timezones.js +0 -25
- package/dist/reducers/toasts.js +0 -27
- package/dist/reducers/versionInfo.js +0 -24
- package/dist/reducers/view.js +36 -84
- package/dist/schemas/countries.js +0 -17
- package/dist/schemas/definitions.js +0 -17
- package/dist/schemas/metadata.js +0 -17
- package/dist/schemas/productDefinitions.js +0 -17
- package/dist/schemas/scopes.js +0 -17
- package/dist/schemas/timezones.js +0 -17
- package/dist/selectors/applications.js +0 -20
- package/dist/selectors/authentication.js +17 -41
- package/dist/selectors/countries.js +0 -22
- package/dist/selectors/locale.js +1 -29
- package/dist/selectors/metadata.js +4 -45
- package/dist/selectors/modules.js +3 -22
- package/dist/selectors/navigation.js +9 -39
- package/dist/selectors/requestStates.js +0 -22
- package/dist/selectors/requests.js +2 -22
- package/dist/selectors/route.js +0 -21
- package/dist/selectors/scope.js +0 -32
- package/dist/selectors/settings.js +0 -18
- package/dist/selectors/timezones.js +0 -19
- package/dist/selectors/versionInfo.js +0 -18
- package/dist/selectors/view.js +3 -74
- package/dist/sharedMessages.js +0 -17
- package/dist/spawnerMiddleware.js +0 -24
- package/dist/utils/buildUrl.js +7 -38
- package/dist/utils/countryHelper.js +0 -18
- package/dist/utils/curry.js +0 -19
- package/dist/utils/debounce.js +1 -20
- package/dist/utils/displayModeHelper.js +0 -24
- package/dist/utils/domHelper.js +0 -17
- package/dist/utils/flatten.js +7 -38
- package/dist/utils/index.js +0 -31
- package/dist/utils/insertIcons.js +0 -21
- package/dist/utils/localizationHelper.js +0 -26
- package/dist/utils/logPass.js +1 -22
- package/dist/utils/mapHelper.js +1 -25
- package/dist/utils/memoize.js +0 -23
- package/dist/utils/modelValidationHelper.js +3 -42
- package/dist/utils/normalizeForSearch.js +2 -19
- package/dist/utils/objectHelper.js +2 -24
- package/dist/utils/parseHelper.js +0 -32
- package/dist/utils/profilerHelper.js +0 -18
- package/dist/utils/propertyHelper.js +1 -38
- package/dist/utils/propertyValidator.js +0 -25
- package/dist/utils/requestProcessingHelper.js +0 -24
- package/dist/utils/safeGet.js +0 -18
- package/dist/utils/setTranslation.js +1 -28
- package/dist/utils/setTranslationWithFallback.js +1 -33
- package/dist/utils/stripKey.js +1 -23
- package/dist/utils/styledPropFuncs.js +3 -29
- package/dist/utils/testUtils.js +14 -91
- package/dist/utils/timezoneHelper.js +8 -46
- package/dist/utils/unwrapImmutable.js +0 -19
- package/dist/utils/urlHelper.js +3 -28
- package/dist/whyDidYouRerender.js +0 -5
- package/package.json +1 -1
- package/src/components/Routing/SubPage.js +17 -2
- package/src/components/Routing/SubPage.test.js +168 -1
- package/src/constants.js +2 -0
- package/src/content/iconsSheet.svg +22 -0
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +12 -2
- package/src/hooks/useEditState.test.js +1 -1
- package/src/selectors/authentication.js +13 -0
- package/src/selectors/authentication.test.js +322 -0
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
selectRolesClaims,
|
|
5
5
|
selectGroupRolesClaims,
|
|
6
6
|
hasEditorPermissions,
|
|
7
|
+
hasPermissionsForRole,
|
|
7
8
|
hasAdministratorPermissions,
|
|
8
9
|
hasReaderPermissions,
|
|
9
10
|
hasEditorPermissionsForScope,
|
|
11
|
+
hasPermissionsForRoleAndScope,
|
|
10
12
|
hasAdministratorPermissionsForScope,
|
|
11
13
|
hasReaderPermissionsForScope,
|
|
12
14
|
} from "./authentication";
|
|
@@ -455,6 +457,326 @@ describe("hasEditorPermissionsForScope", () => {
|
|
|
455
457
|
});
|
|
456
458
|
});
|
|
457
459
|
|
|
460
|
+
describe("hasPermissionsForRole", () => {
|
|
461
|
+
it("Retrieves true if user has permissions in specified group and role", () => {
|
|
462
|
+
const claims = Immutable.fromJS({
|
|
463
|
+
Orders: {
|
|
464
|
+
"*": {
|
|
465
|
+
Tester: true,
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
expect(
|
|
471
|
+
hasPermissionsForRole,
|
|
472
|
+
"when called with",
|
|
473
|
+
["Orders", "Tester"],
|
|
474
|
+
"called with",
|
|
475
|
+
[
|
|
476
|
+
Immutable.fromJS({
|
|
477
|
+
authentication: { rolesClaimsValues: claims },
|
|
478
|
+
navigation: {
|
|
479
|
+
route: { location: {}, match: { params: { scope: "Global" } } },
|
|
480
|
+
},
|
|
481
|
+
settings: { defaultScope: "Global" },
|
|
482
|
+
}),
|
|
483
|
+
],
|
|
484
|
+
"to equal",
|
|
485
|
+
true,
|
|
486
|
+
);
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
it("Retrieves false if user does not have permissions in specified group and role", () => {
|
|
490
|
+
const claims = Immutable.fromJS({
|
|
491
|
+
Orders: {
|
|
492
|
+
"*": {
|
|
493
|
+
Tester: false,
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
expect(
|
|
499
|
+
hasPermissionsForRole,
|
|
500
|
+
"when called with",
|
|
501
|
+
["Orders", "Tester"],
|
|
502
|
+
"called with",
|
|
503
|
+
[
|
|
504
|
+
Immutable.fromJS({
|
|
505
|
+
authentication: { rolesClaimsValues: claims },
|
|
506
|
+
...state,
|
|
507
|
+
}),
|
|
508
|
+
],
|
|
509
|
+
"to equal",
|
|
510
|
+
false,
|
|
511
|
+
);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
it("Retrieves true if user hasn't global permissions but, has in current scope in specified group for role", () => {
|
|
515
|
+
const claims = Immutable.fromJS({
|
|
516
|
+
Orders: {
|
|
517
|
+
"*": {
|
|
518
|
+
Tester: false,
|
|
519
|
+
},
|
|
520
|
+
MyScope: {
|
|
521
|
+
Tester: true,
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
expect(
|
|
527
|
+
hasPermissionsForRole,
|
|
528
|
+
"when called with",
|
|
529
|
+
["Orders", "Tester"],
|
|
530
|
+
"called with",
|
|
531
|
+
[
|
|
532
|
+
Immutable.fromJS({
|
|
533
|
+
authentication: { rolesClaimsValues: claims },
|
|
534
|
+
navigation: {
|
|
535
|
+
route: { location: {}, match: { params: { scope: "MyScope" } } },
|
|
536
|
+
},
|
|
537
|
+
settings: { defaultScope: "Global" },
|
|
538
|
+
}),
|
|
539
|
+
],
|
|
540
|
+
"to equal",
|
|
541
|
+
true,
|
|
542
|
+
);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it("Retrieves true if user has permissions just in specified scope for role", () => {
|
|
546
|
+
const claims = Immutable.fromJS({
|
|
547
|
+
Orders: {
|
|
548
|
+
MyScope: {
|
|
549
|
+
Tester: true,
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
expect(
|
|
555
|
+
hasPermissionsForRole,
|
|
556
|
+
"when called with",
|
|
557
|
+
["Orders", "Tester"],
|
|
558
|
+
"called with",
|
|
559
|
+
[
|
|
560
|
+
Immutable.fromJS({
|
|
561
|
+
authentication: { rolesClaimsValues: claims },
|
|
562
|
+
navigation: {
|
|
563
|
+
route: { location: {}, match: { params: { scope: "MyScope" } } },
|
|
564
|
+
},
|
|
565
|
+
settings: { defaultScope: "Global" },
|
|
566
|
+
}),
|
|
567
|
+
],
|
|
568
|
+
"to equal",
|
|
569
|
+
true,
|
|
570
|
+
);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it("Retrieves true if user has permissions just in specified scope with permission on parents for role", () => {
|
|
574
|
+
const claims = Immutable.fromJS({
|
|
575
|
+
Orders: {
|
|
576
|
+
MyScope: {
|
|
577
|
+
Tester: true,
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
expect(
|
|
583
|
+
hasPermissionsForRole,
|
|
584
|
+
"when called with",
|
|
585
|
+
["Orders", "Tester"],
|
|
586
|
+
"called with",
|
|
587
|
+
[
|
|
588
|
+
Immutable.fromJS({
|
|
589
|
+
authentication: { rolesClaimsValues: claims },
|
|
590
|
+
...state,
|
|
591
|
+
navigation: {
|
|
592
|
+
route: { location: {}, match: { params: { scope: "ChildScope" } } },
|
|
593
|
+
},
|
|
594
|
+
}),
|
|
595
|
+
],
|
|
596
|
+
"to equal",
|
|
597
|
+
true,
|
|
598
|
+
);
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it("Retrieves false if app roles claims are null", () => {
|
|
602
|
+
expect(
|
|
603
|
+
hasPermissionsForRole,
|
|
604
|
+
"when called with",
|
|
605
|
+
["Orders", "Tester"],
|
|
606
|
+
"called with",
|
|
607
|
+
[
|
|
608
|
+
Immutable.fromJS({
|
|
609
|
+
authentication: { rolesClaimsValues: {} },
|
|
610
|
+
navigation: {
|
|
611
|
+
route: { location: {}, match: { params: { scope: "Global" } } },
|
|
612
|
+
},
|
|
613
|
+
settings: { defaultScope: "Global" },
|
|
614
|
+
}),
|
|
615
|
+
],
|
|
616
|
+
"to equal",
|
|
617
|
+
false,
|
|
618
|
+
);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
describe("hasPermissionsForRoleAndScope", () => {
|
|
623
|
+
it("Retrieves true if user has permissions in specified group for role", () => {
|
|
624
|
+
const claims = Immutable.fromJS({
|
|
625
|
+
Orders: {
|
|
626
|
+
"*": {
|
|
627
|
+
Tester: true,
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
expect(
|
|
633
|
+
hasPermissionsForRoleAndScope,
|
|
634
|
+
"when called with",
|
|
635
|
+
["Global", "Orders", "Tester"],
|
|
636
|
+
"called with",
|
|
637
|
+
[
|
|
638
|
+
Immutable.fromJS({
|
|
639
|
+
authentication: { rolesClaimsValues: claims },
|
|
640
|
+
}),
|
|
641
|
+
],
|
|
642
|
+
"to equal",
|
|
643
|
+
true,
|
|
644
|
+
);
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
it("Retrieves false if user does not have permissions in specified group for role", () => {
|
|
648
|
+
const claims = Immutable.fromJS({
|
|
649
|
+
Orders: {
|
|
650
|
+
"*": {
|
|
651
|
+
Tester: false,
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
expect(
|
|
657
|
+
hasPermissionsForRoleAndScope,
|
|
658
|
+
"when called with",
|
|
659
|
+
["Global", "Orders", "Tester"],
|
|
660
|
+
"called with",
|
|
661
|
+
[
|
|
662
|
+
Immutable.fromJS({
|
|
663
|
+
authentication: { rolesClaimsValues: claims },
|
|
664
|
+
...state,
|
|
665
|
+
}),
|
|
666
|
+
],
|
|
667
|
+
"to equal",
|
|
668
|
+
false,
|
|
669
|
+
);
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
it("Retrieves true if user hasn't global permissions but, has in current scope in specified group for role", () => {
|
|
673
|
+
const claims = Immutable.fromJS({
|
|
674
|
+
Orders: {
|
|
675
|
+
"*": {
|
|
676
|
+
Tester: false,
|
|
677
|
+
},
|
|
678
|
+
MyScope: {
|
|
679
|
+
Tester: true,
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
expect(
|
|
685
|
+
hasPermissionsForRoleAndScope,
|
|
686
|
+
"when called with",
|
|
687
|
+
["MyScope", "Orders", "Tester"],
|
|
688
|
+
"called with",
|
|
689
|
+
[
|
|
690
|
+
Immutable.fromJS({
|
|
691
|
+
authentication: { rolesClaimsValues: claims },
|
|
692
|
+
navigation: {
|
|
693
|
+
route: { location: {}, match: { params: { scope: "MyScope" } } },
|
|
694
|
+
},
|
|
695
|
+
settings: { defaultScope: "Global" },
|
|
696
|
+
}),
|
|
697
|
+
],
|
|
698
|
+
"to equal",
|
|
699
|
+
true,
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
it("Retrieves true if user has permissions just in specified scope and role", () => {
|
|
704
|
+
const claims = Immutable.fromJS({
|
|
705
|
+
Orders: {
|
|
706
|
+
MyScope: {
|
|
707
|
+
Tester: true,
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
expect(
|
|
713
|
+
hasPermissionsForRoleAndScope,
|
|
714
|
+
"when called with",
|
|
715
|
+
["MyScope", "Orders", "Tester"],
|
|
716
|
+
"called with",
|
|
717
|
+
[
|
|
718
|
+
Immutable.fromJS({
|
|
719
|
+
authentication: { rolesClaimsValues: claims },
|
|
720
|
+
navigation: {
|
|
721
|
+
route: { location: {}, match: { params: { scope: "MyScope" } } },
|
|
722
|
+
},
|
|
723
|
+
settings: { defaultScope: "Global" },
|
|
724
|
+
}),
|
|
725
|
+
],
|
|
726
|
+
"to equal",
|
|
727
|
+
true,
|
|
728
|
+
);
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
it("Retrieves true if user has permissions just in specified scope with permission on parents for role", () => {
|
|
732
|
+
const claims = Immutable.fromJS({
|
|
733
|
+
Orders: {
|
|
734
|
+
MyScope: {
|
|
735
|
+
Tester: true,
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
expect(
|
|
741
|
+
hasPermissionsForRoleAndScope,
|
|
742
|
+
"when called with",
|
|
743
|
+
["ChildScope", "Orders", "Tester"],
|
|
744
|
+
"called with",
|
|
745
|
+
[
|
|
746
|
+
Immutable.fromJS({
|
|
747
|
+
authentication: { rolesClaimsValues: claims },
|
|
748
|
+
...state,
|
|
749
|
+
navigation: {
|
|
750
|
+
route: { location: {}, match: { params: { scope: "ChildScope" } } },
|
|
751
|
+
},
|
|
752
|
+
}),
|
|
753
|
+
],
|
|
754
|
+
"to equal",
|
|
755
|
+
true,
|
|
756
|
+
);
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
it("Retrieves false if app roles claims are null", () => {
|
|
760
|
+
expect(
|
|
761
|
+
hasPermissionsForRoleAndScope,
|
|
762
|
+
"when called with",
|
|
763
|
+
["Global", "Orders", "Tester"],
|
|
764
|
+
"called with",
|
|
765
|
+
[
|
|
766
|
+
Immutable.fromJS({
|
|
767
|
+
authentication: { rolesClaimsValues: {} },
|
|
768
|
+
navigation: {
|
|
769
|
+
route: { location: {}, match: { params: { scope: "Global" } } },
|
|
770
|
+
},
|
|
771
|
+
settings: { defaultScope: "Global" },
|
|
772
|
+
}),
|
|
773
|
+
],
|
|
774
|
+
"to equal",
|
|
775
|
+
false,
|
|
776
|
+
);
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
|
|
458
780
|
describe("hasAdministratorPermissions", () => {
|
|
459
781
|
it("Retrieves true if user has global administrator permissions in specified group", () => {
|
|
460
782
|
const claims = Immutable.fromJS({
|