]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix edit and delete access for pool-manager role
authorAfreen Misbah <afreen@ibm.com>
Tue, 12 May 2026 12:07:39 +0000 (17:37 +0530)
committerAfreen Misbah <afreen@ibm.com>
Sun, 17 May 2026 21:22:37 +0000 (02:52 +0530)
Fixes https://tracker.ceph.com/issues/76561

- allows deleting pools in pool-manager role by bypassing config-opt read permissions
- allows editing in pool-manager role which failing deu to misisng rbd mirroring permissions
- fixes a bug with pool edit mode where when both compression and name are edited it fails due to an if-else logic bug

Signed-off-by: Afreen Misbah <afreen@ibm.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts

index 10e17674ec439fcaae8a1566bf99313dce18e8e1..dfcd7523a08c7a7012fc1fc74888e02007ab274b 100644 (file)
         </ng-template>
       </div>
       <!-- Mirroring -->
-      @if (data.applications.selected.includes('rbd')) {
+      @if ((permissions?.rbdMirroring?.create || (editing && permissions?.rbdMirroring?.update)) && data.applications.selected.includes('rbd')) {
       <div
         class="form-item"
         cdsRow
index b3107bdedf53a2120210a0c79a035f8072bc17a1..a38fb0583bbbd91ce60e04a87c3e1af5038b1873 100644 (file)
@@ -383,11 +383,13 @@ export class PoolFormComponent extends CdForm implements OnInit {
     this.data.pgs = this.form.getValue('pgNum');
     this.data.applications.selected = pool.application_metadata;
     this.setAvailableApps(this.data.applications.default.concat(pool.application_metadata));
-    this.rbdMirroringService
-      .getPool(pool.pool_name)
-      .subscribe((resp: PoolEditModeResponseModel) => {
-        this.form.get('rbdMirroring').setValue(resp.mirror_mode === 'pool');
-      });
+    if (this.permissions?.rbdMirroring?.read) {
+      this.rbdMirroringService
+        .getPool(pool.pool_name)
+        .subscribe((resp: PoolEditModeResponseModel) => {
+          this.form.get('rbdMirroring').setValue(resp.mirror_mode === 'pool');
+        });
+    }
   }
 
   private setAvailableApps(apps: string[] = this.data.applications.default) {
@@ -945,7 +947,16 @@ export class PoolFormComponent extends CdForm implements OnInit {
         formControlName: 'ecOverwrites',
         replaceFn: () => (this.isErasure ? ['ec_overwrites'] : undefined)
       });
-
+      if (this.editing) {
+        this.assignFormFields(pool, [
+          {
+            externalFieldName: 'srcpool',
+            formControlName: 'name',
+            editable: true,
+            replaceFn: () => this.data.pool.pool_name
+          }
+        ]);
+      }
       if (this.form.getValue('mode') !== 'none') {
         this.assignFormFields(pool, [
           {
@@ -993,12 +1004,6 @@ export class PoolFormComponent extends CdForm implements OnInit {
             formControlName: 'mode',
             editable: true,
             replaceFn: () => 'unset' // Is used if no compression is set
-          },
-          {
-            externalFieldName: 'srcpool',
-            formControlName: 'name',
-            editable: true,
-            replaceFn: () => this.data.pool.pool_name
           }
         ]);
       }
index 655709b5ce670a6eb900a5b08ab5c5df447b14ad..060d8644dd1f96344cd0d26c8994a8cf926baa64 100644 (file)
@@ -113,6 +113,14 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
           this.monAllowPoolDelete = monSection.value === 'true' ? true : false;
         }
       });
+    } else if (this.permissions.pool.read) {
+      /*
+     `monAllowPoolDelete` will always be `false`,
+      because no read permissions for reading config settings.
+      Hence enabling by default for pool based roles which allow CRUD.
+      @TODO: Fix once permissions of config-opt are sorted.
+    */
+      this.monAllowPoolDelete = true;
     }
   }