Updating files to 1.4.9
This commit is contained in:
@@ -1055,7 +1055,9 @@ command_result ConnectedClient::handleCommandClientDBFind(Command &cmd) {
|
||||
args.cmd = Command(this->getType() == CLIENT_QUERY ? "" : "notifyclientdbfind");
|
||||
args.full = cmd.hasParm("details");
|
||||
args.ip = permission::v2::permission_granted(1, this->calculate_permission(permission::b_client_remoteaddress_view, 0));
|
||||
auto res = sql::command(this->sql, string() + "SELECT * FROM `clients` WHERE `serverId` = :sid AND `" + (uid ? "clientUid" : "lastName") + "` LIKE '" + pattern + "' LIMIT 50", variable{":sid", this->server->getServerId()}).query(
|
||||
auto res = sql::command(this->sql, "SELECT * FROM `clients` WHERE `serverId` = :sid AND `" + std::string{uid ? "clientUid" : "lastName"} + "` LIKE :pattern LIMIT 50",
|
||||
variable{":sid", this->server->getServerId()},
|
||||
variable{":pattern", pattern}).query(
|
||||
[&](DBFindArgs *ptr, int len, char **values, char **names) {
|
||||
for (int index = 0; index < len; index++)
|
||||
if (strcmp(names[index], "cldbid") == 0)
|
||||
|
||||
@@ -82,6 +82,7 @@ if (permission::resolvePermissionData(permType)->type == permission::PermissionT
|
||||
|
||||
inline bool permission_require_granted_value(ts::permission::PermissionType type) {
|
||||
using namespace ts;
|
||||
/*
|
||||
switch (type) {
|
||||
case permission::i_permission_modify_power:
|
||||
|
||||
@@ -123,6 +124,33 @@ inline bool permission_require_granted_value(ts::permission::PermissionType type
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
switch (type) {
|
||||
case permission::i_icon_id:
|
||||
case permission::i_max_icon_filesize:
|
||||
case permission::i_client_max_avatar_filesize:
|
||||
|
||||
case permission::i_client_max_channels:
|
||||
case permission::i_client_max_permanent_channels:
|
||||
case permission::i_client_max_semi_channels:
|
||||
case permission::i_client_max_temporary_channels:
|
||||
|
||||
case permission::i_channel_max_depth:
|
||||
case permission::i_channel_min_depth:
|
||||
case permission::i_client_max_channel_subscriptions:
|
||||
|
||||
case permission::i_client_music_create_modify_max_volume:
|
||||
case permission::i_max_playlist_size:
|
||||
case permission::i_max_playlists:
|
||||
|
||||
case permission::i_client_ban_max_bantime:
|
||||
case permission::i_client_max_idletime:
|
||||
case permission::i_group_sort_id:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool permission_is_group_property(ts::permission::PermissionType type) {
|
||||
|
||||
@@ -230,6 +230,7 @@ command_result ConnectedClient::handleCommand(Command &cmd) {
|
||||
else if (command == "playlistpermlist") return this->handleCommandPlaylistPermList(cmd);
|
||||
else if (command == "playlistaddperm") return this->handleCommandPlaylistAddPerm(cmd);
|
||||
else if (command == "playlistdelperm") return this->handleCommandPlaylistDelPerm(cmd);
|
||||
else if (command == "playlistclientlist") return this->handleCommandPlaylistClientList(cmd);
|
||||
else if (command == "playlistclientpermlist") return this->handleCommandPlaylistClientPermList(cmd);
|
||||
else if (command == "playlistclientaddperm") return this->handleCommandPlaylistClientAddPerm(cmd);
|
||||
else if (command == "playlistclientdelperm") return this->handleCommandPlaylistClientDelPerm(cmd);
|
||||
@@ -1462,7 +1463,7 @@ command_result ConnectedClient::handleCommandPermFind(Command &cmd) {
|
||||
uint8_t t;
|
||||
};
|
||||
|
||||
std::deque<CommandPerm> perms;
|
||||
std::vector<CommandPerm> perms;
|
||||
perms.resize(entries.size());
|
||||
size_t index = 0;
|
||||
for(const auto& entry : entries) {
|
||||
@@ -1515,7 +1516,7 @@ command_result ConnectedClient::handleCommandPermFind(Command &cmd) {
|
||||
return &a > &b;
|
||||
});
|
||||
|
||||
Command result("");
|
||||
Command result(this->notify_response_command("notifypermfind"));
|
||||
index = 0;
|
||||
|
||||
// http://yat.qa/ressourcen/server-query-kommentare/#permfind
|
||||
|
||||
@@ -621,6 +621,42 @@ command_result ConnectedClient::handleCommandPlaylistDelPerm(ts::Command &cmd) {
|
||||
return command_result{error::ok};
|
||||
}
|
||||
|
||||
command_result ConnectedClient::handleCommandPlaylistClientList(ts::Command &cmd) {
|
||||
CMD_REF_SERVER(ref_server);
|
||||
CMD_RESET_IDLE;
|
||||
CMD_CHK_AND_INC_FLOOD_POINTS(25);
|
||||
|
||||
auto playlist = ref_server->musicManager->find_playlist(cmd["playlist_id"]);
|
||||
if(!playlist) return command_result{error::playlist_invalid_id};
|
||||
|
||||
{
|
||||
auto value = playlist->calculate_client_specific_permissions(permission::b_virtualserver_playlist_permission_list, this->ref());
|
||||
if(!permission::v2::permission_granted(1, value))
|
||||
return command_result{permission::b_virtualserver_playlist_permission_list};
|
||||
}
|
||||
|
||||
auto permissions = playlist->permission_manager()->channel_permissions();
|
||||
if(permissions.empty())
|
||||
return command_result{error::database_empty_result};
|
||||
|
||||
|
||||
Command result(this->notify_response_command("notifyplaylistclientlist"));
|
||||
auto permission_mapper = serverInstance->getPermissionMapper();
|
||||
|
||||
int index = 0;
|
||||
ClientDbId last_client_id{0};
|
||||
result["playlist_id"] = playlist->playlist_id();
|
||||
for (const auto &[perm, client, value] : permissions) {
|
||||
if(last_client_id != client)
|
||||
result[index++]["cldbid"] = client;
|
||||
}
|
||||
if(index == 0)
|
||||
return command_result{error::database_empty_result};
|
||||
this->sendCommand(result);
|
||||
|
||||
return command_result{error::ok};
|
||||
}
|
||||
|
||||
command_result ConnectedClient::handleCommandPlaylistClientPermList(ts::Command &cmd) {
|
||||
CMD_REF_SERVER(ref_server);
|
||||
CMD_RESET_IDLE;
|
||||
|
||||
Reference in New Issue
Block a user