промежуточный. нашел еще несколько уязвимостей в редактировнии чужих объектов.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package Common.Database.Objects;
|
||||
public class riDBObject extends iDBObject {
|
||||
//-
|
||||
//todo int useraccount_id по объекту аккаунтов. сюда и права. и проверку их.
|
||||
public String sender_name = "";
|
||||
public String sender_address = "";
|
||||
//---
|
||||
public String description = "";
|
||||
//-
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package Common.Visual;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.Grid.TableVisualData;
|
||||
import Common.Database.Objects.riDBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
@@ -14,6 +15,7 @@ import Common.Visual.Menus.TableMenu;
|
||||
import Common.Visual.Tables.*;
|
||||
import Common.Visual.Tables.Grid.GridAnchestor;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumn;
|
||||
@@ -575,4 +577,9 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
public Object getCurrentPK(Object nanValue){
|
||||
return current==null? nanValue: current.getPK();
|
||||
}
|
||||
//todo временное решение ? ->>>
|
||||
public boolean canModifyCurrent(TextLog Log){
|
||||
return CheckCurrent(Log) && (
|
||||
!(current instanceof riDBObject) || Global.mainModule.getAccount().CheckAuthorship(((riDBObject)current).sender_address,Log));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
//--->>>
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user