forked from iod/ControlProxy
feat: access control owner
This commit is contained in:
parent
8619858f05
commit
f9bc24c358
@ -28,6 +28,9 @@ module DOAuth {
|
||||
@ArgSchema({
|
||||
"doId" : "string", "publicKey" : "string", "info": "string"
|
||||
})
|
||||
@Access({
|
||||
"ACFunction":"acceptOwner"
|
||||
})
|
||||
export function addAuthedUser(arg) {
|
||||
//把requester和 arg.doId放到accessInfo里即可。
|
||||
addDBSetItem(Global.accessInfo, arg.doId, arg.publicKey);
|
||||
@ -55,10 +58,21 @@ module DOAuth {
|
||||
} else print("acceptJudgement, requester:" + argPack.requester + "true!!");
|
||||
}
|
||||
|
||||
function acceptOwner(argPack) {
|
||||
if (argPack.requester !== Global.owner) {
|
||||
YancloudUtil.exceptionReturn({
|
||||
"code" : 401, "msg" : "no permission: " + argPack.action
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Description("针对某一DO,删除用户的访问权限")
|
||||
@ArgSchema({
|
||||
"doId" : "string", "publicKey" : "string"
|
||||
})
|
||||
@Access({
|
||||
"ACFunction":"acceptOwner"
|
||||
})
|
||||
export function deleteAuthedUser(arg) {
|
||||
deleteDBSetItem(Global.accessInfo, arg.doId, arg.publicKey);
|
||||
return {
|
||||
@ -70,6 +84,9 @@ module DOAuth {
|
||||
@ArgSchema({
|
||||
"doId" : "string", "publicKey" : "string", "info" : "string"
|
||||
})
|
||||
@Access({
|
||||
"ACFunction":"acceptOwner"
|
||||
})
|
||||
export function addAuthedNode(arg) {
|
||||
addDBSetItem(Global.accessInfo, arg.doId, arg.publicKey);
|
||||
if(arg.info != null) {
|
||||
@ -85,6 +102,9 @@ module DOAuth {
|
||||
@ArgSchema({
|
||||
"doId" : "string", "publicKey" : "string"
|
||||
})
|
||||
@Access({
|
||||
"ACFunction":"acceptOwner"
|
||||
})
|
||||
export function deleteAuthedNode(arg) {
|
||||
deleteDBSetItem(Global.accessInfo, arg.doId, arg.publicKey);
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user