Commit e4a97f6b authored by HERBERT Ryan's avatar HERBERT Ryan

VidjilAuth add some generic permission checks

For these checks type must be specified in order to avoid checking all
possible affected tables as it is done in other methods.
parent 7fe58189
......@@ -262,7 +262,12 @@ class VidjilAuth(Auth):
perm = True;
return perm
def can_modify(self, type, id, user = None):
perm = self.get_permission(PermissionEnum.admin.value, type, id, user)\
or self.is_admin(user)
return perm
def can_modify_file(self, file_id, user = None) :
if self.is_admin(user) :
......@@ -412,6 +417,15 @@ class VidjilAuth(Auth):
return self.get_permission(PermissionEnum.anon.value, 'patient', patient_id, user)
def can_view_info(self, type, id, user = None):
Return True if user can see the information contained within
a given sample_set
If the user is None, the current userr is taken into account
return self.get_permission(PermissionEnum.anon.value, type, id, user)
def can_save_patient(self, patient_id, user = None):
Returns True if the user can save an analysis for the given patient
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