Fix Bug for roles deletion 00/14900/2
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Thu, 30 Jan 2025 12:46:56 +0000 (18:16 +0530)
committerjssan <sandhya.j@tataelxsi.co.in>
Thu, 27 Feb 2025 06:16:17 +0000 (07:16 +0100)
- Roles null value acceptance bug in permissions

Change-Id: I46547949385c908a0289874131fcc28290bb5743
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
src/app/roles/roles-create-edit/RolesCreateEditComponent.ts

index ae85112..a1d5d45 100644 (file)
@@ -296,9 +296,9 @@ export class RolesCreateEditComponent implements OnInit {
       } else {
         this.roleForm.value.permissions = this.roleForm.value.permissions.replace(/'/g, '"');
         const rolePermission: {} = JSON.parse(this.roleForm.value.permissions);
-        for (const key of Object.keys(rolePermission)) {
+        for (const key of Object.values(rolePermission)) {
           // eslint-disable-next-line security/detect-object-injection
-          if (typeof rolePermission[key] !== 'boolean') {
+          if (typeof key !== 'boolean' && key !== null) {
             this.notifierService.notify('error', this.translateService.instant('PAGE.ROLES.ROLEKEYERROR', { roleKey: key }));
             return false;
           }