Exemple #1
0
    def assign_perm(self, permission, target):
        """This method is not a shortcut but adds custom logic to guardian
        `assign`, so you have to use it
        """

        if target.pk == get_anonymous_user().pk:
            # add also permission to all_users_group
            assign(permission, user_models.get_all_users_group(), self)

        return assign(permission, target, self)
Exemple #2
0
 def remove_perm(self, permission, target):
     if target.pk == get_anonymous_user().pk:
         # add also remove all_user_group permission
         remove_perm(permission, get_anonymous_user(), self)
         remove_perm(permission, user_models.get_all_users_group(), self)