diff --git a/src/components/events/partials/ModalTabsAndPages/SeriesDetailsAccessTab.tsx b/src/components/events/partials/ModalTabsAndPages/SeriesDetailsAccessTab.tsx index 9f9ee80c50..b39f8c68e0 100644 --- a/src/components/events/partials/ModalTabsAndPages/SeriesDetailsAccessTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/SeriesDetailsAccessTab.tsx @@ -8,6 +8,9 @@ import { import { removeNotificationWizardForm } from "../../../../slices/notificationSlice"; import { useAppDispatch, useAppSelector } from "../../../../store"; import { ParseKeys } from "i18next"; +import { + getOrgProperties, +} from "../../../../selectors/userInfoSelectors"; /** * This component manages the access policy tab of the series details modal @@ -28,6 +31,9 @@ const SeriesDetailsAccessTab = ({ const policies = useAppSelector(state => getSeriesDetailsAcl(state)); const policyTemplateId = useAppSelector(state => getPolicyTemplateId(state)); + const orgProperties = useAppSelector(state => getOrgProperties(state)); + const overrideEnabled = (orgProperties["admin.series.acl.event.update.mode"] || "optional").toLowerCase() === "optional"; + useEffect(() => { dispatch(removeNotificationWizardForm()); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -54,7 +60,7 @@ const SeriesDetailsAccessTab = ({ viewNonUsersAccessRole={"ROLE_UI_SERIES_DETAILS_ACL_NONUSER_ROLES_VIEW"} policyChanged={policyChanged} setPolicyChanged={setPolicyChanged} - withOverrideButton={true} + withOverrideButton={overrideEnabled} /> ); }; diff --git a/src/components/shared/SaveEditFooter.tsx b/src/components/shared/SaveEditFooter.tsx index 0bc0135e13..b8cc306028 100644 --- a/src/components/shared/SaveEditFooter.tsx +++ b/src/components/shared/SaveEditFooter.tsx @@ -8,6 +8,7 @@ type SaveEditFooterProps = { reset: () => void; submit: () => void; isValid?: boolean; + customSaveButtonText?: ParseKeys; additionalButton?: { label: ParseKeys, hint: ParseKeys, @@ -20,10 +21,13 @@ export const SaveEditFooter: React.FC = ({ reset, submit, isValid, + customSaveButtonText, additionalButton, }) => { const { t } = useTranslation(); + const saveButtonText = customSaveButtonText || "SAVE"; + return ; }; diff --git a/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx b/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx index cdc78708d9..a4bfcc15ec 100644 --- a/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx +++ b/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx @@ -376,6 +376,7 @@ const ResourceDetailsAccessPolicyTab = ({ hint: "EVENTS.SERIES.DETAILS.ACCESS.ACCESS_POLICY.REPLACE_EVENT_ACLS_HINT", onClick: () => saveAccess(formik.values, true), } : undefined} + customSaveButtonText={withOverrideButton ? "EVENTS.SERIES.DETAILS.ACCESS.ACCESS_POLICY.SAVE_SERIES_ACL_ONLY" : undefined} />} )} diff --git a/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json b/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json index ae33393ffe..6bbf708e61 100644 --- a/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json +++ b/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json @@ -1225,12 +1225,14 @@ "ADDITIONAL_ACTIONS": "Additional Actions", "ACTION": "Actions", "NEW": "New policy", + "DETAILS": "Details", + "REPLACE_EVENT_ACLS": "Save series and overwrite event permissions", + "REPLACE_EVENT_ACLS_HINT": "Save the series permissions and overwrite the permissions for all events in this series.", + "SAVE_SERIES_ACL_ONLY": "Save series permission", "NON_USER_ROLES": "Roles and Groups authorized for the series", "USER": "User", "USERS": "Users who are authorized for the series", "NEW_USER": "New user", - "REPLACE_EVENT_ACLS": "Update series permissions", - "REPLACE_EVENT_ACLS_HINT": "Ensure all events of this series have these permissions in effect", "LOAD_MORE_LIMIT": "policies shown.", "LOAD_MORE_LINK": "Load more" }, diff --git a/src/slices/seriesDetailsSlice.ts b/src/slices/seriesDetailsSlice.ts index 39fd0fb791..249d6a7af5 100644 --- a/src/slices/seriesDetailsSlice.ts +++ b/src/slices/seriesDetailsSlice.ts @@ -5,6 +5,9 @@ import { getSeriesDetailsExtendedMetadata, getStatistics, } from "../selectors/seriesDetailsSelectors"; +import { + getOrgProperties, +} from "../selectors/userInfoSelectors"; import { addNotification } from "./notificationSlice"; import { transformMetadataCollection, @@ -258,12 +261,19 @@ export const updateSeriesAccess = createAppAsyncThunk("seriesDetails/updateSerie id: Series["id"], policies: { acl: Acl }, override?: boolean - }, { dispatch }) => { + }, { dispatch, getState }) => { const { id, policies, override } = params; const data = new URLSearchParams(); - const overrideString = override ? String(true) : String(false); + // Here we should check for the "always" option as well, so that we can force override! + const orgProperties = getOrgProperties(getState()); + const alwaysOverride = (orgProperties["admin.series.acl.event.update.mode"] || "optional").toLowerCase() === "always"; + + let overrideString = override ? String(true) : String(false); + if (alwaysOverride) { + overrideString = String(true); + } data.append("acl", JSON.stringify(policies)); data.append("override", overrideString);