Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/CheckAccount.java

71 lines
2.4 KiB
Java
Raw Normal View History

package Visual_DVM_2021.Passes.All;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Current;
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> {
@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-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-02-16 21:44:13 +03:00
//временно. оффлайн проверка по почте
target = Global.mainModule.getAccount().email.equals("?") ?
( Global.mainModule.getPass(PassCode.EditAccount).Do() &&
Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do()) :
( Global.mainModule.getPass(PassCode.CheckRegistrationOnServer).Do());
}
@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();
if (Global.mainModule.HasBugReport())
2023-09-17 22:13:42 +03:00
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
}
if (Global.mainModule.getAccount().isAdmin())
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(true);
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
2023-09-17 22:13:42 +03:00
}
}