comparison src/backend.py @ 388:1c13ba86a421

backend: allow admins to retract any item
author Goffi <goffi@goffi.org>
date Fri, 15 Feb 2019 15:56:30 +0100
parents 04e7dcc436ca
children 66128656f76c
comparison
equal deleted inserted replaced
387:04e7dcc436ca 388:1c13ba86a421
1094 1094
1095 We check that requestor is publisher of all the items he wants to retract 1095 We check that requestor is publisher of all the items he wants to retract
1096 and raise error.Forbidden if it is not the case 1096 and raise error.Forbidden if it is not the case
1097 """ 1097 """
1098 # TODO: the behaviour should be configurable (per node ?) 1098 # TODO: the behaviour should be configurable (per node ?)
1099 if any((requestor.userhostJID() != publisher.userhostJID() for publisher in publishers_map.itervalues())): 1099 if (any((requestor.userhostJID() != publisher.userhostJID()
1100 for publisher in publishers_map.itervalues()))
1101 and not self.isAdmin(requestor)
1102 ):
1100 raise error.Forbidden() 1103 raise error.Forbidden()
1101 1104
1102 if affiliation in ['owner', 'publisher']: 1105 if affiliation in ['owner', 'publisher']:
1103 # the requestor is owner or publisher of the node 1106 # the requestor is owner or publisher of the node
1104 # he can retract what he wants 1107 # he can retract what he wants