mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-10 18:04:13 +00:00
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
module NaiveDAC{
|
|
function initDAC(req){
|
|
Global.acceptList = {
|
|
};
|
|
Global.applyList = {
|
|
};
|
|
Global.owner = req;
|
|
}
|
|
function checkPermission(req){
|
|
return (Global.acceptList[req]!=undefined);
|
|
}
|
|
export function hasPermission(arg){
|
|
return (Global.acceptList[requester]!=undefined);
|
|
}
|
|
export function accept(req){
|
|
if (requester==Global.owner){
|
|
Global.acceptList[req] = Global.applyList[req];
|
|
if (Global.applyList[req] != undefined)
|
|
Global.applyList[req] = undefined;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
export function cancel(req){
|
|
if (requester==Global.owner){
|
|
Global.applyList[req] = Global.acceptList[req];
|
|
if (Global.acceptList[req] != undefined)
|
|
Global.acceptList[req] = undefined;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
export function apply(remark){
|
|
if (remark != undefined && requester !=undefined){
|
|
Global.applyList[requester] = remark;
|
|
return "success";
|
|
}
|
|
return "failed"
|
|
}
|
|
export function needRender(arg){
|
|
return true;
|
|
}
|
|
export function getMainFrame(arg){
|
|
return "/naiveDAC/naiveDAC.html";
|
|
}
|
|
export function loadResource(arg){
|
|
return Global.Resources.loadAsString(arg);
|
|
}
|
|
export function isOwner(arg){
|
|
return Global.owner==requester;
|
|
}
|
|
export function getApplyList(arg){
|
|
return JSON.stringify(Global.applyList);
|
|
}
|
|
export function getAcceptList(arg){
|
|
return JSON.stringify(Global.acceptList);
|
|
}
|
|
}
|