Ejemplo n.º 1
0
def _clear_users_permissions(instance):
    if instance.user:
        clear_user_permission_cache(instance.user)
    if instance.group:
        user_set = getattr(instance.group, 'user_set')
        for user in user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 2
0
    def test_basic_permissions(self):
        """
        Test basic permissions cache get / set / clear low-level api
        """
        cached_permissions = get_permission_cache(self.user_normal, "can_change")
        self.assertIsNone(cached_permissions)

        set_permission_cache(self.user_normal, "can_change", [self.home_page.id])
        cached_permissions = get_permission_cache(self.user_normal, "can_change")
        self.assertEqual(cached_permissions, [self.home_page.id])

        clear_user_permission_cache(self.user_normal)
        cached_permissions = get_permission_cache(self.user_normal, "can_change")
        self.assertIsNone(cached_permissions)
Ejemplo n.º 3
0
def pre_save_globalpagepermission(instance, raw, **kwargs):
    if instance.user:
        clear_user_permission_cache(instance.user)
    menu_pool.clear(all=True)
Ejemplo n.º 4
0
def pre_save_pagepermission(instance, raw, **kwargs):
    if not raw and instance.user:
        clear_user_permission_cache(instance.user)
Ejemplo n.º 5
0
def pre_delete_group(instance, **kwargs):
    user_set = getattr(instance, 'user_set')
    for user in user_set.all():
        clear_user_permission_cache(user)
Ejemplo n.º 6
0
def _clear_users_permissions(instance):
    if instance.user:
        clear_user_permission_cache(instance.user)
    if instance.group:
        for user in instance.group.user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 7
0
def pre_delete_group(instance, **kwargs):
    for user in instance.user_set.all():
        clear_user_permission_cache(user)
Ejemplo n.º 8
0
def pre_delete_user(instance, **kwargs):
    clear_user_permission_cache(instance)
Ejemplo n.º 9
0
def pre_save_group(instance, raw, **kwargs):
    if instance.pk:
        for user in instance.user_set.filter(is_staff=True):
            clear_user_permission_cache(user)
Ejemplo n.º 10
0
def pre_delete_group(instance, **kwargs):
    for user in instance.user_set.all():
        clear_user_permission_cache(user)
Ejemplo n.º 11
0
def pre_save_group(instance, raw, **kwargs):
    if instance.pk:
        for user in instance.user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 12
0
def pre_delete_user(instance, **kwargs):
    clear_user_permission_cache(instance)
Ejemplo n.º 13
0
def pre_save_user(instance, raw, **kwargs):
    clear_user_permission_cache(instance)
Ejemplo n.º 14
0
def pre_save_group(instance, raw, **kwargs):
    if instance.pk:
        user_set = getattr(instance, user_related_name)
        for user in user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 15
0
def pre_delete_globalpagepermission(instance, **kwargs):
    if instance.user:
        clear_user_permission_cache(instance.user)
Ejemplo n.º 16
0
def pre_save_user(instance, raw, **kwargs):
    clear_user_permission_cache(instance)
Ejemplo n.º 17
0
def pre_delete_group(instance, **kwargs):
    for user in instance.user_set.filter(is_staff=True):
        clear_user_permission_cache(user)
Ejemplo n.º 18
0
def pre_save_group(instance, raw, **kwargs):
    if instance.pk:
        for user in instance.user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 19
0
def pre_save_group(instance, raw, **kwargs):
    if instance.pk:
        user_set = getattr(instance, 'user_set')
        for user in user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 20
0
def _clear_users_permissions(instance):
    if instance.user:
        clear_user_permission_cache(instance.user)
    if instance.group:
        for user in instance.group.user_set.all():
            clear_user_permission_cache(user)
Ejemplo n.º 21
0
def pre_delete_group(instance, **kwargs):
    user_set = getattr(instance, 'user_set')
    for user in user_set.all():
        clear_user_permission_cache(user)