Проверка на администратора при удалении 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

3
.idea/workspace.xml generated
View File

@@ -8,7 +8,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ReplaceTestsFromFiles.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ReplaceTestsFromFiles.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/GlobalData/Account/Account.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Account/Account.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteServerSapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteServerSapfor.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

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

View File

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