From 4224af359bb0100d3df5423ac27202ba9dbeba6a Mon Sep 17 00:00:00 2001 From: jmbardallo Date: Thu, 17 Sep 2026 13:27:33 +0200 Subject: [PATCH] feat: ou-operator permissions (createImage, prevent Centro) --- CHANGELOG.md | 7 +++++++ .../execute-command/execute-command.component.ts | 1 + .../manage-organizational-unit.component.ts | 12 +++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index beea18b..367c680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.10.0] - 2026-09-17 + +### Added +- **Permisos de Operador (ou-operator)**: + - Añadido permiso explícito para que los operadores de aula puedan ejecutar el comando `createImage`. + - Restringida la creación de nuevas unidades organizativas de tipo "Centro" para los usuarios con rol de operador. + ## [1.9.0] - 2026-09-17 ### Added diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts index a7c89ba..2169886 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts @@ -83,6 +83,7 @@ export class ExecuteCommandComponent implements OnInit { 'power-off', 'reboot', 'login', + 'create-image', 'deploy-image', 'software-inventory', 'hardware-inventory', diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts index 4009445..f84c06d 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts @@ -8,6 +8,7 @@ import { DataService } from "../../../services/data.service"; import { ToastrService } from "ngx-toastr"; import { ConfigService } from '@services/config.service'; import { DeleteModalComponent } from '../../../../../shared/delete_modal/delete-modal/delete-modal.component'; +import { AuthService } from '@services/auth.service'; @Component({ selector: 'app-manage-organizational-unit', @@ -16,6 +17,7 @@ import { DeleteModalComponent } from '../../../../../shared/delete_modal/delete- }) export class ManageOrganizationalUnitComponent implements OnInit { public translate = inject(TranslateService); + public auth = inject(AuthService); baseUrl: string; isLinear = true; generalFormGroup: FormGroup; @@ -141,7 +143,15 @@ export class ManageOrganizationalUnitComponent implements OnInit { } get filteredTypes(): string[] { - return this.generalFormGroup.get('parent')?.value ? this.types.filter(type => type !== 'organizational-unit') : this.types; + const isOperator = this.auth.userCategory === 'ou-operator'; + const hasParent = !!this.generalFormGroup.get('parent')?.value; + + // Si es operador de aula O ya tiene una unidad padre asignada, excluimos 'organizational-unit' (Centro) + if (isOperator || hasParent) { + return this.types.filter(type => type !== 'organizational-unit'); + } + + return this.types; } loadParentUnits(): Promise {