Did I find the right examples for you? yes no

All Samples(16)  |  Call(12)  |  Derive(0)  |  Import(4)

src/p/e/permission-backend-nonrel-0.2/permission_backend_nonrel/admin.py   permission-backend-nonrel(Download)
 
from .models import UserPermissionList, GroupPermissionList
from .utils import update_permissions_user, \
     update_user_groups, update_permissions_group
 
                permissions = []
 
            update_permissions_user(permissions, obj)
        except KeyError:
            pass

src/d/j/django-permission-backend-nonrel-HEAD/permission_backend_nonrel/admin.py   django-permission-backend-nonrel(Download)
 
from .models import UserPermissionList, GroupPermissionList
from .utils import update_permissions_user, \
     update_user_groups, update_permissions_group
 
                permissions = []
 
            update_permissions_user(permissions, obj)
        except KeyError:
            pass

src/p/e/permission-backend-nonrel-0.2/permission_backend_nonrel/tests.py   permission-backend-nonrel(Download)
from .models import UserPermissionList, \
     GroupPermissionList
from .utils import add_permission_to_user, \
     add_user_to_group, add_permission_to_group, update_permissions_user, update_user_groups, update_permissions_group
 
 
        # add a permission
        update_permissions_user([perm], user)
        self.assertEqual(UserPermissionList.objects.count(), 1)
        pl = UserPermissionList.objects.all()[0]
        # add a duplicated permission
        user = User.objects.get(username='test')
        update_permissions_user([perm], user)
        self.assertEqual(UserPermissionList.objects.count(), 1)
        pl = UserPermissionList.objects.all()[0]
        self.assertEqual(user.has_perm('auth.test2'), False)
        user = User.objects.get(username='test')
        update_permissions_user([perm1, perm2, perm], user)
        self.assertEqual(user.has_perm('auth.test1'), True)
        self.assertEqual(user.has_perm('auth.test2'), True)
        user = User.objects.get(username='test')
        pl = UserPermissionList.objects.all()[0]
        update_permissions_user([perm], user)
        self.assertEqual(user.has_perm('auth.test1'), False)
        self.assertEqual(user.has_perm('auth.test2'), False)

src/d/j/django-permission-backend-nonrel-HEAD/permission_backend_nonrel/tests.py   django-permission-backend-nonrel(Download)
from .models import UserPermissionList, \
     GroupPermissionList
from .utils import add_permission_to_user, \
     add_user_to_group, add_permission_to_group, update_permissions_user, update_user_groups, update_permissions_group
 
 
        # add a permission
        update_permissions_user([perm], user)
        self.assertEqual(UserPermissionList.objects.count(), 1)
        pl = UserPermissionList.objects.all()[0]
        # add a duplicated permission
        user = User.objects.get(username='test')
        update_permissions_user([perm], user)
        self.assertEqual(UserPermissionList.objects.count(), 1)
        pl = UserPermissionList.objects.all()[0]
        self.assertEqual(user.has_perm('auth.test2'), False)
        user = User.objects.get(username='test')
        update_permissions_user([perm1, perm2, perm], user)
        self.assertEqual(user.has_perm('auth.test1'), True)
        self.assertEqual(user.has_perm('auth.test2'), True)
        user = User.objects.get(username='test')
        pl = UserPermissionList.objects.all()[0]
        update_permissions_user([perm], user)
        self.assertEqual(user.has_perm('auth.test1'), False)
        self.assertEqual(user.has_perm('auth.test2'), False)