rbac updated

This commit is contained in:
2026-04-30 13:36:45 +02:00
parent bbd9441b31
commit 6679ed20fe
15 changed files with 752 additions and 201 deletions

View File

@@ -269,7 +269,11 @@ async updateAuth(id, data) {
async deleteAuth(id) {
const Auth = this.db.get('authentication');
const AuthGroups = this.db.get('authenticationGroupsModel');
await AuthGroups.destroy({
where: { Authentication_ObjectGUID: id }
});
return await Auth.destroy({
where: { ObjectGUID: id }
});
@@ -301,6 +305,11 @@ async updateGroup(id, data) {
async deleteGroup(id) {
const Group = this.db.get('group');
const AuthGroups = this.db.get('authenticationGroupsModel');
await AuthGroups.destroy({
where: { Group_ObjectGUID: id }
});
return await Group.destroy({
where: { ObjectGUID: id }
@@ -311,13 +320,16 @@ async deleteGroup(id) {
// 🔗 AUTH ↔ GROUP RELATION
// =========================================================
async addUserToGroup(authId, groupId) {
async addUserToGroup(authGuid, groupGuid) {
const AuthGroups = this.db.get('authenticationGroupsModel');
return await AuthGroups.create({
Authentication_ObjectGUID: authId,
Group_ObjectGUID: groupId
if(await AuthGroups.findOne({ where: { Authentication_ObjectGUID: authGuid } })) { // AuthGroups.
return false
}
const group = await AuthGroups.create({
Authentication_ObjectGUID: authGuid,
Group_ObjectGUID: groupGuid
});
return group;
}
async removeUserFromGroup(authId, groupId) {