Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/CheckAccount.java
2024-10-10 23:57:36 +03:00

70 lines
2.3 KiB
Java

package Visual_DVM_2021.Passes.All;
import _VisualDVM.Current;
import _VisualDVM.Visual.UI;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
public class CheckAccount extends Pass<Boolean> {
@Override
protected boolean canStart(Object... args) throws Exception {
target = false;
return true;
}
@Override
public String getIconPath() {
return "/icons/Registry.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected void body() throws Exception {
/*
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;
}
*/
//временно. оффлайн проверка по почте
target = Current.getAccount().email.equals("?") ?
(Pass.passes.get(PassCode.EditAccount).Do() &&
Pass.passes.get(PassCode.CheckRegistrationOnServer).Do()) :
(Pass.passes.get(PassCode.CheckRegistrationOnServer).Do());
}
@Override
protected boolean validate() {
return target;
}
@Override
protected void showDone() throws Exception {
if (UI.getMainWindow() != null) {
UI.getMainWindow().getCallbackWindow().ShowAccount();
if (Current.HasBugReport())
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
}
if (Current.getAccount().isAdmin())
Pass.passes.get(PassCode.PublishComponent).setControlsVisible(true);
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
}
}