упразднение старого объекта аккаунта
This commit is contained in:
@@ -9,9 +9,9 @@ import _VisualDVM.ComponentsServer.BugReport.Json.RecipientsJson;
|
||||
import _VisualDVM.ComponentsServer.BugReport.Json.VisualiserSettingsJson;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforProperties;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
@@ -127,7 +127,7 @@ public class BugReport extends rDBObject {
|
||||
}
|
||||
public String getSettingsSummary() {
|
||||
Vector<String> res = new Vector_<String>(
|
||||
(Global.mainModule.HasAccount() ? (Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + sender_address + "\n") : "") : ""),
|
||||
(Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + sender_address + "\n") : ""),
|
||||
"Версия SAPFOR: " + sapfor_version,
|
||||
"Версия визуализатора: " + visualiser_version,
|
||||
"----------------------------------"
|
||||
@@ -177,7 +177,7 @@ public class BugReport extends rDBObject {
|
||||
public SapforProperties getPropertiesJson() {
|
||||
return packedSettingsJson.isEmpty() ? new SapforProperties() : Utils_.gson.fromJson(packedSettingsJson, SapforProperties.class);
|
||||
}
|
||||
public boolean canAppend(Account account, TextLog log) {
|
||||
public boolean canAppend(UserAccount account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
if (account.email.equals(sender_address) || account.email.equals(executor_address)) {
|
||||
return true;
|
||||
@@ -195,7 +195,7 @@ public class BugReport extends rDBObject {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean canModify(Account account, TextLog log) {
|
||||
public boolean canModify(UserAccount account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
switch (account.role) {
|
||||
case Admin:
|
||||
|
||||
@@ -11,8 +11,7 @@ import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
@@ -237,20 +236,6 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
throw new RepositoryRefuseException("Баг репорт с ключом " + oldBugReport.id + " не существует.");
|
||||
}
|
||||
//--
|
||||
void CheckSubscriberRole() throws Exception {
|
||||
Account account = (Account) request.object;
|
||||
Subscriber subscriber = null;
|
||||
if (db.subscribers.containsKey(account.email)) {
|
||||
subscriber = db.subscribers.get(account.email);
|
||||
} else {
|
||||
subscriber = new Subscriber();
|
||||
subscriber.name = account.name;
|
||||
subscriber.address = account.email;
|
||||
subscriber.mailOn = 1;
|
||||
db.Insert(subscriber);
|
||||
}
|
||||
response.object = subscriber; //возвращаем информацию о подписчике.
|
||||
}
|
||||
void GetComponentsBackUps() throws Exception {
|
||||
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
//--
|
||||
@@ -364,9 +349,6 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case GetUserAccountByEmail:
|
||||
GetUserAccountByEmail();
|
||||
break;
|
||||
case CheckSubscriberRole: //todo устарело
|
||||
CheckSubscriberRole();
|
||||
break;
|
||||
case GetComponentsBackups:
|
||||
GetComponentsBackUps();
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.ComponentsServer.Subscribes;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class Subscriber extends DBObject {
|
||||
//todo скорее всего вывести.ибо дублер UserAccount
|
||||
|
||||
@@ -4,7 +4,7 @@ import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
public class SubscriberDialog extends DBObjectDialog<Subscriber, SubscriberFields> {
|
||||
public SubscriberDialog() {
|
||||
super(SubscriberFields.class);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.ComponentsServer.Subscribes.UI;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -8,7 +8,7 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import java.io.Serializable;
|
||||
public enum AccountRole implements Serializable {
|
||||
Undefined,
|
||||
@@ -4,7 +4,7 @@ import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
public class UserAccountDialog extends DBObjectDialog<UserAccount, UserAccountFields> {
|
||||
public UserAccountDialog() {
|
||||
super(UserAccountFields.class);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.ComponentsServer.UserAccount.UI;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.Global;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class UserAccount extends iDBObject {
|
||||
public String name = "";
|
||||
@@ -31,4 +33,55 @@ public class UserAccount extends iDBObject {
|
||||
name = name_in;
|
||||
email=email_in;
|
||||
}
|
||||
//todo часть устарело.разобрать.
|
||||
public boolean CheckRegistered(TextLog Log) {
|
||||
if (role.equals(AccountRole.Undefined)) {
|
||||
if (Log != null) {
|
||||
Log.Writeln("Пользователь не зарегистрирован");
|
||||
if (Global.mainModule.getUI().hasMainWindow())
|
||||
Global.mainModule.getUI().getMainWindow().FocusCallback();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean isRegistered() {
|
||||
return !role.equals(AccountRole.Undefined);
|
||||
}
|
||||
public boolean CheckAuthorship(String address_in, TextLog log) {
|
||||
if (!isAdmin() && (!email.equals(address_in))) {
|
||||
if (log != null)
|
||||
log.Writeln_("Вы не являетесь автором или администратором");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean CheckAccessRights(String address_in, TextLog log) {
|
||||
return (CheckRegistered(log) && CheckAuthorship(address_in, log));
|
||||
}
|
||||
public boolean ExtendedCheckAccessRights(BugReport bugReport, TextLog log) {
|
||||
if (CheckRegistered(log)) {
|
||||
if (email.equals(bugReport.executor_address)) {
|
||||
//метод вывести как нерабочий.когда будет изменена схема админства.
|
||||
return true;
|
||||
} else {
|
||||
if (!isAdmin() && (!email.equals(bugReport.sender_address))) {
|
||||
log.Writeln_("Вы не являетесь автором, исполнителем, или администратором");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isAdmin() {
|
||||
return role.equals(AccountRole.Admin);
|
||||
}
|
||||
public boolean CheckAdmin(TextLog log) {
|
||||
if (!isAdmin()) {
|
||||
log.Writeln_("Вы не являетесь администратором!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//---
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.Global;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class Account extends DBObject {
|
||||
@Description("PRIMARY KEY,NOT NULL")
|
||||
public int id = 0;
|
||||
public String name = "?";
|
||||
public String email = "?";
|
||||
//--
|
||||
@Description("IGNORE")
|
||||
public AccountRole role = AccountRole.Undefined; //роль незареганного пользователя
|
||||
//--
|
||||
public boolean CheckRegistered(TextLog Log) {
|
||||
if (role.equals(AccountRole.Undefined)) {
|
||||
if (Log != null) {
|
||||
Log.Writeln("Пользователь не зарегистрирован");
|
||||
if (Global.mainModule.getUI().hasMainWindow())
|
||||
Global.mainModule.getUI().getMainWindow().FocusCallback();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean isRegistered() {
|
||||
return !role.equals(AccountRole.Undefined);
|
||||
}
|
||||
public boolean CheckAuthorship(String address_in, TextLog log) {
|
||||
if (!isAdmin() && (!email.equals(address_in))) {
|
||||
if (log != null)
|
||||
log.Writeln_("Вы не являетесь автором или администратором");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean CheckAccessRights(String address_in, TextLog log) {
|
||||
return (CheckRegistered(log) && CheckAuthorship(address_in, log));
|
||||
}
|
||||
public boolean ExtendedCheckAccessRights(BugReport bugReport, TextLog log) {
|
||||
if (CheckRegistered(log)) {
|
||||
if (email.equals(bugReport.executor_address)) {
|
||||
//метод вывести как нерабочий.когда будет изменена схема админства.
|
||||
return true;
|
||||
} else {
|
||||
if (!isAdmin() && (!email.equals(bugReport.sender_address))) {
|
||||
log.Writeln_("Вы не являетесь автором, исполнителем, или администратором");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isAdmin() {
|
||||
return role.equals(AccountRole.Admin);
|
||||
}
|
||||
public boolean CheckAdmin(TextLog log) {
|
||||
if (!isAdmin()) {
|
||||
log.Writeln_("Вы не являетесь администратором!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
import Common.Database.Tables.DBTable;
|
||||
public class AccountsDBTable extends DBTable<Integer, Account> {
|
||||
public AccountsDBTable() {
|
||||
super(Integer.class, Account.class);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import Common.Database.VisualiserDatabase;
|
||||
import Common.MainModule_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Account.AccountsDBTable;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Compiler.CompilersDBTable;
|
||||
import _VisualDVM.GlobalData.DBLastProject.LastProjectsDBTable;
|
||||
@@ -43,7 +41,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
public DVMParameterDBTable dvmParameters;
|
||||
//----- ДАННЫЕ ВИЗУАЛИЗАТОРА---------------------------------
|
||||
public LastProjectsDBTable lastProjects;
|
||||
public AccountsDBTable accounts;
|
||||
//-
|
||||
public SapforProfilesDBTable sapforProfiles = null;
|
||||
//---------
|
||||
@@ -65,7 +62,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
addTable(runConfigurations = new RunConfigurationsDBTable());
|
||||
addTable(environmentValues = new EnvironmentValuesDBTable());
|
||||
addTable(lastProjects = new LastProjectsDBTable());
|
||||
addTable(accounts = new AccountsDBTable());
|
||||
addTable(dvmParameters = new DVMParameterDBTable());
|
||||
addTable(sapforProfiles = new SapforProfilesDBTable());
|
||||
addTable(sapforProfilesSettings = new SapforProfileSettingsDBTable());
|
||||
@@ -73,10 +69,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
//---------------------------------------------------------------------------------
|
||||
@Override
|
||||
public void Init() throws Exception {
|
||||
Global.mainModule.set(Current.Account,
|
||||
accounts.Data.isEmpty() ? Insert(new Account()) :
|
||||
accounts.getFirstRecord()
|
||||
);
|
||||
//настройки компонент
|
||||
runConfigurations.Patch();
|
||||
//---
|
||||
|
||||
@@ -2,7 +2,7 @@ package _VisualDVM;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Vector_;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
@@ -16,6 +16,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
|
||||
UserAccount account = null;
|
||||
//--
|
||||
Vector<PassCode> accountRoleDependentPasses = new Vector_<>(
|
||||
PassCode.AddSubscriber,
|
||||
@@ -40,6 +41,7 @@ public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
|
||||
);
|
||||
public MainModule() throws Exception {
|
||||
super(GlobalDatabase.class, MainUI.class);
|
||||
account = new UserAccount(Global.normalProperties.Name, Global.normalProperties.Email);
|
||||
}
|
||||
@Override
|
||||
public Class getPassCodesEnum() {
|
||||
@@ -50,13 +52,12 @@ public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
|
||||
return "_VisualDVM.Passes.All.";
|
||||
}
|
||||
//--
|
||||
public boolean HasAccount() {
|
||||
return get(Current.Account) != null;
|
||||
public UserAccount getAccount() {
|
||||
return account;
|
||||
}
|
||||
public void setAccount(UserAccount account_in) {
|
||||
account = account_in;
|
||||
}
|
||||
//todo Бессмысленно. аккаунт всегда подразумевается. вывести.
|
||||
public Account getAccount() {
|
||||
return (Account) get(Current.Account);
|
||||
} //временно
|
||||
public boolean HasProject() {
|
||||
return get(Current.Project) != null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM;
|
||||
import Common.CommonConstants;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
@@ -13,8 +13,6 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
public String Email = "";
|
||||
@Expose
|
||||
public String Name = "";
|
||||
@Expose
|
||||
public AccountRole Role = AccountRole.Undefined;
|
||||
//--->
|
||||
@Expose
|
||||
public String Workspace = "";
|
||||
@@ -173,7 +171,6 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
public void SynchronizeAccount(UserAccount account){
|
||||
Name = account.name;
|
||||
Email = account.email;
|
||||
Role = account.role;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReportState;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -3,15 +3,14 @@ import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.ComponentsServerPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
public class CheckAccount extends ComponentsServerPass<UserAccount> {
|
||||
public class CheckAccount extends ComponentsServerPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Registry.png";
|
||||
@@ -23,22 +22,18 @@ public class CheckAccount extends ComponentsServerPass<UserAccount> {
|
||||
File keyFile;
|
||||
void confirmEmail() throws Exception{
|
||||
ConfirmEmail confirmEmailPass = (ConfirmEmail) Global.mainModule.getPass(PassCode.ConfirmEmail);;
|
||||
if (confirmEmailPass.Do(
|
||||
new UserAccount(Global.normalProperties.Name, Global.normalProperties.Email))
|
||||
) {
|
||||
UserAccount userAccount = confirmEmailPass.target;
|
||||
if (confirmEmailPass.Do(Global.mainModule.getAccount())) {
|
||||
//подтвердили почту. теперь проверяем ее роль на сервере. если на сервере нет акка будет создан
|
||||
if (SendRequest(ServerCode.GetUserAccountByEmail, "",userAccount)){
|
||||
target = (UserAccount) request.server_response.object;
|
||||
FileUtils.writeStringToFile(keyFile, target.security_key);
|
||||
if (SendRequest(ServerCode.GetUserAccountByEmail, "",Global.mainModule.getAccount())){
|
||||
Global.mainModule.setAccount((UserAccount) request.server_response.object);
|
||||
FileUtils.writeStringToFile(keyFile, Global.mainModule.getAccount().security_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target =null;
|
||||
Global.mainModule.getAccount().role = AccountRole.Undefined;
|
||||
keyFile = new File(Global.KeyDirectory, "key");
|
||||
Global.normalProperties.Role = AccountRole.Undefined;
|
||||
Global.normalProperties.Update();
|
||||
//--
|
||||
//1. Ищем ключ.
|
||||
@@ -50,7 +45,7 @@ public class CheckAccount extends ComponentsServerPass<UserAccount> {
|
||||
if (request.server_response.object!=null){
|
||||
//ключ актуальный.
|
||||
System.out.println("ключ совпал");
|
||||
target = (UserAccount) request.server_response.object;
|
||||
Global.mainModule.setAccount((UserAccount) request.server_response.object);
|
||||
}else {
|
||||
System.out.println("ключ не совпал!");
|
||||
//ключ неактуальный. регистрируемся по новой.
|
||||
@@ -63,11 +58,11 @@ public class CheckAccount extends ComponentsServerPass<UserAccount> {
|
||||
System.out.println("ключ не найден!");
|
||||
confirmEmail();
|
||||
}
|
||||
return target!=null;
|
||||
return !Global.mainModule.getAccount().role.equals(AccountRole.Undefined);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Global.normalProperties.SynchronizeAccount(target);
|
||||
Global.normalProperties.SynchronizeAccount(Global.mainModule.getAccount());
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.ComponentsServer.Subscribes.Subscriber;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.ComponentsServerPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
public class CheckRegistrationOnServer extends ComponentsServerPass<Subscriber> {
|
||||
@Override
|
||||
protected boolean isSafe() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return SendRequest(ServerCode.CheckSubscriberRole, "", Global.mainModule.getAccount());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target = (Subscriber) request.server_response.object;
|
||||
Global.mainModule.getAccount().role = target.role;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import _VisualDVM.ComponentsServer.Component.Json.ComponentPublicationInfoJson;
|
||||
import _VisualDVM.ComponentsServer.Component.UI.PublishForm;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.ComponentsServerPass;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
@@ -32,10 +32,6 @@ public class PublishComponent extends ComponentsServerPass<Component> {
|
||||
Log.Writeln_("Публикация компонент разрешена только для Windows");
|
||||
return false;
|
||||
}
|
||||
if (!Global.mainModule.HasAccount()) {
|
||||
Log.Writeln_("Окно компонент было открыто до синхронизации прав");
|
||||
return false;
|
||||
}
|
||||
if (!Global.mainModule.getAccount().role.equals(AccountRole.Admin)) {
|
||||
Log.Writeln_("Вы не являетесь администратором");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ public enum PassCode implements PassCode_ {
|
||||
DeleteProfile,
|
||||
//-
|
||||
CheckAccount,
|
||||
CheckRegistrationOnServer,
|
||||
EditAccount,
|
||||
AddSubscriber,
|
||||
EditSubscriber,
|
||||
@@ -492,8 +491,6 @@ public enum PassCode implements PassCode_ {
|
||||
return "Массовый выбор массивов";
|
||||
case CheckAccount:
|
||||
return "Проверка учётной записи";
|
||||
case CheckRegistrationOnServer:
|
||||
return "Проверка регистрации учетной записи на сервере";
|
||||
case DeleteSelectedFiles:
|
||||
return "Удалить отмеченные файлы проекта";
|
||||
case SetSelectedFilesLanguage:
|
||||
|
||||
@@ -5,8 +5,6 @@ public enum ServerCode {
|
||||
Ping,
|
||||
ReceiveFile,
|
||||
//--
|
||||
CheckSubscriberRole,
|
||||
//-
|
||||
GetComponentsBackups,
|
||||
//-
|
||||
UpdateBugReport,
|
||||
@@ -115,8 +113,6 @@ public enum ServerCode {
|
||||
return "Скачивание компонента с сервера";
|
||||
case DeleteObjectByPK:
|
||||
return "Удаление объекта с сервера";
|
||||
case CheckSubscriberRole:
|
||||
return "Проверка роли подписчика на сервере";
|
||||
case CloneObjectByPK:
|
||||
return "Дублирование объекта на сервере";
|
||||
case UpdateActiveDVMPackages:
|
||||
|
||||
@@ -7,9 +7,10 @@ import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Utils.Vector_;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import _VisualDVM.Passes.All.DownloadRepository;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
@@ -296,7 +297,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
}
|
||||
Pair<Group, Vector<File>> ConvertDirectoryToGroup(File src, LanguageName languageName, TestType
|
||||
testType, Account account) throws Exception {
|
||||
testType, UserAccount account) throws Exception {
|
||||
Group object = new Group();
|
||||
Vector<File> groupFiles = null; //транспорт.
|
||||
//->>
|
||||
@@ -319,7 +320,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
return new Pair<>(object, groupFiles);
|
||||
}
|
||||
void RefreshDVMTests() throws Exception {
|
||||
Account account = (Account) request.object;
|
||||
UserAccount account = (UserAccount) request.object;
|
||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||
DownloadRepository downloadRepository = new DownloadRepository();
|
||||
if (!downloadRepository.Do())
|
||||
@@ -565,9 +566,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
SapforPackage tryAutoSapforTesting(TextLog Log) throws Exception {
|
||||
//--
|
||||
Account account = new Account();
|
||||
UserAccount account = new UserAccount();
|
||||
account.name = "server";
|
||||
account.email = Constants.MailAddress;
|
||||
account.role= AccountRole.Admin;
|
||||
//-
|
||||
int sapforId = Integer.parseInt(request.arg);
|
||||
if (!db.serverSapfors.containsKey(sapforId)) {
|
||||
|
||||
@@ -5,9 +5,9 @@ import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
@@ -210,7 +210,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
//---
|
||||
public void CreateTestFromSingleFile(Account account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
||||
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
||||
Test test = new Test();
|
||||
test.description = testDescription;
|
||||
test.sender_name = account.name;
|
||||
@@ -221,7 +221,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
//->>
|
||||
SaveTestFromSingleFile(sapfor, group, test, file);
|
||||
}
|
||||
public void RefreshGroup(Account account, ServerSapfor sapfor, Pair<Group, Vector<File>> groupData) throws Exception {
|
||||
public void RefreshGroup(UserAccount account, ServerSapfor sapfor, Pair<Group, Vector<File>> groupData) throws Exception {
|
||||
Group group = groupData.getKey();
|
||||
Vector<File> files = groupData.getValue();
|
||||
//--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package _VisualDVM.TestingSystem.DVM.DVMPackage;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
@@ -31,7 +31,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
//---
|
||||
public DVMPackage() {
|
||||
}
|
||||
public DVMPackage(Account account,
|
||||
public DVMPackage(UserAccount account,
|
||||
Machine machine,
|
||||
User user,
|
||||
Compiler compiler,
|
||||
|
||||
@@ -3,8 +3,8 @@ import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import _VisualDVM.TestingSystem.Common.TasksPackageState;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
@@ -32,7 +32,7 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
//---------
|
||||
//конструктор. если 0 задач по итогу,значит пакет не запускаем вообще, и смотрим журнал.
|
||||
//Запрещено выполнять на нитях, так как прямой доступ к бд.
|
||||
public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations,
|
||||
public SapforPackage(UserAccount account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations,
|
||||
int neeedsEmail_in,
|
||||
TextLog Log) throws Exception {
|
||||
id = CommonConstants.Nan;
|
||||
|
||||
@@ -425,11 +425,11 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
break;
|
||||
}
|
||||
*/
|
||||
lAccountName.setText(Utils_.Brackets(Global.normalProperties.Name));
|
||||
lAccountMail.setText(Utils_.Brackets(Global.normalProperties.Email));
|
||||
lAccountRole.setText(Utils_.Brackets(Global.normalProperties.Role.getDescription()));
|
||||
System.out.println("ROLE IS "+Global.normalProperties.Role.getDescription());
|
||||
switch (Global.normalProperties.Role) {
|
||||
lAccountName.setText(Utils_.Brackets(Global.mainModule.getAccount().name));
|
||||
lAccountMail.setText(Utils_.Brackets(Global.mainModule.getAccount().email));
|
||||
lAccountRole.setText(Utils_.Brackets(Global.mainModule.getAccount().role.getDescription()));
|
||||
System.out.println("ROLE IS "+Global.mainModule.getAccount().role.getDescription());
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
case Undefined:
|
||||
setUdefinedRights();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user