The TeamSpeak SDK offers an optional custom permission system, with which SDK users can gain more control over allowed user actions on a TeamSpeak server. The custom permissions system is implemented in the Server Lib by adding callback functions which will be called, if implemented, when a certain user action occurs. In this callback the developer can allow or deny the action. If a callback is not implemented, the action will be allowed by default.
The callbacks should return ERROR_ok
to allowe the action or ERROR_permission
to deny it.
Example code to check if a client can connect to the server:
// Create the function pointer passed to ts3server_initServerLib funcs.permClientCanConnect = onPermClientCanConnect; // Custom callback unsigned int onPermClientCanConnect(uint64 serverID, const struct ClientMiniExport* client) { // Forbid client with nickname "client" to connect if(strcmp(client->nickname, "client") == 0) { return ERROR_permissions; // Deny } return ERROR_ok; // Allow }
Please see the server_permissions
example for a demonstration of this mechanism.
Control if a client can connect to the server:
unsigned int permClientCanConnect( | serverID, | |
client) ; |
uint64 serverID
;const struct ClientMiniExport* client
;
Control if a client can access channel descriptions:
unsigned int permClientCanGetChannelDescription( | serverID, | |
client) ; |
uint64 serverID
;const struct ClientMiniExport* client
;
Control if a updating a client variable is allowed:
unsigned int permClientUpdate( | serverID, | |
clientID, | ||
variables) ; |
uint64 serverID
;anyID clientID
;struct VariablesExport* variables
;
Control if kicking a client from a channel is allowed:
unsigned int permClientKickFromChannel( | serverID, | |
client, | ||
toKickCount, | ||
toKickClients, | ||
reasonText) ; |
uint64 serverID
;const struct ClientMiniExport* client
;int toKickCount
;struct ClientMiniExport* toKickClients
;const char* reasonText
;
Control if kicking a client from the server is allowed:
unsigned int permClientKickFromServer( | serverID, | |
client, | ||
toKickCount, | ||
toKickClients, | ||
reasonText) ; |
uint64 serverID
;const struct ClientMiniExport* client
;int toKickCount
;struct ClientMiniExport* toKickClients
;const char* reasonText
;
Control if moving a client to a channel is allowed:
unsigned int permClientMove( | serverID, | |
client, | ||
toMoveCount, | ||
toMoveClients, | ||
newChannel, | ||
reasonText) ; |
uint64 serverID
;const struct ClientMiniExport* client
;int toMoveCount
;struct ClientMiniExport* toMoveClients
;uint64 newChannel
;const char* reasonText
;
Control if moving a channel is allowed:
unsigned int permChannelMove( | serverID, | |
client, | ||
newChannel, | ||
newParentChannelID) ; |
uint64 serverID
;const struct ClientMiniExport* client
;uint64 newChannel
;uint64 newParentChannelID
;
Control if sending a text message is allowed:
unsigned int permSendTextMessage( | serverID, | |
client, | ||
targetMode, | ||
targetClientOrChannel, | ||
textMessage) ; |
uint64 serverID
;const struct ClientMiniExport* client
;anyID targetMode
;uint64 targetClientOrChannel
;const char* textMessage
;
Control if requesting the server connection info is allowed:
unsigned int permServerRequestConnectionInfo( | serverID, | |
client) ; |
uint64 serverID
;const struct ClientMiniExport* client
;
Control if requesting the client connection info is allowed:
unsigned int permSendConnectionInfo( | serverID, | |
client, | ||
mayViewIpPort, | ||
targetClient) ; |
uint64 serverID
;const struct ClientMiniExport* client
;int* mayViewIpPort
;const struct ClientMiniExport* targetClient
;
Control if creating a channel with the given channel variables is allowed:
unsigned int permChannelCreate( | serverID, | |
client, | ||
parentChannelID, | ||
variables) ; |
uint64 serverID
;const struct ClientMiniExport* client
;uint64 parentChannelID
;struct VariablesExport* variables
;
Control if editing the given channel variables of a channel is allowed:
unsigned int permChannelEdit( | serverID, | |
client, | ||
channelID, | ||
variables) ; |
uint64 serverID
;const struct ClientMiniExport* client
;uint64 channelID
;struct VariablesExport* variables
;
Control if deleting a channel is allowed:
unsigned int permChannelDelete( | serverID, | |
client, | ||
channelID) ; |
uint64 serverID
;const struct ClientMiniExport* client
;uint64 channelID
;
Control if subscribing a channel is allowed:
unsigned int permChannelSubscribe( | serverID, | |
client, | ||
channelID) ; |
uint64 serverID
;const struct ClientMiniExport* client
;uint64 channelID
;