Commit 8106d481 authored by Ryan Herbert's avatar Ryan Herbert

Merge branch 'feature-s/prevent-server-error-without-sample-set' into 'dev'

Prevent server error: check sample_set before accessing it.

See merge request !349
parents 3bea32f7 c9a249fc
Pipeline #49073 passed with stages
in 64 minutes and 19 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