Commit f8947890 authored by matejcik's avatar matejcik

style changes

parent 701f54a7
......@@ -27,6 +27,7 @@ from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Group
from weblate.lang.models import Language
class GroupACL(models.Model):
groups = models.ManyToManyField(Group)
......
......@@ -117,11 +117,11 @@ def can_edit(user, translation, permission):
if not has_group_perm(user, translation, permission):
return False
if translation.is_template() \
and not has_group_perm(user, translation, 'trans.save_template'):
and not has_group_perm(user, translation, 'trans.save_template'):
return False
if (translation.subproject.suggestion_voting and
translation.subproject.suggestion_autoaccept > 0 and
not has_group_perm(user, translation, 'trans.override_suggestion')):
if (not has_group_perm(user, translation, 'trans.override_suggestion') and
translation.subproject.suggestion_voting and
translation.subproject.suggestion_autoaccept > 0):
return False
return True
......@@ -177,7 +177,7 @@ def can_vote_suggestion(user, translation):
if not has_group_perm(user, translation, 'trans.vote_suggestion'):
return False
if translation.is_template() \
and not has_group_perm(user, translation, 'trans.save_template'):
and not has_group_perm(user, translation, 'trans.save_template'):
return False
return True
......
......@@ -107,8 +107,6 @@ class GroupACLTest(ModelTestCase):
self.group.permissions.add(self.permission)
self.privileged.groups.add(self.group)
def test_acl_lockout(self):
self.assertTrue(can_edit(self.user, self.trans, self.PERMISSION))
self.assertTrue(can_edit(self.privileged, self.trans, self.PERMISSION))
......@@ -123,8 +121,14 @@ class GroupACLTest(ModelTestCase):
acl_lang = GroupACL.objects.create(language=self.language)
acl_lang.groups.add(self.group)
self.assertTrue(can_edit(self.privileged, self.trans, self.PERMISSION))
self.assertTrue(
can_edit(self.privileged, self.trans, self.PERMISSION))
acl_sub = GroupACL.objects.create(subproject=self.subproject)
self.assertFalse(
can_edit(self.privileged, self.trans, self.PERMISSION))
acl_sub.groups.add(self.group)
self.assertTrue(
can_edit(self.privileged, self.trans, self.PERMISSION))
self.assertFalse(can_edit(self.privileged, self.trans, self.PERMISSION))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment