2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Visual.UI;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Visual_DVM_2021.Passes.PassCode;
|
2024-10-10 23:57:36 +03:00
|
|
|
import Common.Passes.Pass;
|
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-04-02 23:35:54 +03:00
|
|
|
|
2024-10-13 22:08:13 +03:00
|
|
|
target = Global.mainModule.getAccount().email.equals("?") ?
|
2024-10-09 23:37:58 +03:00
|
|
|
(Pass.passes.get(PassCode.EditAccount).Do() &&
|
|
|
|
|
Pass.passes.get(PassCode.CheckRegistrationOnServer).Do()) :
|
|
|
|
|
(Pass.passes.get(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 {
|
|
|
|
|
if (UI.getMainWindow() != null) {
|
|
|
|
|
UI.getMainWindow().getCallbackWindow().ShowAccount();
|
2024-10-13 22:08:13 +03:00
|
|
|
if (Global.mainModule.HasBugReport())
|
2023-09-17 22:13:42 +03:00
|
|
|
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
|
|
|
|
}
|
2024-10-13 22:08:13 +03:00
|
|
|
if (Global.mainModule.getAccount().isAdmin())
|
2024-10-09 23:37:58 +03:00
|
|
|
Pass.passes.get(PassCode.PublishComponent).setControlsVisible(true);
|
2023-10-17 19:16:59 +03:00
|
|
|
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|