mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-10-18 04:47:04 +02:00
Add multi-server-per-admin support via sa_admins_servers table
This commit is contained in:
parent
eea700bfb4
commit
e028441b56
7 changed files with 72 additions and 10 deletions
|
|
@ -530,7 +530,7 @@ public class PermissionManager(IDatabaseProvider? databaseProvider)
|
|||
immunity,
|
||||
ends = futureTime,
|
||||
created = now,
|
||||
serverid = globalAdmin ? null : CS2_SimpleAdmin.ServerId
|
||||
isGlobal = globalAdmin ? 1 : 0
|
||||
});
|
||||
|
||||
// Insert flags into sa_admins_flags table
|
||||
|
|
@ -563,6 +563,18 @@ public class PermissionManager(IDatabaseProvider? databaseProvider)
|
|||
});
|
||||
}
|
||||
|
||||
// Global admins apply to every server and need no per-server link row.
|
||||
// Server-specific admins are linked to the current server.
|
||||
if (!globalAdmin)
|
||||
{
|
||||
var insertAdminServerSql = databaseProvider.GetAddAdminServerQuery();
|
||||
await connection.ExecuteAsync(insertAdminServerSql, new
|
||||
{
|
||||
adminId,
|
||||
server_id = CS2_SimpleAdmin.ServerId
|
||||
});
|
||||
}
|
||||
|
||||
await Server.NextWorldUpdateAsync(() =>
|
||||
{
|
||||
CS2_SimpleAdmin.Instance.ReloadAdmins(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue