Обновление прав.Разработчики могут произвольно работать с багами
v++
This commit is contained in:
@@ -41,7 +41,7 @@ public class Account extends DBObject {
|
||||
public boolean ExtendedCheckAccessRights(BugReport bugReport, TextLog log) {
|
||||
if (CheckRegistered(log)) {
|
||||
if (email.equals(bugReport.executor_address)) {
|
||||
//исполнитель.
|
||||
//метод вывести как нерабочий.когда будет изменена схема админства.
|
||||
return true;
|
||||
} else {
|
||||
if (!isAdmin() && (!email.equals(bugReport.sender_address))) {
|
||||
|
||||
@@ -13,6 +13,6 @@ public class AppendBugReportComment extends AppendBugReportField {
|
||||
}
|
||||
@Override
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().ExtendedCheckAccessRights(target, Log);
|
||||
return target.canAppend(Global.mainModule.getAccount(),Log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class AppendBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
return "";
|
||||
}
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
return target.canModify(Global.mainModule.getAccount(),Log);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
|
||||
@@ -10,7 +10,7 @@ public class DeleteBugReport extends DeleteObjectPass<BugReport> {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return super.canStart(args) && Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
return super.canStart(args) && target.canModify(Global.mainModule.getAccount(),Log);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
|
||||
@@ -32,7 +32,8 @@ public class PublishBugReport extends Pass<BugReport> {
|
||||
if (!UI.Question("Для отчёта об ошибке не назначен исполнитель.\nВсе равно опубликовать его"))
|
||||
return false;
|
||||
}
|
||||
if (!Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log) && (target.CheckDraft(Log))) {
|
||||
if (!Global.mainModule.getAccount().CheckAuthorship(target.sender_address, Log)
|
||||
&& (target.CheckDraft(Log))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class UpdateBugReportField extends ComponentsRepositoryPass<BugReport> {
|
||||
String old_description = "";
|
||||
String old_comment = "";
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().CheckAccessRights(target.sender_address, Log);
|
||||
return target.canModify(Global.mainModule.getAccount(),Log);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
|
||||
@@ -22,6 +22,6 @@ public class UpdateBugReportProgress extends UpdateBugReportField {
|
||||
}
|
||||
@Override
|
||||
protected boolean canUpdate() {
|
||||
return Global.mainModule.getAccount().ExtendedCheckAccessRights(target, Log);
|
||||
return target.canAppend(Global.mainModule.getAccount(), Log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Utils.Vector_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforProperties;
|
||||
import _VisualDVM.Repository.BugReport.Json.RecipientJson;
|
||||
import _VisualDVM.Repository.BugReport.Json.RecipientsJson;
|
||||
@@ -51,7 +52,7 @@ public class BugReport extends rDBObject {
|
||||
project_version = version_in;
|
||||
visualiser_version = Global.visualiser.version;
|
||||
sapfor_version = Global.components.get(ComponentType.Sapfor_F).version;
|
||||
packedSettingsJson = Utils_.gson.toJson(Global.mainModule.getProject().sapforProperties);
|
||||
packedSettingsJson = Utils_.gson.toJson(Global.mainModule.getProject().sapforProperties);
|
||||
percentage = 0;
|
||||
description = description_in;
|
||||
date = new Date().getTime();
|
||||
@@ -129,14 +130,14 @@ public class BugReport extends rDBObject {
|
||||
"Версия визуализатора: " + visualiser_version,
|
||||
"----------------------------------"
|
||||
);
|
||||
if (!project_version.isEmpty()) {
|
||||
if (visualiser_version < 1134) {
|
||||
res.add(getSettingsJson().getSummary());
|
||||
} else {
|
||||
res.add(getPropertiesJson().getSummary());
|
||||
}
|
||||
}
|
||||
return String.join("\n", res);
|
||||
if (!project_version.isEmpty()) {
|
||||
if (visualiser_version < 1134) {
|
||||
res.add(getSettingsJson().getSummary());
|
||||
} else {
|
||||
res.add(getPropertiesJson().getSummary());
|
||||
}
|
||||
}
|
||||
return String.join("\n", res);
|
||||
}
|
||||
public String getPassport() {
|
||||
return String.join("\n",
|
||||
@@ -163,15 +164,47 @@ public class BugReport extends rDBObject {
|
||||
Vector<String> res = new Vector<>();
|
||||
if (packedRecipientsJson.isEmpty()) return res;
|
||||
RecipientsJson recipients = Utils_.gson.fromJson(packedRecipientsJson, RecipientsJson.class);
|
||||
for (RecipientJson recipientJson: recipients.array){
|
||||
for (RecipientJson recipientJson : recipients.array) {
|
||||
res.add(recipientJson.address);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public VisualiserSettingsJson getSettingsJson(){
|
||||
return packedSettingsJson.isEmpty()? new VisualiserSettingsJson(): Utils_.gson.fromJson(packedSettingsJson,VisualiserSettingsJson.class);
|
||||
public VisualiserSettingsJson getSettingsJson() {
|
||||
return packedSettingsJson.isEmpty() ? new VisualiserSettingsJson() : Utils_.gson.fromJson(packedSettingsJson, VisualiserSettingsJson.class);
|
||||
}
|
||||
public SapforProperties getPropertiesJson(){
|
||||
return packedSettingsJson.isEmpty()? new SapforProperties(): Utils_.gson.fromJson(packedSettingsJson,SapforProperties.class);
|
||||
public SapforProperties getPropertiesJson() {
|
||||
return packedSettingsJson.isEmpty() ? new SapforProperties() : Utils_.gson.fromJson(packedSettingsJson, SapforProperties.class);
|
||||
}
|
||||
public boolean canAppend(Account account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
if (account.email.equals(sender_address) || account.email.equals(executor_address)) {
|
||||
return true;
|
||||
} else {
|
||||
switch (account.role) {
|
||||
case Admin:
|
||||
case Developer:
|
||||
return true;
|
||||
default:
|
||||
if (log != null)
|
||||
log.Writeln_("Вы не являетесь автором, исполнителем, разработчиком, или администратором");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean canModify(Account account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
switch (account.role) {
|
||||
case Admin:
|
||||
case Developer:
|
||||
return true;
|
||||
default:
|
||||
if (account.email.equals(sender_address)) return true;
|
||||
if (log != null) log.Writeln_("Вы не являетесь автором, разработчиком, или администратором");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
version = 1141;
|
||||
version = 1142;
|
||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||
date_text = df.format(getClassBuildTime());
|
||||
|
||||
@@ -98,6 +98,16 @@ public class DVMConfigurationsForm extends DataSetControlForm<DVMConfiguration>
|
||||
}
|
||||
@Override
|
||||
protected boolean isObjectEditable(DVMConfiguration object) {
|
||||
return Global.mainModule.getAccount().CheckAccessRights(object.sender_address, null);
|
||||
if (Global.mainModule.getAccount().CheckRegistered(null)) {
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
case Admin:
|
||||
case Developer:
|
||||
return true;
|
||||
default:
|
||||
return (Global.mainModule.getAccount().email.equals(object.sender_address));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,15 @@ public class DVMSettingsForm extends DataSetControlForm<DVMSettings> {
|
||||
}
|
||||
@Override
|
||||
protected boolean isObjectEditable(DVMSettings object) {
|
||||
return Global.mainModule.getAccount().CheckAccessRights(object.sender_address, null);
|
||||
if (Global.mainModule.getAccount().CheckRegistered(null)) {
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
case Admin:
|
||||
case Developer:
|
||||
return true;
|
||||
default:
|
||||
return (Global.mainModule.getAccount().email.equals(object.sender_address));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user