metis-desk/modules/resources/src/api/application/resource-global-gates.ts
David d2bf856c97 feat(global-operating-systems): implement global operating systems management features
- Add softwareReferenceHref helper function for generating resource links.
- Create useGlobalResourceEditor hook for managing global application resources.
- Implement useGlobalResourceForm hook for handling global resource forms.
- Introduce GlobalSoftwareCatalogProvider for context management of global applications.
- Develop GlobalOperatingSystemsPage to render global operating systems using the existing GlobalApplicationsPage.
- Add operating system form identity helpers for managing OS-specific fields.
- Create operating system specification labels for better localization.
- Implement OperatingSystemIdentityReview component for reviewing OS identities.
- Add OperatingSystemProductFields component for displaying OS product details.
- Write tests for resource characteristic control to ensure proper translation and value handling.
- Create a Python script for auditing global operating systems UI interactions.
- Add tests for expanded workstation profiles to ensure proper functionality and responsiveness.
2026-10-25 20:39:06 +01:00

43 lines
1.2 KiB
TypeScript

import { z } from "zod/v4";
import type { ResourcePurpose } from "../../common";
/** R2.5 mantiene gates independientes para software y perfiles. */
export const ResourceGlobalGatesSchema = z.strictObject({
operatingSystemCatalog: z.boolean().optional(),
operatingSystemSoftware: z.boolean().optional(),
catalog: z.boolean(),
administration: z.boolean(),
mixedSelection: z.boolean(),
software: z.boolean(),
profile: z.boolean(),
});
export const resourceGlobalGates = Object.freeze(
ResourceGlobalGatesSchema.parse({
catalog: false,
administration: true,
mixedSelection: false,
software: false,
profile: false,
})
);
export function globalResourcePurposeEnabled(
purpose: ResourcePurpose,
gates = resourceGlobalGates,
kind: "application" | "os" = "application"
): boolean {
if (kind === "os") {
return (
purpose === "software-installation" &&
Boolean(gates.operatingSystemCatalog && gates.operatingSystemSoftware)
);
}
const consumer = purpose === "software-installation" ? gates.software : gates.profile;
return gates.catalog && consumer;
}
export type ResourceGlobalGates = z.infer<typeof ResourceGlobalGatesSchema>;