diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js index 3494bdcdac6..b441af2b51e 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js @@ -58,29 +58,33 @@ exports.handler = async function (request, response, state) { // Enhance ACL records with role and permission details recipeAclRecords = recipeAclRecords.map(record => { var role = roles.find(role => role.role_id === record.role_id); + if(!role) $tw.utils.warning("Role not found for record " + record.acl_id); var permission = permissions.find(perm => perm.permission_id === record.permission_id); + if(!permission) $tw.utils.warning("Permission not found for record " + record.acl_id); return ({ ...record, role, permission, - role_name: role.role_name, - role_description: role.description, - permission_name: permission.permission_name, - permission_description: permission.description + role_name: role?.role_name, + role_description: role?.description, + permission_name: permission?.permission_name, + permission_description: permission?.description }) }); bagAclRecords = bagAclRecords.map(record => { var role = roles.find(role => role.role_id === record.role_id); + if(!role) $tw.utils.warning("Role not found for record " + record.acl_id); var permission = permissions.find(perm => perm.permission_id === record.permission_id); + if(!permission) $tw.utils.warning("Permission not found for record " + record.acl_id); return ({ ...record, role, permission, - role_name: role.role_name, - role_description: role.description, - permission_name: permission.permission_name, - permission_description: permission.description + role_name: role?.role_name, + role_description: role?.description, + permission_name: permission?.permission_name, + permission_description: permission?.description }) }); diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js index 921da98a438..5c3325a7785 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js @@ -903,7 +903,7 @@ SqlTiddlerDatabase.prototype.listUsersByRoleId = async function(roleId) { }; SqlTiddlerDatabase.prototype.updateUser = async function (userId, username, email, roleId) { - const existingUser = await this.engine.runStatement(` + const existingUser = await this.engine.runStatementGet(` SELECT user_id FROM users WHERE email = $email AND user_id != $userId `, { diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js index 4a5d4885aa3..078da381ce2 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js @@ -216,7 +216,7 @@ SqlTiddlerStore.prototype.saveTiddlersFromPath = async function(tiddler_files_pa // Save the tiddlers for(const tiddlersFromFile of tiddlersFromPath) { for(const tiddler of tiddlersFromFile.tiddlers) { - await self.saveBagTiddler(tiddler,bag_name,null); + await self.saveBagTiddler(tiddler,bag_name); } } });