@@ -48,18 +48,20 @@ const ResourceDetailsAccessPolicyTab = ({
48
48
editAccessRole,
49
49
policyChanged,
50
50
setPolicyChanged,
51
+ withOverrideButton
51
52
} : {
52
53
resourceId : string ,
53
54
header : ParseKeys ,
54
55
policies : TransformedAcl [ ] ,
55
56
fetchHasActiveTransactions ?: AsyncThunk < any , string , any >
56
57
fetchAccessPolicies : AsyncThunk < TransformedAcl [ ] , string , any > ,
57
- saveNewAccessPolicies : AsyncThunk < boolean , { id : string , policies : { acl : Acl } } , any >
58
+ saveNewAccessPolicies : AsyncThunk < boolean , { id : string , policies : { acl : Acl } , override ?: boolean } , any >
58
59
descriptionText : string ,
59
60
buttonText : ParseKeys ,
60
61
editAccessRole : string ,
61
62
policyChanged : boolean ,
62
63
setPolicyChanged : ( value : boolean ) => void ,
64
+ withOverrideButton ?: boolean
63
65
} ) => {
64
66
const { t } = useTranslation ( ) ;
65
67
const dispatch = useAppDispatch ( ) ;
@@ -135,7 +137,7 @@ const ResourceDetailsAccessPolicyTab = ({
135
137
136
138
/* transforms rules into proper format for saving and checks validity
137
139
* if the policies are valid, the new policies are saved in the backend */
138
- const saveAccess = ( values : { policies : TransformedAcl [ ] } ) => {
140
+ const saveAccess = ( values : { policies : TransformedAcl [ ] } , override : boolean ) => {
139
141
dispatch ( removeNotificationWizardForm ( ) ) ;
140
142
const { roleWithFullRightsExists, allRulesValid } = validatePolicies (
141
143
values
@@ -163,7 +165,7 @@ const ResourceDetailsAccessPolicyTab = ({
163
165
}
164
166
165
167
if ( allRulesValid && roleWithFullRightsExists ) {
166
- dispatch ( saveNewAccessPolicies ( { id : resourceId , policies : access } ) ) . then ( ( success ) => {
168
+ dispatch ( saveNewAccessPolicies ( { id : resourceId , policies : access , override : override } ) ) . then ( ( success ) => {
167
169
// fetch new policies from the backend, if save successful
168
170
if ( success ) {
169
171
setPolicyChanged ( false ) ;
@@ -321,7 +323,7 @@ const ResourceDetailsAccessPolicyTab = ({
321
323
enableReinitialize
322
324
validate = { ( values ) => validateFormik ( values ) }
323
325
onSubmit = { ( values ) =>
324
- saveAccess ( values )
326
+ saveAccess ( values , false )
325
327
}
326
328
>
327
329
{ ( formik ) => (
@@ -650,8 +652,13 @@ const ResourceDetailsAccessPolicyTab = ({
650
652
{ ! transactions . read_only && < SaveEditFooter
651
653
active = { policyChanged && formik . dirty }
652
654
reset = { ( ) => resetPolicies ( formik . resetForm ) }
653
- submit = { ( ) => saveAccess ( formik . values ) }
655
+ submit = { ( ) => saveAccess ( formik . values , false ) }
654
656
isValid = { formik . isValid }
657
+ additionalButton = { withOverrideButton ? {
658
+ label : "EVENTS.SERIES.DETAILS.ACCESS.ACCESS_POLICY.REPLACE_EVENT_ACLS" ,
659
+ hint : "EVENTS.SERIES.DETAILS.ACCESS.ACCESS_POLICY.REPLACE_EVENT_ACLS_HINT" ,
660
+ onClick : ( ) => saveAccess ( formik . values , true )
661
+ } : undefined }
655
662
/> }
656
663
</ div >
657
664
) }
0 commit comments