Ejemplo n.º 1
0
    def test_perm_is_defined_on(self):
        """Test permission relationship

        Test whether we check for permission relationship, independent
        of whether the permission is actually assigned to anyone.
        """
        perm = 'forums_forum.view_in_forum'
        assert access.perm_is_defined_on(perm, Forum.objects.get(pk=3))
        assert not access.perm_is_defined_on(perm, Forum.objects.get(pk=2))
Ejemplo n.º 2
0
    def test_perm_is_defined_on(self):
        """Test permission relationship

        Test whether we check for permission relationship, independent
        of whether the permission is actually assigned to anyone.
        """
        from kitsune.forums.tests import forum, restricted_forum
        f1 = restricted_forum()
        f2 = forum(save=True)
        perm = 'forums_forum.view_in_forum'
        assert access.perm_is_defined_on(perm, f1)
        assert not access.perm_is_defined_on(perm, f2)
Ejemplo n.º 3
0
    def test_perm_is_defined_on(self):
        """Test permission relationship

        Test whether we check for permission relationship, independent
        of whether the permission is actually assigned to anyone.
        """
        from kitsune.forums.tests import forum, restricted_forum
        f1 = restricted_forum()
        f2 = forum(save=True)
        perm = 'forums_forum.view_in_forum'
        assert access.perm_is_defined_on(perm, f1)
        assert not access.perm_is_defined_on(perm, f2)
Ejemplo n.º 4
0
    def test_perm_is_defined_on(self):
        """Test permission relationship

        Test whether we check for permission relationship, independent
        of whether the permission is actually assigned to anyone.
        """
        from kitsune.forums.tests import ForumFactory, RestrictedForumFactory

        f1 = RestrictedForumFactory()
        f2 = ForumFactory()
        perm = "forums_forum.view_in_forum"
        assert access.perm_is_defined_on(perm, f1)
        assert not access.perm_is_defined_on(perm, f2)
Ejemplo n.º 5
0
    def _allows_public_viewing(self):
        """Return whether I am a world-readable forum.

        If a django-authority permission relates to me, I am considered non-
        public. (We assume that you attached a permission to me in order to
        assign it to some users or groups.) Considered adding a Public flag to
        this model, but we didn't want it to show up on form and thus be
        accidentally flippable by readers of the Admin forum, who are all
        privileged enough to do so.

        """
        return not perm_is_defined_on('forums_forum.view_in_forum', self)
Ejemplo n.º 6
0
    def _allows_public_viewing(self):
        """Return whether I am a world-readable forum.

        If a django-authority permission relates to me, I am considered non-
        public. (We assume that you attached a permission to me in order to
        assign it to some users or groups.) Considered adding a Public flag to
        this model, but we didn't want it to show up on form and thus be
        accidentally flippable by readers of the Admin forum, who are all
        privileged enough to do so.

        """
        return not perm_is_defined_on('forums_forum.view_in_forum', self)
Ejemplo n.º 7
0
 def _allows_public_posting(self):
     """Return whether I am a world-writable forum."""
     return not perm_is_defined_on('forums_forum.post_in_forum', self)
Ejemplo n.º 8
0
 def _allows_public_posting(self):
     """Return whether I am a world-writable forum."""
     return not perm_is_defined_on('forums_forum.post_in_forum', self)