From 98c981f4f3c0d991a8d4f486acb630a20b0995b2 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Mon, 30 Dec 2024 17:57:04 +0100 Subject: [PATCH] :sparkles: [#4650] Add option to skip ownership checks to options UI --- .../variables/prefill/PrefillSummary.js | 2 ++ .../prefill/objects_api/ObjectsAPIFields.js | 31 ++++++++++++----- .../prefill/objects_api/SkipOwnershipCheck.js | 34 +++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 src/openforms/js/components/admin/form_design/variables/prefill/objects_api/SkipOwnershipCheck.js diff --git a/src/openforms/js/components/admin/form_design/variables/prefill/PrefillSummary.js b/src/openforms/js/components/admin/form_design/variables/prefill/PrefillSummary.js index a6265f56b4..6d072ea52d 100644 --- a/src/openforms/js/components/admin/form_design/variables/prefill/PrefillSummary.js +++ b/src/openforms/js/components/admin/form_design/variables/prefill/PrefillSummary.js @@ -94,6 +94,8 @@ const PrefillSummary = ({ } isOpen={modalOpen} closeModal={() => setModalOpen(false)} + // FIXME: push this down to the plugin-specific components, somehow + extraModifiers={plugin === 'objects_api' ? ['large'] : undefined} > { const {values, setFieldValue, setValues} = useFormikContext(); const { plugin, - options: {objecttypeUuid, objecttypeVersion, objectsApiGroup}, + options: {objecttypeUuid, objecttypeVersion, objectsApiGroup, skipOwnershipCheck}, } = values; const {showCopyButton, toggleShowCopyButton} = useStatus(); @@ -90,6 +91,7 @@ const ObjectsAPIFields = () => { objectsApiGroup: null, objecttypeUuid: '', objecttypeVersion: null, + skipOwnershipCheck: false, authAttributePath: undefined, variablesMapping: [], }; @@ -235,13 +237,26 @@ const ObjectsAPIFields = () => { objectTypeFieldName="options.objecttypeUuid" /> - + + +
+ } + > + + {!skipOwnershipCheck && ( + + )}
{ + const [fieldProps] = useField({name: 'options.skipOwnershipCheck', type: 'checkbox'}); + return ( + + + } + helpText={ + + } + {...fieldProps} + /> + + ); +}; + +SkipOwnershipCheck.propTypes = {}; + +export default SkipOwnershipCheck;