Commit 98174d11 authored by HERBERT Ryan's avatar HERBERT Ryan
Browse files

Applying more permission updating

More of the old permission system is being replaced by the new method
parent f04e5f74
......@@ -81,7 +81,7 @@ def anon_birth(patient_id, user_id):
age = age_years_months(birth)
if auth.has_permission("anon", "patient", patient_id, user_id):
if auth.get_permission("anon", "patient", patient_id, user_id):
return "%s (%s)" % (birth, age)
else:
return age
......
......@@ -120,12 +120,12 @@ class ConfigController(unittest.TestCase):
#add permission to "popipo" a config
resp = change_permission()
self.assertTrue( auth.has_permission('popipo', 'config', id_config), "fail to add a permission")
self.assertTrue( auth.get_group_access('config', id_config, id_group), "fail to add a permission")
#remove it
resp = change_permission()
self.assertFalse( auth.has_permission('popipo', 'config', id_config), "fail to remove a permission")
self.assertFalse( auth.get_group_access('config', id_config, id_group), "fail to remove a permission")
......
......@@ -88,7 +88,7 @@ class GroupController(unittest.TestCase):
request.vars["group_id"] = group_id
resp = remove_permission()
auth.has_permission('admin', 'auth_group', group_id)
auth.get_permission('admin', 'auth_group', group_id)
def test3ChangePermission(self):
......@@ -97,7 +97,7 @@ class GroupController(unittest.TestCase):
request.vars["group_id"] = group_id
resp = change_permission()
auth.has_permission('admin', 'auth_group', group_id)
auth.get_permission('admin', 'auth_group', group_id)
def test4Rights(self):
......
......@@ -54,6 +54,7 @@ class PatientController(unittest.TestCase):
request.vars["birth"] = "2011-11-11"
request.vars["info"] = "test patient kZtYnOipmAzZ"
request.vars["id_label"] = "bob"
request.vars["patient_group"] = fake_group_id
resp = add_form()
print db(db.auth_permission.id>0).select()
......@@ -105,14 +106,13 @@ class PatientController(unittest.TestCase):
def test3ChangePermission(self):
patient_id = db( db.patient.info == "test patient kZtYnOipmAzZ").select()[0].id
request.vars["patient_id"] = patient_id
request.vars["group_id"] = 1
request.vars["permission"] = "popipo"
request.vars["group_id"] = fake_group_id
resp = change_permission()
self.assertTrue(auth.has_permission('popipo', 'patient', patient_id), "fail to add permission")
self.assertTrue(auth.get_group_access('patient', patient_id, fake_group_id), "fail to add permission")
resp = change_permission()
self.assertFalse(auth.has_permission('popipo', 'patient', patient_id), "fail to remove permission")
self.assertFalse(auth.get_group_access('patient', patient_id, fake_group_id), "fail to remove permission")
......
Supports Markdown
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