示例#1
0
 def test_basics(self):
     jane = self._make_user("*****@*****.**")
     john = self._make_user("*****@*****.**")
     roger = self._make_user("*****@*****.**")
     assert permissions.has_permission(jane, "can-frobulate")
     assert not permissions.has_permission(john, "can-frobulate")
     assert not permissions.has_permission(jane, "can-durlingate")
     assert permissions.has_permission(john, "can-durlingate")
     assert permissions.has_permission(jane, "can-tergonize")
     assert not permissions.has_permission(john, "can-tergonize")
     assert permissions.has_permission(roger, "can-tergonize")
示例#2
0
 def test_admin_check(self):
     user = users_factories.UserFactory.build(isAdmin=False,
                                              email="*****@*****.**")
     assert not permissions.has_permission(user, "can-frobulate")
示例#3
0
 def test_star(self):
     user = self._make_user("*****@*****.**")
     assert permissions.has_permission(user, "can-frobulate")
示例#4
0
 def test_empty_permission_list(self):
     user = self._make_user("*****@*****.**")
     assert not permissions.has_permission(user, "unknown-permission")
示例#5
0
 def can_add_or_modify(self):
     # We don't call `has_permission()` from `is_accessible()`
     # because we still want admin users to be able to list
     # reimbursement rules. We want to restrict addition and
     # modification only.
     return permissions.has_permission(current_user, "add-or-modify-custom-reimbursement-rules")