исправление безопасности. промежуточный.

This commit is contained in:
2025-02-06 18:31:18 +03:00
parent 6e0e51beff
commit 20e82075b7
11 changed files with 41 additions and 25 deletions

21
.idea/workspace.xml generated
View File

@@ -7,18 +7,17 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/PauseDVMPackage.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/ResumeDVMPackage.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/icons/Resume.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Visual/DataSetControlForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/DataSetControlForm.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Passes/Pass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Passes/Pass.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Visual/Controls/PassButton.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Controls/PassButton.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Visualiser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Component/Visualiser.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Visual/Controls/PassControl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Controls/PassControl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TasksPackageState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TasksPackageState.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Visual/Controls/PassMenuItem.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Controls/PassMenuItem.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingPlanner.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Visual/Controls/StablePassMenuItem.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Visual/Controls/StablePassMenuItem.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/UI/DVMPackagesForm.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Interface/CallbackWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Interface/CallbackWindow.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/CallbackForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/CallbackForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/MainForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/MainForm.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -1,6 +1,6 @@
{ {
"Workspace": "E:\\Tests", "Workspace": "E:\\Tests",
"ProjectsSearchDirectory": "E:\\Tests\\Downloads", "ProjectsSearchDirectory": "E:\\BUG",
"VisualiserPath": "C:\\Users\\misha\\Downloads", "VisualiserPath": "C:\\Users\\misha\\Downloads",
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F", "Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
"Visualizer_2Path": "C:\\Users\\misha\\Documents", "Visualizer_2Path": "C:\\Users\\misha\\Documents",

View File

@@ -20,7 +20,12 @@ public class Pass<T> {
public PassState state = PassState.Inactive; //текущее состояние прохода. public PassState state = PassState.Inactive; //текущее состояние прохода.
public Semaphore animation_sem; public Semaphore animation_sem;
//-------------- //--------------
public boolean ui_visible = true;
public Vector<PassControl> controls = new Vector<>(); public Vector<PassControl> controls = new Vector<>();
public void addControl(PassControl control_in){
control_in.setVisible(ui_visible);
controls.add(control_in);
}
public TextLog Log; //внутренний журнал прохода. public TextLog Log; //внутренний журнал прохода.
protected boolean interrupt; protected boolean interrupt;
protected SwingWorker dispatcher = null; protected SwingWorker dispatcher = null;
@@ -74,8 +79,9 @@ public class Pass<T> {
control.setEnabled(flag); control.setEnabled(flag);
} }
public void setControlsVisible(boolean flag) { public void setControlsVisible(boolean flag) {
ui_visible =flag;
for (PassControl control : controls) for (PassControl control : controls)
control.setVisible(flag); control.setVisible(ui_visible);
} }
public void setControlsToolTipText(String text) { public void setControlsToolTipText(String text) {
for (PassControl control : controls) for (PassControl control : controls)

View File

@@ -16,7 +16,7 @@ public class PassButton extends MenuBarButton implements PassControl {
setIcon(pass.getIconPath()); setIcon(pass.getIconPath());
} }
addActionListener(pass.getControlAction()); addActionListener(pass.getControlAction());
pass.controls.add(this); pass.addControl(this);
} }
public PassButton(Pass pass) { public PassButton(Pass pass) {
this(pass, false); this(pass, false);

View File

@@ -1,4 +1,5 @@
package Common.Visual.Controls; package Common.Visual.Controls;
import Common.Passes.Pass;
public interface PassControl { public interface PassControl {
void setIcon(String icon_path); void setIcon(String icon_path);
void setEnabled(boolean flag); void setEnabled(boolean flag);

View File

@@ -8,7 +8,7 @@ public class PassMenuItem extends VisualiserMenuItem implements PassControl {
setToolTipText(pass.getDescription()); setToolTipText(pass.getDescription());
if (pass.getIconPath() != null) setIcon(pass.getIconPath()); if (pass.getIconPath() != null) setIcon(pass.getIconPath());
addActionListener(pass.getControlAction()); addActionListener(pass.getControlAction());
pass.controls.add(this); pass.addControl(this);
} }
@Override @Override
public void setIcon(String icon_path) { public void setIcon(String icon_path) {

View File

@@ -7,7 +7,7 @@ public class StablePassMenuItem extends StableMenuItem implements PassControl {
setToolTipText(pass.getDescription()); setToolTipText(pass.getDescription());
if (pass.getIconPath() != null) setIcon(pass.getIconPath()); if (pass.getIconPath() != null) setIcon(pass.getIconPath());
addActionListener(pass.getControlAction()); addActionListener(pass.getControlAction());
pass.controls.add(this); pass.addControl(this);
} }
@Override @Override
public void setIcon(String icon_path) { public void setIcon(String icon_path) {

View File

@@ -34,7 +34,8 @@ public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
// //
PassCode.ShutdownTestingServer, PassCode.ShutdownTestingServer,
PassCode.StartTestingServer, PassCode.StartTestingServer,
PassCode.PublishTestingServer PassCode.PublishTestingServer,
PassCode.CreateTestsGroupFromSelectedVersions
); );
public MainModule() throws Exception { public MainModule() throws Exception {
super(GlobalDatabase.class, MainUI.class); super(GlobalDatabase.class, MainUI.class);
@@ -147,6 +148,7 @@ public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
} }
public void SetDeveloperPassesAccess() { public void SetDeveloperPassesAccess() {
SetUserPassesAccess(); SetUserPassesAccess();
getPass(PassCode.CreateTestsGroupFromSelectedVersions).setControlsVisible(true);
getPass(PassCode.DownloadAllBugReportsArchives).setControlsVisible(true); getPass(PassCode.DownloadAllBugReportsArchives).setControlsVisible(true);
} }
public void SetAdminPassesAccess() { public void SetAdminPassesAccess() {

View File

@@ -24,6 +24,7 @@ public interface CallbackWindow extends VisualizerForm {
void ClearBugReportCommentAdditionText(); void ClearBugReportCommentAdditionText();
void FocusRecipients(); void FocusRecipients();
void SwitchScreen(boolean small); void SwitchScreen(boolean small);
void setUdefinedRights();
void setUserRights(); void setUserRights();
void setAdminRights(); void setAdminRights();
} }

View File

@@ -366,6 +366,15 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
Global.mainModule.getUI().getMainWindow().SwitchTestingTabs(true); Global.mainModule.getUI().getMainWindow().SwitchTestingTabs(true);
} }
@Override @Override
public void setUdefinedRights(){
Global.mainModule.SetUserPassesAccess();
UI.Clear(accountPanel);
accountPanel.add(new CallbackWelcomeForm().content);
Global.mainModule.getUI().getMainWindow().SwitchTestingTabs(false);
Global.mainModule.getUI().getTestingMenuBar().showServerAdminLabel(false);
adminLabel.setVisible(false);
}
@Override
public void setUserRights() { public void setUserRights() {
LockMyOnly(); LockMyOnly();
Global.mainModule.SetUserPassesAccess(); Global.mainModule.SetUserPassesAccess();
@@ -391,17 +400,16 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
lAccountName.setText(Utils_.Brackets(Global.mainModule.getAccount().name)); lAccountName.setText(Utils_.Brackets(Global.mainModule.getAccount().name));
lAccountMail.setText(Utils_.Brackets(Global.mainModule.getAccount().email)); lAccountMail.setText(Utils_.Brackets(Global.mainModule.getAccount().email));
lAccountRole.setText(Utils_.Brackets(Global.mainModule.getAccount().role.getDescription())); lAccountRole.setText(Utils_.Brackets(Global.mainModule.getAccount().role.getDescription()));
System.out.println("ROLE IS "+Global.mainModule.getAccount().role);
switch (Global.mainModule.getAccount().role) { switch (Global.mainModule.getAccount().role) {
case Undefined: case Undefined:
/// UI.Clear(accountPanel); setUdefinedRights();
// accountPanel.add(new CallbackWelcomeForm().content); break;
// UI.getMainWindow().SwitchTestingTabs(false);
// break;
case User: case User:
//видит только свои баги. //видит только свои баги.
// EnableBugreports(); EnableBugreports();
// setUserRights(); setUserRights();
// break; break;
case Developer: case Developer:
EnableBugreports(); EnableBugreports();
setDeveloperRights(); setDeveloperRights();

View File

@@ -218,7 +218,6 @@ public class MainForm extends Form implements MainWindow {
public void SwitchTestingTabs(boolean flag) { public void SwitchTestingTabs(boolean flag) {
globalTabs.setEnabledAt(3, flag); globalTabs.setEnabledAt(3, flag);
globalTabs.setEnabledAt(4, flag); globalTabs.setEnabledAt(4, flag);
// globalTabs.setEnabledAt(4, flag);
} }
@Override @Override
public TestingWindow getTestingWindow() { public TestingWindow getTestingWindow() {