コード例 #1
0
ファイル: project.py プロジェクト: MechanisM/Green-Mine
    def test_has_multiple_permissions(self):
        user = User.objects.create(
            username = '******',
            email = '*****@*****.**',
            is_active = True,
            is_staff = False,
            is_superuser = False,
        )

        project = Project.objects.create(name='test1', description='test1', owner=user, slug='test1')
        role = perms.get_role('developer')

        pur = ProjectUserRole.objects.create(
            project = project,
            user = user,
            role = role,
        )

        self.assertTrue(perms.has_perms(user, project, [
            ('project', 'view'),
            ('milestone', 'view'),
            ('userstory', 'view'),
        ]))
コード例 #2
0
ファイル: generic.py プロジェクト: MechanisM/Green-Mine
 def check_role(self, user, project, perms, exception=PermissionDeniedException):
     ok = permissions.has_perms(user, project, perms)
     if exception is not None and not ok:
         raise exception()
     return ok
コード例 #3
0
def check_role(context, loc, perms):
    project, user, perms = context['project'], context['user'], perms.split(",")
    return permissions.has_perms(user, project, (loc, perms))