Commits

Kai Diefenbach committed e5d87c3

Changes for new permissions API

Comments (0)

Files changed (2)

workflows/tests.py

         """
         """
         # Permissions
-        result = permissions.utils.has_permission(self.page_1, "edit", self.user)
+        result = permissions.utils.has_permission(self.page_1, self.user, "edit")
         self.assertEqual(result, True)
 
-        result = permissions.utils.has_permission(self.page_1, "view", self.user)
+        result = permissions.utils.has_permission(self.page_1, self.user, "view")
         self.assertEqual(result, True)
 
         # Inheritance
         workflows.utils.set_state(self.page_1, self.public)
 
         # Permissions
-        result = permissions.utils.has_permission(self.page_1, "edit", self.user)
+        result = permissions.utils.has_permission(self.page_1, self.user, "edit")
         self.assertEqual(result, False)
 
-        result = permissions.utils.has_permission(self.page_1, "view", self.user)
+        result = permissions.utils.has_permission(self.page_1, self.user, "view")
         self.assertEqual(result, True)
 
         # Inheritance

workflows/utils.py

     # Remove all permissions for the workflow
     for role in Role.objects.all():
         for wpr in WorkflowPermissionRelation.objects.filter(workflow=workflow):
-            permissions.utils.remove_permission(obj, wpr.permission, role)
+            permissions.utils.remove_permission(obj, role, wpr.permission)
 
     # Grant permission for the state
     for spr in StatePermissionRelation.objects.filter(state=state):
-        permissions.utils.grant_permission(obj, spr.permission, spr.role)
+        permissions.utils.grant_permission(obj, spr.role, spr.permission)
 
     # Remove all inheritance blocks from the object
     for wpr in WorkflowPermissionRelation.objects.filter(workflow=workflow):