Skip to content

Commit

Permalink
[frontend] fix useSensitiveModifications
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Oct 2, 2024
1 parent 7fb7cfd commit db69960
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const PoliciesComponent: FunctionComponent<PoliciesComponentProps> = ({
<span>
<ObjectOrganizationField
name="platform_organization"
disabled={!isEnterpriseEdition || (ffenabled && !isPlatformOrgaModificationAllowed())}
disabled={!isEnterpriseEdition || (ffenabled && !isPlatformOrgaModificationAllowed)}
label={'Platform organization'}
onChange={(name: string, value: Option) => handleSubmitField(name, value || null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,12 @@ const useSensitiveModifications = () => {
return role.can_manage_sensitive_config ?? true;
};

/**
* Return true when current user has the fake capa can_manage_sensitive_config enabled.
*/
const isPlatformOrgaModificationAllowed = () => {
return me.can_manage_sensitive_config;
};

return {
ffenabled: isFeatureEnable(PROTECT_SENSITIVE_CHANGES_FF),
isGroupEditionAllowed,
isRoleEditionAllowed,
isRoleWithManageSensitiveConfig,
isPlatformOrgaModificationAllowed,
isPlatformOrgaModificationAllowed: me.can_manage_sensitive_config ?? true,
};
};

Expand Down

0 comments on commit db69960

Please sign in to comment.