защита групп и тестов от редактирования не-авторами
This commit is contained in:
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -9,6 +9,10 @@
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Machine/UI/MachineFields.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/Machine/UI/MachineFields.form" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Group/UI/GroupDialog.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Group/UI/GroupDialog.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Group/UI/GroupsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Group/UI/GroupsForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestDialog.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestDialog.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/UI/TestsForm.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<component id="a00bb" class="javax.swing.JSpinner" binding="sPort">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="100" height="35"/>
|
||||
<preferred-size width="100" height="30"/>
|
||||
<maximum-size width="100" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
|
||||
@@ -4,6 +4,8 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.TestType;
|
||||
|
||||
import javax.swing.*;
|
||||
public class GroupDialog extends DBObjectDialog<Group, GroupFields> {
|
||||
public GroupDialog() {
|
||||
super(GroupFields.class);
|
||||
@@ -31,4 +33,10 @@ public class GroupDialog extends DBObjectDialog<Group, GroupFields> {
|
||||
Result.type = (TestType) fields.cbType.getSelectedItem();
|
||||
Result.language = (LanguageName) fields.cbLanguage.getSelectedItem();
|
||||
}
|
||||
@Override
|
||||
public void SetReadonly() {
|
||||
fields.tfName.setEnabled(false);
|
||||
fields.cbType.setEnabled(false);;
|
||||
fields.cbLanguage.setEnabled(false);;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.TestType;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
|
||||
import javax.swing.*;
|
||||
public class GroupsForm extends DataSetControlForm<Group> {
|
||||
@@ -109,4 +110,17 @@ public class GroupsForm extends DataSetControlForm<Group> {
|
||||
protected DBObjectDialog getDialog() {
|
||||
return new GroupDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isObjectEditable(Group object) {
|
||||
if (Global.mainModule.getAccount().CheckRegistered(null)) {
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
case Admin:
|
||||
return true;
|
||||
default:
|
||||
return (Global.mainModule.getAccount().email.equals(object.sender_address));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
public class TestDialog extends DBObjectDialog<Test, TestFields> {
|
||||
public TestDialog() {
|
||||
super(TestFields.class);
|
||||
@@ -40,4 +42,10 @@ public class TestDialog extends DBObjectDialog<Test, TestFields> {
|
||||
Result.sender_address = Global.mainModule.getAccount().email;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void SetReadonly() {
|
||||
fields.tfName.setEnabled(false);
|
||||
fields.sMinDim.setEnabled(false);
|
||||
fields.sMaxDim.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
|
||||
import javax.swing.*;
|
||||
public class TestsForm extends DataSetControlForm<Test> {
|
||||
@@ -66,5 +67,18 @@ public class TestsForm extends DataSetControlForm<Test> {
|
||||
protected DBObjectDialog getDialog() {
|
||||
return new TestDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isObjectEditable(Test object) {
|
||||
if (Global.mainModule.getAccount().CheckRegistered(null)) {
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
case Admin:
|
||||
return true;
|
||||
default:
|
||||
return (Global.mainModule.getAccount().email.equals(object.sender_address));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user