Merge pull request #467 from amnezia-vpn/feature/full-access-last-config
full access config no longer contains the last_config field
This commit is contained in:
commit
414740ffb7
6 changed files with 53 additions and 3 deletions
|
|
@ -257,13 +257,33 @@ ErrorCode ClientManagementModel::renameClient(const int row, const QString &clie
|
|||
ErrorCode ClientManagementModel::revokeClient(const int row, const DockerContainer container,
|
||||
ServerCredentials credentials)
|
||||
{
|
||||
ErrorCode errorCode = ErrorCode::NoError;
|
||||
|
||||
if (container == DockerContainer::OpenVpn || container == DockerContainer::ShadowSocks
|
||||
|| container == DockerContainer::Cloak) {
|
||||
return revokeOpenVpn(row, container, credentials);
|
||||
errorCode = revokeOpenVpn(row, container, credentials);
|
||||
} else if (container == DockerContainer::WireGuard || container == DockerContainer::Awg) {
|
||||
return revokeWireGuard(row, container, credentials);
|
||||
errorCode = revokeWireGuard(row, container, credentials);
|
||||
}
|
||||
return ErrorCode::NoError;
|
||||
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
auto client = m_clientsTable.at(row).toObject();
|
||||
QString clientId = client.value(configKey::clientId).toString();
|
||||
|
||||
const auto server = m_settings->defaultServer();
|
||||
QJsonArray containers = server.value(config_key::containers).toArray();
|
||||
for (auto i = 0; i < containers.size(); i++) {
|
||||
auto containerConfig = containers.at(i).toObject();
|
||||
auto containerType = ContainerProps::containerFromString(containerConfig.value(config_key::container).toString());
|
||||
auto protocolConfig = containerConfig.value(ContainerProps::containerTypeToString(containerType)).toObject();
|
||||
|
||||
if (protocolConfig.value(config_key::last_config).toString().contains(clientId)) {
|
||||
emit adminConfigRevoked(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
ErrorCode ClientManagementModel::revokeOpenVpn(const int row, const DockerContainer container,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public slots:
|
|||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
signals:
|
||||
void adminConfigRevoked(const DockerContainer container);
|
||||
|
||||
private:
|
||||
bool isClientExists(const QString &clientId);
|
||||
|
||||
|
|
|
|||
|
|
@ -479,6 +479,14 @@ void ServersModel::clearCachedProfiles()
|
|||
updateContainersModel();
|
||||
}
|
||||
|
||||
void ServersModel::clearCachedProfile(const DockerContainer container)
|
||||
{
|
||||
m_settings->clearLastConnectionConfig(m_currentlyProcessedServerIndex, container);
|
||||
|
||||
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->server(m_currentlyProcessedServerIndex));
|
||||
updateContainersModel();
|
||||
}
|
||||
|
||||
bool ServersModel::isAmneziaDnsContainerInstalled(const int serverIndex)
|
||||
{
|
||||
QJsonObject server = m_servers.at(serverIndex).toObject();
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public slots:
|
|||
void addContainerConfig(const int containerIndex, const QJsonObject config);
|
||||
|
||||
void clearCachedProfiles();
|
||||
void clearCachedProfile(const DockerContainer container);
|
||||
|
||||
ErrorCode removeContainer(const int containerIndex);
|
||||
ErrorCode removeAllContainers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue