From bd970f259173a49f3597d09a02e23428c8870877 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 6 Jul 2019 10:18:59 +0100 Subject: [PATCH] Configurable capabilities --- capabilities.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/capabilities.py b/capabilities.py index bd8a6699e..883a94f16 100644 --- a/capabilities.py +++ b/capabilities.py @@ -9,7 +9,7 @@ __status__ = "Production" import os from auth import createPassword -def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,domain: str,requestedActor: str) -> None: +def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,domain: str,requestedActor: str,inbox="write",objects="read") -> None: # This is sent to the capabilities endpoint /caps/new # which could be instance wide or for a particular person capId=createPassword(32) @@ -17,22 +17,22 @@ def sendCapabilitiesRequest(baseDir: str,httpPrefix: str,domain: str,requestedAc "id": httpPrefix+"://"+requestedDomain+"/caps/request/"+capId, "type": "Request", "capability": { - "inbox": "write", - "objects": "read" + "inbox": inbox, + "objects": objects }, "actor": requestedActor } #TODO -def sendCapabilitiesAccept(baseDir: str,httpPrefix: str,nickname: str,domain: str,acceptedActor: str) -> None: +def sendCapabilitiesAccept(baseDir: str,httpPrefix: str,nickname: str,domain: str,acceptedActor: str,inbox="write",objects="read") -> None: # This gets returned to capabilities requester capId=createPassword(32) capAccept = { "id": httpPrefix+"://"+domain+"/caps/"+capId, "type": "Capability", "capability": { - "inbox": "write", - "objects": "read" + "inbox": inbox, + "objects": objects }, "scope": acceptedActor, "actor": httpPrefix+"://"+domain