2023-04-05 15:34:33 +02:00
|
|
|
import { getPermissionDescription } from '../../../helpers/utils/permission';
|
2022-09-23 12:39:54 +02:00
|
|
|
|
|
|
|
export function getSnapInstallWarnings(permissions, targetSubjectMetadata, t) {
|
2023-03-29 21:17:57 +02:00
|
|
|
const weightOneWarnings = Object.entries(permissions).reduce(
|
|
|
|
(filteredWarnings, [permissionName, permissionValue]) => {
|
2023-04-05 15:34:33 +02:00
|
|
|
const permissionDescription = getPermissionDescription({
|
2023-03-29 21:17:57 +02:00
|
|
|
t,
|
2023-04-05 15:34:33 +02:00
|
|
|
permissionName,
|
2023-03-29 21:17:57 +02:00
|
|
|
permissionValue,
|
|
|
|
targetSubjectMetadata,
|
|
|
|
});
|
2023-04-05 15:34:33 +02:00
|
|
|
|
|
|
|
return filteredWarnings.concat(
|
|
|
|
permissionDescription.filter((description) => description.weight === 1),
|
|
|
|
);
|
2023-03-29 21:17:57 +02:00
|
|
|
},
|
|
|
|
[],
|
|
|
|
);
|
2022-09-23 12:39:54 +02:00
|
|
|
|
2023-03-29 21:17:57 +02:00
|
|
|
return weightOneWarnings;
|
2022-09-23 12:39:54 +02:00
|
|
|
}
|