mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-04 00:18:40 +01:00
fix: copy strategy is allowed to copy to self (duplicate) (#9407)
When checking for permissions we were checking if the user was allowed to copy to other environments but it can also copy to the same environment. Before the change:  After the change: 
This commit is contained in:
parent
f3ede7681f
commit
4ae09fdb05
@ -278,7 +278,7 @@ const copyButtonsActiveInOtherEnv = async () => {
|
||||
|
||||
// production
|
||||
const productionStrategyCopyButton = copyButtons[0];
|
||||
expect(productionStrategyCopyButton).toBeDisabled();
|
||||
expect(productionStrategyCopyButton).toBeEnabled();
|
||||
|
||||
// custom env
|
||||
const customEnvStrategyCopyButton = copyButtons[1];
|
||||
|
@ -95,11 +95,11 @@ export const CopyStrategyIconMenu: VFC<ICopyStrategyIconMenuProps> = ({
|
||||
onClose();
|
||||
};
|
||||
|
||||
const enabled = environments.some((environment) =>
|
||||
const enabled = [...environments, environmentId].some((environment) =>
|
||||
checkAccess(CREATE_FEATURE_STRATEGY, environment),
|
||||
);
|
||||
|
||||
const label = `Copy to environment${enabled ? '' : ' (Access denied)'}`;
|
||||
const label = `Copy to environment${enabled ? '' : ` (Access denied, missing ${CREATE_FEATURE_STRATEGY} permission)`}`;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user