промежуточный. нашел еще несколько уязвимостей в редактировнии чужих объектов.

This commit is contained in:
2025-02-22 15:18:22 +03:00
parent 8701c8ba36
commit f7973e0991
13 changed files with 48 additions and 54 deletions

View File

@@ -69,8 +69,9 @@ public class CreateTestFromDirectory extends Pass<Test> {
if (args.length == 0) {
//--
from_files_chooser = true;
if (!Global.testingServer.db.groups.getUI().CheckCurrent(Log))
if (!Global.testingServer.db.groups.getUI().canModifyCurrent(Log)) {
return false;
}
group = Global.testingServer.db.groups.getUI().getCurrent();
if (!selectFiles())
return false;

View File

@@ -4,8 +4,7 @@ import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.FileState;
import _VisualDVM.ProjectData.Files.ProjectFile;
import _VisualDVM.ProjectData.Project.db_project_info;
import _VisualDVM.TestingSystem.Common.Group.Group;
//из текущего проекта.
//добавить в текущую группу новый тест из текущего проекта.
public class CreateTestFromProject extends CreateTestFromDirectory {
db_project_info project;
@Override
@@ -14,25 +13,14 @@ public class CreateTestFromProject extends CreateTestFromDirectory {
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (args.length == 0) {
if (Global.testingServer.db.groups.getUI().CheckCurrent(Log) && Global.mainModule.Check(Log, Current.Project)) {
project = Global.mainModule.getProject();
if (super.canStart(
project.Home,
Global.testingServer.db.groups.getUI().getCurrent())) {
from_files_chooser = true; //чтобы опубликовал.
return true;
}
if (Global.testingServer.db.groups.getUI().canModifyCurrent(Log) && Global.mainModule.Check(Log, Current.Project)) {
project = Global.mainModule.getProject();
if (super.canStart(
project.Home,
Global.testingServer.db.groups.getUI().getCurrent())) {
from_files_chooser = true; //чтобы опубликовал.
return true;
}
} else {
project = (db_project_info) args[0];
group = (Group) args[1];
//если проект не текущий, освежить его бд.
if (!Global.mainModule.HasProject() || !Global.mainModule.getProject().Home.equals(project.Home)) {
project.Open();
project.Close();
}
return super.canStart(project.Home, group);
}
return false;
}

View File

@@ -18,7 +18,7 @@ public class CreateTestsFromFiles extends PublishTests {
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (Global.testingServer.db.groups.getUI().CheckCurrent(Log)) {
if (Global.testingServer.db.groups.getUI().canModifyCurrent(Log)) {
Utils.RestoreSelectedDirectory(fileChooser);
Vector<File> files = fileChooser.ShowMultiDialog();
if (files.isEmpty()) {

View File

@@ -12,10 +12,13 @@ public class DetectSelectedTestsMinMaDim extends TestingServerPass<Vector<Object
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (!Global.testingServer.db.tests.getUI().CheckSelectedOrCurrent(Log))
return false;
target=Global.testingServer.db.tests.getUI().getSelectedOrCurrentKeys();
return SendRequest(ServerCode.DetectTestsMinMaxDim, "",target);
if (Global.testingServer.db.groups.getUI().canModifyCurrent(Log)) {
if (!Global.testingServer.db.tests.getUI().CheckSelectedOrCurrent(Log))
return false;
target = Global.testingServer.db.tests.getUI().getSelectedOrCurrentKeys();
return SendRequest(ServerCode.DetectTestsMinMaxDim, "", target);
}
return false;
}
@Override
protected void performDone() throws Exception {

View File

@@ -5,6 +5,7 @@ import _VisualDVM.Passes.Server.TestingServerPass;
import _VisualDVM.Repository.Server.ServerCode;
import java.io.Serializable;
//заменить текущий тест на текущий проект.
public class ReplaceTestProject extends CreateTestFromProject {
@Override
public String getIconPath() {

View File

@@ -30,7 +30,7 @@ public class ReplaceTestsFromFiles extends TestingServerPass<Vector<Test>> {
//-
@Override
protected boolean canStart(Object... args) throws Exception {
if (!Global.testingServer.db.groups.getUI().CheckCurrent(Log))
if (!Global.testingServer.db.groups.getUI().canModifyCurrent(Log))
return false;
group = Global.testingServer.db.groups.getUI().getCurrent();
//--->>>

View File

@@ -29,7 +29,7 @@ public abstract class SaveCurrentConfiguration<C extends Configuration, S extend
protected abstract Class currentClass();
@Override
protected boolean canStart(Object... args) throws Exception {
if (!Global.testingServer.db.getTable(currentClass()).getUI().CheckCurrent(Log)) return false;
if (!Global.testingServer.db.getTable(currentClass()).getUI().canModifyCurrent(Log)) return false;
target = (C) Global.testingServer.db.getTable(currentClass()).getUI().getCurrent();
//--
groups = new Vector<>();

View File

@@ -5,6 +5,7 @@ import Common.Database.Tables.FKCurrentObjectBehaviuor;
import Common.Database.Tables.FKDataBehaviour;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.LanguageName;
import _VisualDVM.TestingSystem.Common.Group.UI.GroupsForm;
import _VisualDVM.TestingSystem.Common.Test.Test;
@@ -50,4 +51,5 @@ public class GroupsDBTable extends iDBTable<Group> {
}
return null;
}
// CheckCurrent(Log) && Global.mainModule.getAccount().CheckAuthorship(getCurrent().sender_address, Log);
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.TestingSystem.Common.Group.UI;
import Common.Database.Tables.DataSet;
import Common.Passes.PassCode_;
import Common.Utils.TextLog;
import Common.Visual.Controls.MenuBarButton;
import Common.Visual.Controls.StableMenuItem;
import Common.Visual.DataSetControlForm;