Repository: akvo/akvo-rsr

Issue:
user_is_me_manager context variable gets the wrong value
The **user_is_me_manager** context in my_rsr.my_project() relies on the **rsr.do_me_manager_actions** permission. This permission went missing [in this commit](https://github.com/akvo/akvo-rsr/commit/cfae65db742968989f751273a54760e864980c29). 

I don't understand why there is no trace of the change to __init__.py. The [two](https://github.com/akvo/akvo-rsr/blob/ccbb14825fbca729aecf8eacb526c239300c4134/akvo/rsr/models/__init__.py#L217) [parent](https://github.com/akvo/akvo-rsr/blob/e0a84df5a03ba656f1483f8e8fba0e86ebe817dc/akvo/rsr/models/__init__.py#L214) commits are clearly different so why does the change not show in the [diff](https://github.com/akvo/akvo-rsr/commit/cfae65db742968989f751273a54760e864980c29#diff-40a3a89377750288f9a182b28ef79dd4)?

The fix is of course trivial.


Discussion:

Resolving patch:
diff --git a/akvo/rsr/models/__init__.py b/akvo/rsr/models/__init__.py
--- a/akvo/rsr/models/__init__.py
+++ b/akvo/rsr/models/__init__.py
@@ -215,6 +215,7 @@
 rules.add_perm('rsr.add_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
 rules.add_perm('rsr.change_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
 rules.add_perm('rsr.delete_indicatorperiod', is_rsr_admin | is_org_admin | is_org_me_manager_or_project_editor)
+rules.add_perm('rsr.do_me_manager_actions', is_rsr_admin | is_org_admin | is_org_me_manager)
 
 rules.add_perm('rsr.view_indicatorperioddata', is_rsr_admin | is_org_admin | is_org_me_manager)
 rules.add_perm(


Test patch:
diff --git a/akvo/rsr/tests/test_permissions.py b/akvo/rsr/tests/test_permissions.py
--- a/akvo/rsr/tests/test_permissions.py
+++ b/akvo/rsr/tests/test_permissions.py
@@ -110,6 +110,9 @@ def test_org_admin_permissions(self):
         self.assertTrue(user.has_perm('rsr.change_project', None))
         self.assertTrue(user.has_perm('rsr.change_partnersite'))
 
+        # "M&E manager" actions
+        self.assertTrue(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -195,6 +198,9 @@ def test_org_project_editor(self):
         # No object
         self.assertTrue(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -279,6 +285,9 @@ def test_org_me_manager(self):
         # No object
         self.assertTrue(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertTrue(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             test = self.assertTrue if i == 0 else self.assertFalse
@@ -363,6 +372,9 @@ def test_org_user_manager(self):
         # No object
         self.assertFalse(user.has_perm('rsr.change_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Organisation permissions
         for i, org in enumerate(self.orgs):
             self.assertFalse(user.has_perm('rsr.change_organisation', org))
@@ -435,6 +447,9 @@ def test_org_user_permissions(self):
         # None object permissions
         self.assertTrue(user.has_perm('rsr.view_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Test no permissions on None, if user doesn't have required employment
         self.assertFalse(user.has_perm('rsr.add_indicatorperioddata'))
 
@@ -460,6 +475,9 @@ def test_org_enumerator_permissions(self):
         # Permissions on None
         self.assertTrue(user.has_perm('rsr.view_project', None))
 
+        # "M&E manager" actions
+        self.assertFalse(user.has_perm('rsr.do_me_manager_actions'))
+
         # Project Update permissions
         for i, project_update in enumerate(self.project_updates):
             test = self.assertTrue if i == 0 else self.assertFalse