check the propertary of the devices

This commit is contained in:
Cayo Puigdefabregas 2021-04-09 22:20:30 +02:00
parent 48894567c3
commit a882396f09
1 changed files with 7 additions and 0 deletions

View File

@ -514,6 +514,13 @@ class Offer(ActionWithMultipleDevices):
if data['user_from_id']: if data['user_from_id']:
user_from = User.query.filter_by(email=data['user_from_id']).one() user_from = User.query.filter_by(email=data['user_from_id']).one()
# are you property of this devices?
txt = "Some of this devices don't are of this from user"
for x in data['devices']:
if not x.owner == user_from:
raise ValidationError(txt)
data['user_from_id'] = user_from.id data['user_from_id'] = user_from.id
data['user_from'] = user_from data['user_from'] = user_from
else: else: