]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: fix roles page for roles without policies
authorNizamudeen A <nia@redhat.com>
Tue, 27 Feb 2024 07:18:56 +0000 (12:48 +0530)
committerAfreen <afreen23.git@gmail.com>
Thu, 29 Feb 2024 06:05:19 +0000 (11:35 +0530)
If there is no permission policies attached to a role, it fails the
UI with an exception.

Fixes: https://tracker.ceph.com/issues/64588
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit 5f3f31921c9f3ed909a94f287bfd4cc3f0987649)

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.ts
src/pybind/mgr/dashboard/services/rgw_client.py

index fa3a9d76a0b156cf424a6b9bc3709af05d240d0b..2d1f520bac6ff1108f028f9f5cb256710ab51824 100644 (file)
@@ -147,7 +147,7 @@ export class CRUDTableComponent implements OnInit {
   setExpandedRow(event: any) {
     for (let i = 0; i < this.meta.detail_columns.length; i++) {
       let column = this.meta.detail_columns[i];
-      let columnDetail = event[column];
+      let columnDetail = event?.[column];
       this.expandedRow[column] = this.formatColumnDetails(columnDetail);
     }
   }
index 2d3226bab3e0044bb1397981301785cfc37378bf..7db28506ddcb49fb74d2ae9f7ceca86743f8649f 100644 (file)
@@ -806,6 +806,9 @@ class RgwClient(RestClient):
             logger.warning('Error listing roles with code %d: %s', code, err)
             return []
 
+        for role in roles:
+            if 'PermissionPolicies' not in role:
+                role['PermissionPolicies'] = []
         return roles
 
     def create_role(self, role_name: str, role_path: str, role_assume_policy_doc: str) -> None: