упразднение старого объекта аккаунта
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.Global;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class UserAccount extends iDBObject {
|
||||
public String name = "";
|
||||
@@ -31,4 +33,55 @@ public class UserAccount extends iDBObject {
|
||||
name = name_in;
|
||||
email=email_in;
|
||||
}
|
||||
//todo часть устарело.разобрать.
|
||||
public boolean CheckRegistered(TextLog Log) {
|
||||
if (role.equals(AccountRole.Undefined)) {
|
||||
if (Log != null) {
|
||||
Log.Writeln("Пользователь не зарегистрирован");
|
||||
if (Global.mainModule.getUI().hasMainWindow())
|
||||
Global.mainModule.getUI().getMainWindow().FocusCallback();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean isRegistered() {
|
||||
return !role.equals(AccountRole.Undefined);
|
||||
}
|
||||
public boolean CheckAuthorship(String address_in, TextLog log) {
|
||||
if (!isAdmin() && (!email.equals(address_in))) {
|
||||
if (log != null)
|
||||
log.Writeln_("Вы не являетесь автором или администратором");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean CheckAccessRights(String address_in, TextLog log) {
|
||||
return (CheckRegistered(log) && CheckAuthorship(address_in, log));
|
||||
}
|
||||
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))) {
|
||||
log.Writeln_("Вы не являетесь автором, исполнителем, или администратором");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isAdmin() {
|
||||
return role.equals(AccountRole.Admin);
|
||||
}
|
||||
public boolean CheckAdmin(TextLog log) {
|
||||
if (!isAdmin()) {
|
||||
log.Writeln_("Вы не являетесь администратором!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//---
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user