2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Current;
|
|
|
|
|
import Common.UI.UI;
|
2024-02-16 21:44:13 +03:00
|
|
|
import GlobalData.Account.AccountRole;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
import Visual_DVM_2021.Passes.Pass_2021;
|
2023-10-17 22:25:10 +03:00
|
|
|
public class CheckAccount extends Pass_2021<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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//временно. оффлайн проверка по почте
|
|
|
|
|
/*
|
2023-10-17 22:25:10 +03:00
|
|
|
target = Current.getAccount().email.equals("?") ?
|
|
|
|
|
(Pass_2021.passes.get(PassCode_2021.EditAccount).Do() &&
|
|
|
|
|
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do()) :
|
|
|
|
|
(Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do());
|
2024-02-16 21:44:13 +03:00
|
|
|
*/
|
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();
|
|
|
|
|
if (Current.HasBugReport())
|
|
|
|
|
UI.getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
|
|
|
|
}
|
|
|
|
|
if (Current.getAccount().isAdmin())
|
|
|
|
|
Pass_2021.passes.get(PassCode_2021.PublishComponent).setControlsVisible(true);
|
2023-10-17 19:16:59 +03:00
|
|
|
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|