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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.0.6",
3
+ "version": "2.0.7-next.1",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",