Exemple #1
0
 def test_user_network_share(self):
     grant_access(self.net, self.other_user)
     access = user_has_access(self.net, self.other_user)
     self.assertEqual(access, True)
     
     access = user_can_edit(self.net, self.other_user)
     self.assertEqual(access, True)
     
     revoke_edit(self.net, self.other_user)
     access = user_can_edit(self.net, self.other_user)
     self.assertEqual(access, False)
     
     revoke_access(self.net, self.other_user)
     access = user_has_access(self.net, self.other_user)
     self.assertEqual(access, False)
Exemple #2
0
def share_not(request, object_type, object_id, user_id):
    model = Network if object_type == 'network' else Host
    obj, edit = get_object_or_forbidden(model, object_id, request.user)
    user = User.objects.get(pk=user_id)
    revoke_access(obj, user)
    return share_list(request, object_type, object_id)
Exemple #3
0
def share_not(request, object_type, object_id, user_id):
    model = Network if object_type == 'network' else Host
    obj, edit = get_object_or_forbidden(model, object_id, request.user)
    user = User.objects.get(pk=user_id)
    revoke_access(obj, user)
    return share_list(request, object_type, object_id)