Beispiel #1
0
def update_roles(user, pode_alterar_imovel=True):
    """
    Por padrao corretores podem alterar imoveis,
    porem alguns podem ter acesso bloqueado
    """
    if not pode_alterar_imovel:
        revoke_permission(user, 'alterar_imovel')
        return False
    else:
        grant_permission(user, 'alterar_imovel')
        return True
Beispiel #2
0
    def test_not_allowed_permission(self):
        user = self.user

        self.assertFalse(grant_permission(user, 'permission1'))
Beispiel #3
0
    def test_grat_granted_permission(self):
        user = self.user

        self.assertTrue(grant_permission(user, 'permission3'))

        self.assertTrue(has_permission(user, 'permission3'))
    def test_not_allowed_permission(self):
        user = self.user

        self.assertFalse(grant_permission(user, 'permission1'))
    def test_grat_granted_permission(self):
        user = self.user

        self.assertTrue(grant_permission(user, 'permission3'))

        self.assertTrue(has_permission(user, 'permission3'))
    def test_grant_permission(self):
        user = self.user

        self.assertTrue(grant_permission(user, "permission4"))

        self.assertTrue(has_permission(user, "permission4"))