Skip to content

Commit 5f3f319

Browse files
committed
mgr/dashboard: fix roles page for roles without policies
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 <[email protected]>
1 parent b11e6e2 commit 5f3f319

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class CRUDTableComponent implements OnInit {
147147
setExpandedRow(event: any) {
148148
for (let i = 0; i < this.meta.detail_columns.length; i++) {
149149
let column = this.meta.detail_columns[i];
150-
let columnDetail = event[column];
150+
let columnDetail = event?.[column];
151151
this.expandedRow[column] = this.formatColumnDetails(columnDetail);
152152
}
153153
}

src/pybind/mgr/dashboard/services/rgw_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,9 @@ def list_roles(self) -> List[Dict[str, Any]]:
843843
logger.warning('Error listing roles with code %d: %s', code, err)
844844
return []
845845

846+
for role in roles:
847+
if 'PermissionPolicies' not in role:
848+
role['PermissionPolicies'] = []
846849
return roles
847850

848851
def create_role(self, role_name: str, role_path: str, role_assume_policy_doc: str) -> None:

0 commit comments

Comments
 (0)