Disambiguation in kfet's permission handling

In some places we used to refer to permissions based on their codename
only (the part after the dot "." in the following examples) which can be
ambiguous. Typically, we might define permissions like "bds.is_team" or
"cof.is_team" in the near future ;)
This commit is contained in:
Martin Pépin 2019-12-21 16:26:59 +01:00
parent 67e28c704f
commit 64c792b11f
No known key found for this signature in database
GPG key ID: E7520278B1774448
5 changed files with 37 additions and 25 deletions

View file

@ -18,7 +18,7 @@ class TestStats(TestCase):
user.set_password("foobar")
user.save()
Account.objects.create(trigramme="FOO", cofprofile=user.profile)
perm = Permission.objects.get(codename="is_team")
perm = Permission.objects.get_by_natural_key("is_team", "kfet", "account")
user.user_permissions.add(perm)
user2 = User.objects.create(username="Barfoo")