Проверка на администратора при удалении SAPFOR
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -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" />
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user