adminforth 2.0.6 → 2.0.7-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -93,8 +93,11 @@ export default {
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
edit: {
|
|
96
|
-
beforeSave: async ({ updates, adminUser, resource }: { updates: any, adminUser: AdminUser, resource: AdminForthResource }) => {
|
|
96
|
+
beforeSave: async ({ oldRecord, updates, adminUser, resource }: { oldRecord: any, updates: any, adminUser: AdminUser, resource: AdminForthResource }) => {
|
|
97
97
|
console.log('Updating user', updates);
|
|
98
|
+
if (oldRecord.id === adminUser.dbUser.id && updates.role) {
|
|
99
|
+
return { ok: false, error: 'You cannot change your own role' };
|
|
100
|
+
}
|
|
98
101
|
if (updates.password) {
|
|
99
102
|
updates.password_hash = await AdminForth.Utils.generatePasswordHash(updates.password);
|
|
100
103
|
}
|