Commit c9a249fc authored by Mikaël Salson's avatar Mikaël Salson

VidjilAuth.py: Check sample_set before accessing it.

It should prevent some server errors.
parent 9e578b34
Pipeline #48633 passed with stages
in 6 minutes and 41 seconds
......@@ -282,10 +282,10 @@ class VidjilAuth(Auth):
def can_modify_sample_set(self, sample_set_id, user = None) :
sample_set = db.sample_set[sample_set_id]
sample_type = sample_set.sample_type
if sample_set is None:
return False
sample_type = sample_set.sample_type
perm = self.get_permission(PermissionEnum.admin.value, 'sample_set', sample_set_id, user)\
or self.is_admin(user)
if perm:
......@@ -453,10 +453,10 @@ class VidjilAuth(Auth):
return perm
sample_set = db.sample_set[sample_set_id]
sample_type = sample_set.sample_type
if sample_set is None:
return False
sample_type = sample_set.sample_type
for row in db( db[sample_type].sample_set_id == sample_set_id ).select() :
if self.can_view(sample_type, row.id, user):
perm = True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment