add rbac roles

This commit is contained in:
2026-05-01 10:50:12 +00:00
parent 76a30fc94f
commit e208ef1759
6 changed files with 99 additions and 406 deletions

View File

@@ -352,7 +352,7 @@ async getRole() {
}
async createRole(data) {
const Role = this.db.get('rolesModel');
const Role = this.db.get('roleModel');
return await Role.create({
Name: data.name,
@@ -361,7 +361,7 @@ async createRole(data) {
}
async updateRole(id, data) {
const Role = this.db.get('rolesModel');
const Role = this.db.get('roleModel');
return await Role.update(data, {
where: { ID: id }
@@ -369,8 +369,20 @@ async updateRole(id, data) {
}
async deleteRole(id) {
const Role = this.db.get('rolesModel');
const Role = this.db.get('roleModel');
const RolePermissions = this.db.get('rolePermissionsModel');
const GroupRoles = this.db.get('groupRolesModel');
const AuthRoles = this.db.get('authenticationRolesModel');
await AuthRoles.destroy({
where: { Role_ID: id }
});
await GroupRoles.destroy({
where: { Role_ID: id }
});
await RolePermissions.destroy({
where: { Role_ID: id }
});
return await Role.destroy({
where: { ID: id }
});