models/VidjilAuth: add can_modify_subset(sampleset_type, subset_id)
can_modify_sampleset need to make a db request to find the subset type, we should use can_modify_subset if we already know the sampleset type to avoid that
... | ... | @@ -281,6 +281,12 @@ class VidjilAuth(Auth): |
and (self.get_permission(PermissionEnum.admin.value, 'run', run_id, user=user)\ | ||
or self.is_admin(user)) | ||
def can_modify_subset(self, type, subset_id, user = None) : | ||
exists = self.exists(type, subset_id) | ||
|
||
return exists\ | ||
and (self.get_permission(PermissionEnum.admin.value, type, subset_id, user=user)\ | ||
or self.is_admin(user)) | ||
def can_modify_sample_set(self, sample_set_id, user = None) : | ||
sample_set = db.sample_set[sample_set_id] | ||
if sample_set is None: | ||
... | ... |
-
mentioned in issue #3169 (closed)
-
mentioned in issue #4232 (closed)
-
mentioned in merge request !642 (merged)