init
This commit is contained in:
49
datanet-search-engine-backend/yjs/DAC.yjs
Normal file
49
datanet-search-engine-backend/yjs/DAC.yjs
Normal file
@@ -0,0 +1,49 @@
|
||||
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 isOwner(arg){
|
||||
return Global.owner==requester;
|
||||
}
|
||||
export function getApplyList(arg){
|
||||
return JSON.stringify(Global.applyList);
|
||||
}
|
||||
export function getAcceptList(arg){
|
||||
return JSON.stringify(Global.acceptList);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user