2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-14 15:19:13 +03:00
|
|
|
import Common.Passes.Pass;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-14 12:14:01 +03:00
|
|
|
import _VisualDVM.Passes.PassCode;
|
2024-10-09 23:37:58 +03:00
|
|
|
public class CheckAccount extends Pass<Boolean> {
|
2023-10-17 22:25:10 +03:00
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
target = false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Registry.png";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void body() throws Exception {
|
2024-04-02 23:35:54 +03:00
|
|
|
/*
|
2024-02-16 21:44:13 +03:00
|
|
|
switch (Current.getAccount().email){
|
|
|
|
|
case "vmk-post@yandex.ru":
|
|
|
|
|
case "79854210702@ya.ru":
|
|
|
|
|
Current.getAccount().role = AccountRole.Admin;
|
|
|
|
|
target = true;
|
|
|
|
|
break;
|
|
|
|
|
case "npodderyugina@gmail.com":
|
|
|
|
|
case "savol@keldysh.ru":
|
|
|
|
|
case "mkocharmin@yandex.ru":
|
|
|
|
|
case "juk.06@list.ru":
|
|
|
|
|
Current.getAccount().role = AccountRole.Developer;
|
|
|
|
|
target = true;
|
|
|
|
|
break;
|
|
|
|
|
case "?":
|
|
|
|
|
Current.getAccount().role = AccountRole.Undefined;
|
|
|
|
|
target = false;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Current.getAccount().role =AccountRole.User;
|
|
|
|
|
target = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-04-02 23:35:54 +03:00
|
|
|
*/
|
2024-02-16 21:44:13 +03:00
|
|
|
//временно. оффлайн проверка по почте
|
2024-10-13 22:08:13 +03:00
|
|
|
target = Global.mainModule.getAccount().email.equals("?") ?
|
2024-10-14 15:19:13 +03:00
|
|
|
(Global.mainModule.getPass(PassCode.EditAccount).Do() &&
|
2024-10-13 23:55:03 +03:00
|
|
|
Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do()) :
|
2024-10-14 15:19:13 +03:00
|
|
|
(Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do());
|
2023-10-17 22:25:10 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
return target;
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
2024-10-15 02:32:52 +03:00
|
|
|
if (Global.mainModule.getUI().getMainWindow() != null) {
|
|
|
|
|
Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowAccount();
|
2024-10-25 02:08:23 +03:00
|
|
|
if (Global.componentsServer.db.bugReports.getUI().getCurrent() != null)
|
2024-10-15 02:32:52 +03:00
|
|
|
Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
2024-10-13 22:08:13 +03:00
|
|
|
if (Global.mainModule.getAccount().isAdmin())
|
2024-10-13 23:55:03 +03:00
|
|
|
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(true);
|
2023-10-17 19:16:59 +03:00
|
|
|
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|