core (memory): raise PermissionError directly instead of using failureFailure, as it could not be catched correctly in every case.

This commit is contained in:
Goffi 2019-04-28 08:55:13 +02:00
commit cad0d4b0e2

View file

@ -1233,18 +1233,18 @@ class Memory(object):
perm_data = file_data[u"access"][perm]
perm_type = perm_data[u"type"]
except KeyError:
raise failure.Failure(exceptions.PermissionError())
raise exceptions.PermissionError()
if perm_type == C.ACCESS_TYPE_PUBLIC:
continue
elif perm_type == C.ACCESS_TYPE_WHITELIST:
try:
jids = perm_data[u"jids"]
except KeyError:
raise failure.Failure(exceptions.PermissionError())
raise exceptions.PermissionError()
if peer_jid.full() in jids:
continue
else:
raise failure.Failure(exceptions.PermissionError())
raise exceptions.PermissionError()
else:
raise exceptions.InternalError(
_(u"unknown access type: {type}").format(type=perm_type)
@ -1530,7 +1530,7 @@ class Memory(object):
)
def fileUpdate(self, file_id, column, update_cb):
"""update a file column taking care of race condition
"""Update a file column taking care of race condition
access is NOT checked in this method, it must be checked beforehand
@param file_id(unicode): id of the file to update