Working on create organization and delete.

This commit is contained in:
charles-gauthereau
2024-12-29 19:34:48 +01:00
parent 05edbf4a42
commit a6f48ea762
17 changed files with 390 additions and 35 deletions
+18
View File
@@ -0,0 +1,18 @@
export async function checkAllPermissions(db: any, model: string) {
const operations = ['read', 'create', 'update', 'delete'];
const results: Record<string, boolean> = {};
for (const operation of operations) {
// Dynamically access the model and check permissions
results[operation] = await db[model].check({ operation });
}
const hasAllPermissions = Object.values(results).every(permission => permission === true);
console.log('Permissions:', results);
console.log('Has all permissions:', hasAllPermissions);
return hasAllPermissions;
}