2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-08 00:39:13 +03:00
|
|
|
|
import Common.CurrentAnchestor;
|
2024-10-08 01:30:25 +03:00
|
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import Common_old.Current;
|
2024-10-08 01:30:25 +03:00
|
|
|
|
import GlobalData.GlobalDatabase;
|
2023-12-20 20:39:11 +03:00
|
|
|
|
import GlobalData.RemoteFile.RemoteFile;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import GlobalData.User.UserState;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Repository.SubscriberWorkspace.SubscriberWorkspace;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassException;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Pass_2021;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class InitialiseUser extends Pass_2021 {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/InitializeUser.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-08 00:39:13 +03:00
|
|
|
|
return CurrentAnchestor.Check(Log, Current.Machine, Current.User);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
|
switch (Current.getMachine().type) {
|
|
|
|
|
|
case Local:
|
|
|
|
|
|
passes.get(PassCode_2021.LocalInitaliseUser).Do();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case Server:
|
|
|
|
|
|
case MVS_cluster:
|
|
|
|
|
|
if (passes.get(PassCode_2021.CheckRemoteWorkspace).Do()) {
|
|
|
|
|
|
SubscriberWorkspace workspace = (SubscriberWorkspace) passes.get(PassCode_2021.CheckRemoteWorkspace).target;
|
|
|
|
|
|
if (workspace == null) {
|
|
|
|
|
|
if (passes.get(PassCode_2021.RemoteInitialiseUser).Do()){
|
|
|
|
|
|
workspace = new SubscriberWorkspace();
|
|
|
|
|
|
workspace.email=Current.getAccount().email;
|
|
|
|
|
|
workspace.URL=Current.getMachine().getURL();
|
|
|
|
|
|
workspace.login=Current.getUser().login;
|
2023-12-20 20:39:11 +03:00
|
|
|
|
workspace.path=((RemoteFile) passes.get(PassCode_2021.RemoteInitialiseUser).target).full_name;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//---
|
|
|
|
|
|
if (passes.get(PassCode_2021.PublishRemoteWorkspace).Do(workspace)) {
|
|
|
|
|
|
Current.getUser().workspace = workspace.path;
|
|
|
|
|
|
Current.getUser().state = UserState.ready_to_work;
|
2024-10-08 01:30:25 +03:00
|
|
|
|
CommonUtils.db.Update(Current.getUser());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
//рега была. просто заносим то что там пользователю
|
|
|
|
|
|
Current.getUser().workspace = workspace.path;
|
|
|
|
|
|
Current.getUser().state = UserState.ready_to_work;
|
2024-10-08 01:30:25 +03:00
|
|
|
|
CommonUtils.db.Update(Current.getUser());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
throw new PassException("Неопределенный тип пользователя");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void showFinish() throws Exception {
|
2024-10-08 01:30:25 +03:00
|
|
|
|
((GlobalDatabase)CommonUtils.db).users.RefreshUI();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|