mirror of https://gitlab.com/bashrc2/epicyon
Function for handling checks after capabilities
parent
9856f414b4
commit
f4a1cfecce
33
inbox.py
33
inbox.py
|
@ -347,6 +347,11 @@ def receiveUpdate(session,baseDir: str, \
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def inboxAfterCapabilities(session,baseDir: str,httpPrefix: str,sendThreads: [],postLog: [],cachedWebfingers: {},personCache: {},queue: [],domain: str,port: int,useTor: bool,federationList: [],ocapAlways: bool,debug: bool,acceptedCaps: []) -> bool:
|
||||||
|
""" Anything which needs to be done after capabilities checks have passed
|
||||||
|
"""
|
||||||
|
return True
|
||||||
|
|
||||||
def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [],cachedWebfingers: {},personCache: {},queue: [],domain: str,port: int,useTor: bool,federationList: [],ocapAlways: bool,debug: bool,acceptedCaps=["inbox:write","objects:read"]) -> None:
|
def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [],cachedWebfingers: {},personCache: {},queue: [],domain: str,port: int,useTor: bool,federationList: [],ocapAlways: bool,debug: bool,acceptedCaps=["inbox:write","objects:read"]) -> None:
|
||||||
"""Processes received items and moves them to
|
"""Processes received items and moves them to
|
||||||
the appropriate directories
|
the appropriate directories
|
||||||
|
@ -502,21 +507,31 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [],cache
|
||||||
# Here the capability id begins with the handle, so this could also
|
# Here the capability id begins with the handle, so this could also
|
||||||
# be matched separately, but it's probably not necessary
|
# be matched separately, but it's probably not necessary
|
||||||
if capsId in capabilityIdList:
|
if capsId in capabilityIdList:
|
||||||
if debug:
|
if inboxAfterCapabilities(session,baseDir,httpPrefix, \
|
||||||
print('DEBUG: object capabilities passed')
|
sendThreads,postLog,cachedWebfingers, \
|
||||||
print('copy from '+queueFilename+' to '+queueJson['destination'].replace(inboxHandle,handle))
|
personCache,queue,domain,port,useTor, \
|
||||||
copyfile(queueFilename,queueJson['destination'].replace(inboxHandle,handle))
|
federationList,ocapAlways,debug, \
|
||||||
|
acceptedCaps):
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: object capabilities passed')
|
||||||
|
print('copy from '+queueFilename+' to '+queueJson['destination'].replace(inboxHandle,handle))
|
||||||
|
copyfile(queueFilename,queueJson['destination'].replace(inboxHandle,handle))
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: object capabilities check failed')
|
print('DEBUG: object capabilities check failed')
|
||||||
pprint(queueJson['post'])
|
pprint(queueJson['post'])
|
||||||
else:
|
else:
|
||||||
if not ocapAlways:
|
if not ocapAlways:
|
||||||
if debug:
|
if inboxAfterCapabilities(session,baseDir,httpPrefix, \
|
||||||
print('DEBUG: not enforcing object capabilities')
|
sendThreads,postLog,cachedWebfingers, \
|
||||||
print('copy from '+queueFilename+' to '+queueJson['destination'].replace(inboxHandle,handle))
|
personCache,queue,domain,port,useTor, \
|
||||||
copyfile(queueFilename,queueJson['destination'].replace(inboxHandle,handle))
|
federationList,ocapAlways,debug, \
|
||||||
continue
|
acceptedCaps):
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: not enforcing object capabilities')
|
||||||
|
print('copy from '+queueFilename+' to '+queueJson['destination'].replace(inboxHandle,handle))
|
||||||
|
copyfile(queueFilename,queueJson['destination'].replace(inboxHandle,handle))
|
||||||
|
continue
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: object capabilities check failed')
|
print('DEBUG: object capabilities check failed')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue