client online state

This commit is contained in:
manuel.sowada
2026-05-12 07:57:32 +02:00
parent b34f912857
commit 0a28a3e493
17 changed files with 1210 additions and 788 deletions

View File

@@ -30,11 +30,13 @@ const RBAC = {
}))
.sort((a, b) => a.sAMAccountName.localeCompare(b.sAMAccountName)),
createUser: (data) => api('/api/rbac/auth/create', 'POST', data),
syncUsersFromAD: () => api('/api/rbac/auth/syncFromAD', 'POST', { }),
deleteUser: (guid) => api(`/api/rbac/auth/${guid}`, 'DELETE'),
// 👥 GROUPS
loadGroups: () => api('/api/rbac/group/get', 'POST'),
createGroup: (name) => api('/api/rbac/group/create', 'POST', { name }),
syncGroupsFromAD: () => api('/api/rbac/group/syncFromAD', 'POST', { }),
deleteGroup: (guid) => api(`/api/rbac/group/${guid}`, 'DELETE'),
// 🎭 ROLES
@@ -193,7 +195,7 @@ const rbacPermissionsVT = virtualTable({
data: [],
rowHeight: 20,
buffer: 5,
groupKey: 'Scope',
groupKey: null,
rowKey: 'ID',
filterConfig: {
hideCounter: true,
@@ -372,6 +374,13 @@ async function createUser() {
loadUsers();
}
async function syncUsersFromAD() {
const users = await RBAC.syncUsersFromAD();
sendUserEvent('RBAC', `${users.length} Benutzer aus dem AD synchronisiert`, null, 0);
loadUsers();
}
async function deleteUser(guid, name) {
feedbox({
title: `<span>Benutzer löschen</span>`,
@@ -420,6 +429,16 @@ async function deleteGroup(guid, name) {
}
async function syncGroupsFromAD() {
const group = await RBAC.syncGroupsFromAD();
sendUserEvent('RBAC', `${group.length} Gruppen aus dem AD synchronisiert`, null, 0);
loadGroups();
loadUsers();
}
//////////////////////////////
// 🎭 ROLE ACTIONS
//////////////////////////////

View File

@@ -43,7 +43,7 @@ button:not(:disabled).yellowbutton:hover { background:var(--theme-button-yellow-
.card.static.row { overflow:hidden; display:flex; flex-direction:row; flex-wrap: wrap;}
.card.static { overflow:hidden; display:flex; flex-direction:column; }
.container { width:calc(100% - 20px); margin:10px auto; display:grid; grid-template-columns:100%; gap:12px; min-height:0; overflow:auto; max-height:100%; }
.container:not(.static) { width:calc(100% - 20px); margin:10px auto; display:grid; grid-template-columns:100%; gap:12px; min-height:0; overflow:auto; max-height:100%; }
.container:not(.static) * { box-sizing:border-box; }
.card { border-width:1px; border-style:solid; border-radius:8px; padding:20px; }

View File

@@ -149,4 +149,24 @@
}
});
/* Checks tab visibility
document.addEventListener(
'visibilitychange',
() => {
if (document.hidden) {
alert('AWAY AT: ' + new Date().toISOString());
} else {
updateActivity();
}
}
);
*/
</script>

View File

@@ -29,7 +29,7 @@ section {
align-items: center;
justify-content: space-between;
padding: 5px;
width: 120px;
width: 200px;
border: 1px solid #ccc;
border-radius: 8px;
margin: 0 2px 2px 0;
@@ -62,12 +62,21 @@ input {
</style>
</head>
<body>
<!-- USERS -->
<div class="container static" style="height:100vh;max-width:100vw;flex-direction:row;flex-wrap:wrap;">
<div class="card" style="flex:1 1 auto;min-width:300px">
Users <input id="newUserName" placeholder="sAMAccountName" /> <button class="bluebutton" onclick="createUser()">Create User</button>
<div class="table-wrapper fit-table">
<table id="rbacUsersTable" style="">
<div class="container static" style="max-width:100vw;flex-direction:row;flex-wrap:wrap;flex: 1 1 100vh;">
<!-- USERS -->
<div class="card static row" style="align-items:center;height:fit-content;width:100%">
AD Synchronisation:
<button class="yellowbutton" data-tooltip="Synchronisiert die Benutzer aus dem AD" onclick="syncUsersFromAD()">Users</button>
<button class="yellowbutton" data-tooltip="Synchronisiert die Gruppen aus dem AD" onclick="syncGroupsFromAD()">Groups</button>
</div>
<div class="card" style="aflex-wrap:wrap;flex: 1 1 100%;justify-content: flex-start;">
Users <input id="newUserName" placeholder="sAMAccountName" />
<button class="bluebutton" onclick="createUser()">Create User</button>
<div class="table-wrapper " style="max-height:300px;overflow:auto">
<table id="rbacUsersTable">
<thead>
<tr>
<th class="text-align:left"></th>
@@ -88,8 +97,30 @@ input {
</div>
</div>
<!-- GROUPS -->
<div class="card static" style="min-width:300px;flex:1 1 calc(300px); max-height: 400px;overflow:auto">
<input id="newGroupName" placeholder="Gruppenname" /> <button class="bluebutton" onclick="createGroup()">Create Group</button>
<div id="rbacGroupContainer">
<span>GRUPPEN WERDEN GELADEN . . .</span>
</div>
</div>
<!-- ROLES -->
<div class="card" style="min-width:300px;flex:1 1 calc(300px)">
<input id="newRoleName" placeholder="Rollenname" />
<button class="bluebutton" onclick="createRole()">Create Role</button>
<div id="rbacRoleContainer">
<span>ROLLEN WERDEN GELADEN . . .</span>
</div>
</div>
<!-- PERMISSIONS -->
<div class="card" style="min-width:300px;flex:1 1 auto">
<div class="card" style="min-width:300px;flex:1 1 auto;align-items:center;">
<input id="permScope" placeholder="Scope" />.<input id="permResource" placeholder="Resource" />.<input id="permAction" placeholder="Action" />
<button class="bluebutton" onclick="createPermission()">Create Permission</button>
@@ -115,24 +146,6 @@ input {
</div>
</div>
<!-- GROUPS -->
<div class="card" style="min-width:300px;flex:1 1 calc(300px)">
<input id="newGroupName" placeholder="Gruppenname" /> <button class="bluebutton" onclick="createGroup()">Create Group</button>
<div id="rbacGroupContainer">
<span>GRUPPEN WERDEN GELADEN . . .</span>
</div>
</div>
<!-- ROLES -->
<div class="card" style="min-width:300px;flex:1 1 calc(300px)">
<input id="newRoleName" placeholder="Rollenname" />
<button class="bluebutton" onclick="createRole()">Create Role</button>
<div id="rbacRoleContainer">
<span>ROLLEN WERDEN GELADEN . . .</span>
</div>
</div>
</div>
</body>