ключ теперь не поле бд а отдельный файл на сервере.
This commit is contained in:
@@ -7,11 +7,10 @@ import _VisualDVM.ComponentsServer.BugReport.Json.BugReportAdditionJson;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.ComponentsServer.Component.Json.ComponentPublicationInfoJson;
|
||||
import _VisualDVM.ComponentsServer.Component.Json.ComponentVersionsInfoJson;
|
||||
import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
@@ -49,7 +48,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
"dvmh.keldysh.ru",
|
||||
22, MachineType.Server),
|
||||
new User("dvmuser1", "mprit_2011"))
|
||||
));
|
||||
));
|
||||
//-
|
||||
protected Thread backUp = new Thread(() -> {
|
||||
while (true) {
|
||||
@@ -221,7 +220,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
response.object = Utils_.fileToBytes(archives);
|
||||
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
|
||||
}
|
||||
void ReceiveBugReportsDatabase() throws Exception{
|
||||
void ReceiveBugReportsDatabase() throws Exception {
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
}
|
||||
void ReceiveBugReport() throws Exception {
|
||||
@@ -329,23 +328,24 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
}
|
||||
void GetUserAccountByKey() throws Exception {
|
||||
UserAccount account = credentials_db.userAccounts.getByKey(request.arg);
|
||||
response.object = account==null? null: account;
|
||||
response.object = account == null ? null : account;
|
||||
}
|
||||
void GetUserAccountByEmail() throws Exception {
|
||||
UserAccount account_info = (UserAccount) request.object;
|
||||
UserAccount account = credentials_db.userAccounts.getByEmail(account_info.email);
|
||||
if (account==null){
|
||||
if (account == null) {
|
||||
account = new UserAccount(account_info);
|
||||
account.role = Constants.admins_mails.contains(account.email)? AccountRole.Admin: AccountRole.User;
|
||||
account.security_key = RandomStringUtils.random(100, true, true);
|
||||
account.role = Constants.admins_mails.contains(account.email) ? AccountRole.Admin : AccountRole.User;
|
||||
credentials_db.Insert(account);
|
||||
FileUtils.writeStringToFile(account.getServerKeyFile(), RandomStringUtils.random(100, true, true));
|
||||
}
|
||||
response.object = account;
|
||||
response.arg = FileUtils.readFileToString(account.getServerKeyFile());
|
||||
}
|
||||
void ReceiveCredentialsDatabase() throws Exception{
|
||||
void ReceiveCredentialsDatabase() throws Exception {
|
||||
response.object = Utils_.fileToBytes(credentials_db.getFile());
|
||||
}
|
||||
void EditUserAccount() throws Exception{
|
||||
void EditUserAccount() throws Exception {
|
||||
UserAccount new_object = (UserAccount) request.object;
|
||||
credentials_db.UpdateWithCheck(new_object);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user