Started overhauling the client permission system to make it a bit more flexible. Now the clients can have the permission to use specific console commands (atm these commands are relayed to the server as-is).
TODO: make it possible to give clients console command permissions via the menus and the console, save command permissions, deal with commands that don't work as intended when simply relayed to the server and executed server-side, add "ranks" (preconfigured or custom sets of permissions, e.g. moderator, admin, etc).
This commit is contained in:
@@ -1928,6 +1928,18 @@ namespace Barotrauma.Networking
|
||||
var msg = server.CreateMessage();
|
||||
msg.Write((byte)ServerPacketHeader.PERMISSIONS);
|
||||
msg.Write((byte)client.Permissions);
|
||||
if (client.Permissions.HasFlag(ClientPermissions.ConsoleCommands))
|
||||
{
|
||||
msg.Write((UInt16)client.PermittedConsoleCommands.Sum(c => c.names.Length));
|
||||
foreach (DebugConsole.Command command in client.PermittedConsoleCommands)
|
||||
{
|
||||
foreach (string commandName in command.names)
|
||||
{
|
||||
msg.Write(commandName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server.SendMessage(msg, client.Connection, NetDeliveryMethod.ReliableUnordered);
|
||||
|
||||
SaveClientPermissions();
|
||||
|
||||
Reference in New Issue
Block a user