Ejemplo n.º 1
0
    def test_project_specific(self):
        '''
        Project specificity test.
        Project-level actions should only be affected by Group ACLs that
        are specific to the project, and don't have other criteria.
        E.g., if a GroupACL lists project+language, this should not give
        you project-level permissions.
        '''
        permission = Permission.objects.get(
            codename='author_translation', content_type__app_label='trans'
        )
        self.group.permissions.add(permission)

        acl_project_lang = GroupACL.objects.create(
            language=self.language,
            project=self.project
        )
        acl_project_lang.groups.add(self.group)

        self.assertFalse(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))

        acl_project_only = GroupACL.objects.create(project=self.project)
        acl_project_only.groups.add(self.group)
        self.clear_permission_cache()

        self.assertTrue(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))
Ejemplo n.º 2
0
    def test_project_specific(self):
        '''
        Project specificity test.
        Project-level actions should only be affected by Group ACLs that
        are specific to the project, and don't have other criteria.
        E.g., if a GroupACL lists project+language, this should not give
        you project-level permissions.
        '''
        permission = Permission.objects.get(
            codename='author_translation', content_type__app_label='trans'
        )
        self.group.permissions.add(permission)

        acl_project_lang = GroupACL.objects.create(
            language=self.language,
            project=self.project
        )
        acl_project_lang.groups.add(self.group)

        self.assertFalse(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))

        acl_project_only = GroupACL.objects.create(project=self.project)
        acl_project_only.groups.add(self.group)

        self.assertTrue(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))
Ejemplo n.º 3
0
    def test_project_specific(self):
        permission = Permission.objects.get(codename='author_translation',
                                            content_type__app_label='trans')
        self.group.permissions.add(permission)

        acl_project_lang = GroupACL.objects.create(language=self.language,
                                                   project=self.project)
        acl_project_lang.groups.add(self.group)

        self.assertFalse(
            check_permission(self.privileged, self.project,
                             'trans.author_translation'))

        acl_project_only = GroupACL.objects.create(project=self.project)
        acl_project_only.groups.add(self.group)

        self.assertTrue(
            check_permission(self.privileged, self.project,
                             'trans.author_translation'))
Ejemplo n.º 4
0
    def test_project_specific(self):
        permission = Permission.objects.get(
            codename='author_translation', content_type__app_label='trans'
        )
        self.group.permissions.add(permission)

        acl_project_lang = GroupACL.objects.create(
            language=self.language,
            project=self.project
        )
        acl_project_lang.groups.add(self.group)

        self.assertFalse(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))

        acl_project_only = GroupACL.objects.create(project=self.project)
        acl_project_only.groups.add(self.group)

        self.assertTrue(check_permission(
            self.privileged, self.project, 'trans.author_translation'
        ))
Ejemplo n.º 5
0
 def test_check_user(self):
     self.assertFalse(
         check_permission(
             self.user, self.project, 'trans.author_translation'
         )
     )
Ejemplo n.º 6
0
 def test_check_owner(self):
     self.assertTrue(
         check_permission(
             self.owner, self.project, 'trans.author_translation'
         )
     )
Ejemplo n.º 7
0
 def test_check_user(self):
     self.assertFalse(
         check_permission(
             self.user, self.project, 'trans.author_translation'
         )
     )
Ejemplo n.º 8
0
 def test_check_owner(self):
     self.assertTrue(
         check_permission(
             self.owner, self.project, 'trans.author_translation'
         )
     )