удаление учетной записи с сервера
This commit is contained in:
@@ -131,6 +131,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (!bugReport.project_version.isEmpty()) Utils_.forceDeleteWithCheck(bugReport.getArchiveFile());
|
||||
}else if (object instanceof UserAccount){
|
||||
UserAccount account = (UserAccount) object;
|
||||
Utils_.forceDeleteWithCheck(account.getServerKeyFile());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -349,7 +352,6 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
void PublishUserAccount() throws Exception {
|
||||
DBObject dbObject = (DBObject) request.object;
|
||||
response.object = (Serializable) credentials_db.InsertS(dbObject).getPK();
|
||||
//--
|
||||
credentials_db.userAccounts.get(response.object).generateKey();
|
||||
}
|
||||
void EditUserAccount() throws Exception {
|
||||
@@ -357,7 +359,8 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
credentials_db.UpdateWithCheck(new_object);
|
||||
}
|
||||
void DeleteUserAccount() throws Exception {
|
||||
|
||||
Pair<Class, Object> to_delete = (Pair<Class, Object>) request.object;
|
||||
afterDeleteAction(credentials_db.DeleteByPK(to_delete.getKey(), to_delete.getValue()));
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
@@ -422,6 +425,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case DVMConvertProject:
|
||||
DVMConvertProject();
|
||||
break;
|
||||
case DeleteUserAccount:
|
||||
DeleteUserAccount();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ public class UserAccountsForm extends DataSetControlForm<UserAccount> {
|
||||
protected DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.SynchronizeCredentials,
|
||||
PassCode.PublishUserAccount,
|
||||
PassCode.EditUserAccount);
|
||||
PassCode.EditUserAccount,
|
||||
PassCode.DeleteUserAccount);
|
||||
}
|
||||
@Override
|
||||
protected DBObjectDialog getDialog() {
|
||||
|
||||
24
src/_VisualDVM/Passes/All/DeleteUserAccount.java
Normal file
24
src/_VisualDVM/Passes/All/DeleteUserAccount.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import _VisualDVM.ComponentsServer.ComponentsServer;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.DeleteServerObject;
|
||||
import _VisualDVM.Repository.Server.SafeServerExchangeUnit;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import javafx.util.Pair;
|
||||
public class DeleteUserAccount extends DeleteServerObject<ComponentsServer, UserAccount> {
|
||||
public DeleteUserAccount() {
|
||||
super(Global.componentsServer, UserAccount.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return server.credentials_db;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new SafeServerExchangeUnit(ServerCode.DeleteUserAccount, "",
|
||||
new Pair<>(target.getClass(), target.getPK())));
|
||||
}
|
||||
}
|
||||
@@ -357,7 +357,8 @@ public enum PassCode implements PassCode_ {
|
||||
ConfirmEmail,
|
||||
SynchronizeCredentials,
|
||||
PublishUserAccount,
|
||||
EditUserAccount
|
||||
EditUserAccount,
|
||||
DeleteUserAccount
|
||||
;
|
||||
//--
|
||||
@Override
|
||||
@@ -367,6 +368,8 @@ public enum PassCode implements PassCode_ {
|
||||
return "Добавление учётной записи";
|
||||
case EditUserAccount:
|
||||
return "Редактирование учётной записи";
|
||||
case DeleteUserAccount:
|
||||
return "Удаление учётной записи";
|
||||
case SynchronizeCredentials:
|
||||
return "Синхронизация учётных записей";
|
||||
case ConfirmEmail:
|
||||
|
||||
@@ -66,9 +66,12 @@ public enum ServerCode {
|
||||
GetUserAccountByKey,
|
||||
GetUserAccountByEmail,
|
||||
EditUserAccount,
|
||||
PublishUserAccount;
|
||||
PublishUserAccount,
|
||||
DeleteUserAccount;
|
||||
public String getDescription(){
|
||||
switch (this){
|
||||
case DeleteUserAccount:
|
||||
return "Удаление учётной записи на сервере";
|
||||
case PublishUserAccount:
|
||||
return "Создание учётной записи на сервере";
|
||||
case EditUserAccount:
|
||||
|
||||
Reference in New Issue
Block a user