refactor: Update permissions handling to filter out None values and ensure safe access

This commit is contained in:
MythEclipse
2025-09-26 01:08:18 +07:00
parent 1b7368a4b7
commit 17cc4ccdba
7 changed files with 17 additions and 16 deletions
+2 -2
View File
@@ -47,8 +47,8 @@ impl RolesSchema {
.as_ref()
.unwrap_or(&vec![])
.into_iter()
.map(|perm| {
make_thing_from_enum(ResourceEnum::Permissions, &perm.id.id.to_raw())
.filter_map(|perm| {
perm.as_ref().and_then(|p| p.id.as_ref().map(|id| make_thing_from_enum(ResourceEnum::Permissions, &id.id.to_raw())))
})
.collect(),
is_deleted: dto.is_deleted,