diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js index 43fa1aa6f..571545b15 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js @@ -38,15 +38,14 @@ POST /admin/delete-role return; } - // Delete the role - sqlTiddlerDatabase.deleteRole(role_id); - // Check if the role is in use var isRoleInUse = sqlTiddlerDatabase.isRoleInUse(role_id); if(isRoleInUse) { sqlTiddlerDatabase.deleteUserRolesByRoleId(role_id); } + // Delete the role + sqlTiddlerDatabase.deleteRole(role_id); // Redirect back to the roles management page response.writeHead(302, { "Location": "/admin/roles" }); response.end(); diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js index d56f12eab..bd78301e1 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js @@ -1156,7 +1156,7 @@ SqlTiddlerDatabase.prototype.deleteRole = function(roleId) { SqlTiddlerDatabase.prototype.listRoles = function() { return this.engine.runStatementGetAll(` - SELECT * FROM roles ORDER BY role_name + SELECT * FROM roles ORDER BY role_name DESC `); };