]> 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:02:17 +0000 (11:32 +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 098a454b1d7b5dd8e7e23bae0e194e4c82a0481f..340ddf7005bc46d2e8937c9818b406b63b756484 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 ea79c86c3fe85f8d9f638346854cf968407d9a55..aed70260362ef367115a4d4ff74441e174cf737c 100644 (file)
@@ -843,6 +843,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: