From ce585bdce8152b24428a44e2491a02b7c8dc6d09 Mon Sep 17 00:00:00 2001 From: Mats Blomdahl Date: Thu, 26 Oct 2017 09:10:07 +0200 Subject: [PATCH] Logic error, fixes #76 --- xl_auth/permission/forms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xl_auth/permission/forms.py b/xl_auth/permission/forms.py index 31c303a0..b4614e83 100644 --- a/xl_auth/permission/forms.py +++ b/xl_auth/permission/forms.py @@ -106,8 +106,10 @@ def validate(self): return False other_permission = Permission.query.filter( - Permission.id.isnot(target_permission.id)).filter_by( - user_id=self.user_id.data, collection_id=self.collection_id.data).first() + Permission.id != target_permission.id, + Permission.user_id == self.user_id.data, + Permission.collection_id == self.collection_id.data + ).first() if other_permission: self.user_id.errors.append(_( 'Permissions for user "%(username)s" on collection "%(code)s" already registered',