Fixed another issue
This commit is contained in:
parent
dab4c40209
commit
7ec9b98883
@ -238,7 +238,7 @@ inline sql::result load_permissions_v2(const std::shared_ptr<TSServer>& server,
|
|||||||
auto server_id = server ? server->getServerId() : 0;
|
auto server_id = server ? server->getServerId() : 0;
|
||||||
return command.query([&](int length, char** values, char** names){
|
return command.query([&](int length, char** values, char** names){
|
||||||
permission::PermissionType key = permission::PermissionType::undefined;
|
permission::PermissionType key = permission::PermissionType::undefined;
|
||||||
permission::PermissionValue value = 0, granted = 0;
|
permission::PermissionValue value = permNotGranted, granted = permNotGranted;
|
||||||
bool negated = false, skipped = false;
|
bool negated = false, skipped = false;
|
||||||
std::shared_ptr<BasicChannel> channel;
|
std::shared_ptr<BasicChannel> channel;
|
||||||
|
|
||||||
@ -384,6 +384,8 @@ void DatabaseHelper::saveClientPermissions(const std::shared_ptr<ts::server::TSS
|
|||||||
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
||||||
|
|
||||||
auto permission_data = permission::resolvePermissionData(update.permission);
|
auto permission_data = permission::resolvePermissionData(update.permission);
|
||||||
|
auto value = update.update_value == v2::delete_value ? permNotGranted : update.values.value;
|
||||||
|
auto grant = update.update_grant == v2::delete_value ? permNotGranted : update.values.grant;
|
||||||
logTrace(server_id, "[CHANNEL] Updating client permission for client {}: {}. New value: {}. New grant: {}. Query: {}",
|
logTrace(server_id, "[CHANNEL] Updating client permission for client {}: {}. New value: {}. New grant: {}. Query: {}",
|
||||||
client_dbid,
|
client_dbid,
|
||||||
permission_data->name,
|
permission_data->name,
|
||||||
@ -398,8 +400,8 @@ void DatabaseHelper::saveClientPermissions(const std::shared_ptr<ts::server::TSS
|
|||||||
variable{":type", permission::SQL_PERM_USER},
|
variable{":type", permission::SQL_PERM_USER},
|
||||||
|
|
||||||
variable{":permId", permission_data->name},
|
variable{":permId", permission_data->name},
|
||||||
variable{":value", update.values.value},
|
variable{":value", value},
|
||||||
variable{":grant", update.values.grant},
|
variable{":grant", grant},
|
||||||
variable{":flag_skip", update.flag_skip},
|
variable{":flag_skip", update.flag_skip},
|
||||||
variable{":flag_negate", update.flag_negate})
|
variable{":flag_negate", update.flag_negate})
|
||||||
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
||||||
@ -449,11 +451,13 @@ void DatabaseHelper::saveGroupPermissions(const std::shared_ptr<ts::server::TSSe
|
|||||||
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
||||||
|
|
||||||
auto permission_data = permission::resolvePermissionData(update.permission);
|
auto permission_data = permission::resolvePermissionData(update.permission);
|
||||||
|
auto value = update.update_value == v2::delete_value ? permNotGranted : update.values.value;
|
||||||
|
auto grant = update.update_grant == v2::delete_value ? permNotGranted : update.values.grant;
|
||||||
logTrace(server_id, "[CHANNEL] Updating group permission for group {}: {}. New value: {}. New grant: {}. Query: {}",
|
logTrace(server_id, "[CHANNEL] Updating group permission for group {}: {}. New value: {}. New grant: {}. Query: {}",
|
||||||
group_id,
|
group_id,
|
||||||
permission_data->name,
|
permission_data->name,
|
||||||
update.values.value,
|
value,
|
||||||
update.values.grant,
|
grant,
|
||||||
query
|
query
|
||||||
);
|
);
|
||||||
sql::command(this->sql, query,
|
sql::command(this->sql, query,
|
||||||
@ -463,8 +467,8 @@ void DatabaseHelper::saveGroupPermissions(const std::shared_ptr<ts::server::TSSe
|
|||||||
variable{":type", permission::SQL_PERM_GROUP},
|
variable{":type", permission::SQL_PERM_GROUP},
|
||||||
|
|
||||||
variable{":permId", permission_data->name},
|
variable{":permId", permission_data->name},
|
||||||
variable{":value", update.values.value},
|
variable{":value", value},
|
||||||
variable{":grant", update.values.grant},
|
variable{":grant", grant},
|
||||||
variable{":flag_skip", update.flag_skip},
|
variable{":flag_skip", update.flag_skip},
|
||||||
variable{":flag_negate", update.flag_negate})
|
variable{":flag_negate", update.flag_negate})
|
||||||
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
||||||
@ -593,12 +597,14 @@ void DatabaseHelper::saveChannelPermissions(const std::shared_ptr<ts::server::TS
|
|||||||
for(auto& update : updates) {
|
for(auto& update : updates) {
|
||||||
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
std::string query = update.flag_delete ? DELETE_COMMAND : (update.flag_db ? UPDATE_COMMAND : INSERT_COMMAND);
|
||||||
|
|
||||||
|
auto value = update.update_value == v2::delete_value ? permNotGranted : update.values.value;
|
||||||
|
auto grant = update.update_grant == v2::delete_value ? permNotGranted : update.values.grant;
|
||||||
auto permission_data = permission::resolvePermissionData(update.permission);
|
auto permission_data = permission::resolvePermissionData(update.permission);
|
||||||
logTrace(server_id, "[CHANNEL] Updating channel permission for channel {}: {}. New value: {}. New grant: {}. Query: {}",
|
logTrace(server_id, "[CHANNEL] Updating channel permission for channel {}: {}. New value: {}. New grant: {}. Query: {}",
|
||||||
channel_id,
|
channel_id,
|
||||||
permission_data->name,
|
permission_data->name,
|
||||||
update.values.value,
|
value,
|
||||||
update.values.grant,
|
grant,
|
||||||
query
|
query
|
||||||
);
|
);
|
||||||
sql::command(this->sql, query,
|
sql::command(this->sql, query,
|
||||||
@ -608,8 +614,8 @@ void DatabaseHelper::saveChannelPermissions(const std::shared_ptr<ts::server::TS
|
|||||||
variable{":type", permission::SQL_PERM_CHANNEL},
|
variable{":type", permission::SQL_PERM_CHANNEL},
|
||||||
|
|
||||||
variable{":permId", permission_data->name},
|
variable{":permId", permission_data->name},
|
||||||
variable{":value", update.values.value},
|
variable{":value", value},
|
||||||
variable{":grant", update.values.grant},
|
variable{":grant", grant},
|
||||||
variable{":flag_skip", update.flag_skip},
|
variable{":flag_skip", update.flag_skip},
|
||||||
variable{":flag_negate", update.flag_negate})
|
variable{":flag_negate", update.flag_negate})
|
||||||
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
.executeLater().waitAndGetLater(LOG_SQL_CMD, {-1, "future error"});
|
||||||
@ -1180,7 +1186,7 @@ void DatabaseHelper::loadStartupPermissionCache() {
|
|||||||
StartupPermissionArgument arg;
|
StartupPermissionArgument arg;
|
||||||
sql::command(this->sql, "SELECT `serverId`, `type`, `id`, `channelId`, `permId`, `value`, `grant`, `flag_skip`, `flag_negate` FROM permissions ORDER BY `serverId`").query([&](StartupPermissionArgument* arg, int length, char** values, char** names) {
|
sql::command(this->sql, "SELECT `serverId`, `type`, `id`, `channelId`, `permId`, `value`, `grant`, `flag_skip`, `flag_negate` FROM permissions ORDER BY `serverId`").query([&](StartupPermissionArgument* arg, int length, char** values, char** names) {
|
||||||
auto key = permission::PermissionTypeEntry::unknown;
|
auto key = permission::PermissionTypeEntry::unknown;
|
||||||
permission::PermissionValue value = 0, granted = 0;
|
permission::PermissionValue value = permNotGranted, granted = permNotGranted;
|
||||||
permission::PermissionSqlType type = SQL_PERM_GROUP;
|
permission::PermissionSqlType type = SQL_PERM_GROUP;
|
||||||
bool negated = false, skipped = false;
|
bool negated = false, skipped = false;
|
||||||
ChannelId channel = 0;
|
ChannelId channel = 0;
|
||||||
|
2
shared
2
shared
@ -1 +1 @@
|
|||||||
Subproject commit 4a9d8f132fe9ca3411e2e3c245922ad778c56aa0
|
Subproject commit cb73d9df3258eaf59e4799c9e54d5f865e891734
|
Loading…
Reference in New Issue
Block a user