Skip to content

Commit

Permalink
feat(4ps): fix bug parse permission
Browse files Browse the repository at this point in the history
  • Loading branch information
develite98 committed Jan 5, 2024
1 parent e8f5ad1 commit df1c5c4
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions libs/mix-lib/src/model/core/database.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,23 @@ export class MixDatabase {
this.mixDatabaseContextId =
value.mixDatabaseContextId ?? DbContextFixId.MasterDb;

this.updatePermissions = value.updatePermissions
? JSON.parse(value.updatePermissions.toString())
: [];
this.readPermissions = value.readPermissions
? JSON.parse(value.readPermissions.toString())
: [];
this.deletePermissions = value.deletePermissions
? JSON.parse(value.deletePermissions.toString())
: [];
this.createPermissions = value.createPermissions
? JSON.parse(value.createPermissions.toString())
this.updatePermissions = MixDatabase.parsePermission(
value.updatePermissions
);
this.readPermissions = MixDatabase.parsePermission(value.readPermissions);
this.deletePermissions = MixDatabase.parsePermission(
value.deletePermissions
);
this.createPermissions = MixDatabase.parsePermission(
value.createPermissions
);
}

public static parsePermission(value: string[] | object | undefined) {
return value instanceof Array
? value
: value
? JSON.parse((value as any).toString())
: [];
}
}
Expand Down

1 comment on commit df1c5c4

@vercel
Copy link

@vercel vercel bot commented on df1c5c4 Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.