Проверка на администратора при удалении SAPFOR

This commit is contained in:
2024-03-06 13:47:57 +03:00
parent da3f624cf2
commit 2b9cfc3af1
3 changed files with 14 additions and 1 deletions

View File

@@ -55,6 +55,13 @@ public class Account extends DBObject {
public boolean isAdmin() {
return role.equals(AccountRole.Admin);
}
public boolean CheckAdmin(TextLog log){
if (!isAdmin()){
log.Writeln_("Вы не являетесь администратором!");
return false;
}
return true;
}
@Override
public Object getPK() {
return id;

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import TestingSystem.Common.TestingServer;
@@ -7,4 +8,8 @@ public class DeleteServerSapfor extends DeleteServerObject<TestingServer, Server
public DeleteServerSapfor() {
super(Global.testingServer, ServerSapfor.class);
}
@Override
protected boolean canStart(Object... args) throws Exception {
return super.canStart(args)&&Current.getAccount().CheckAdmin(Log);
}
}