Removed unused capabilities functions

master
Bob Mottram 2019-07-09 10:20:04 +01:00
parent 95c6d9366a
commit 1b10d7ef4b
4 changed files with 0 additions and 30 deletions

View File

@ -151,19 +151,3 @@ def capabilitiesGrantedSave(baseDir :str,nickname :str,domain :str,ocap: {}) ->
with open(ocapFilename, 'w') as fp:
commentjson.dump(ocap, fp, indent=4, sort_keys=False)
return True
def isCapable(actor: str,ocapGranted: {},capability: str) -> bool:
# is the given actor capable of using the current resource?
for id,ocap in ocapGranted.items():
if ocap['scope'] in actor:
if capability in ocap['capability']:
return True
return False
def isCapableId(id: str,ocapGranted: {},capability: str) -> bool:
# is the given id capable of using the current resource?
if ocapGranted.get(id):
if ocapGranted['id']['scope'] in actor:
if capability in ocapGranted['id']['capability']:
return True
return False

View File

@ -18,7 +18,6 @@ from utils import getNicknameFromActor
from utils import getStatusNumber
from utils import followPerson
from posts import sendSignedJson
from capabilities import isCapable
from acceptreject import createAccept
def getFollowersOfPerson(baseDir: str, \
@ -322,11 +321,6 @@ def sendFollowRequest(session,baseDir: str, \
if followPort!=80 and followPort!=443:
requestDomain=followDomain+':'+str(followPort)
# check that we are capable
if ocapGranted:
if not isCapable(followActor,ocapGranted,'inbox:write'):
return None
statusNumber,published = getStatusNumber()
followedId=followHttpPrefix+'://'+requestDomain+'/users/'+followNickname

View File

@ -30,7 +30,6 @@ from httpsig import createSignedHeader
from utils import getStatusNumber
from utils import createPersonDir
from utils import urlPermitted
from capabilities import isCapable
from capabilities import getOcapFilename
try:
from BeautifulSoup import BeautifulSoup
@ -344,9 +343,6 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
sensitive=True
if not clientToServer:
actorUrl=httpPrefix+'://'+domain+'/users/'+nickname
if ocapGranted:
if not isCapable(actorUrl,ocapGranted,'inbox:write'):
return None
# if capabilities have been granted for this actor
# then get the corresponding id

View File

@ -8,7 +8,6 @@ __status__ = "Production"
import os
import datetime
#from capabilities import isCapable
def getStatusNumber() -> (str,str):
"""Returns the status number and published date
@ -50,9 +49,6 @@ def domainPermitted(domain: str, federationList: []):
return False
def urlPermitted(url: str, federationList: [],ocapGranted: {},capability: str):
#if ocapGranted:
# if not isCapable(url,ocapGranted,capability):
# return False
if len(federationList)==0:
return True
for domain in federationList: