mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-10-18 19:26:45 +02:00
Compare commits
2 Commits
oauth2
...
translatio
Author | SHA1 | Date | |
---|---|---|---|
|
7e664c2d4e | ||
|
95fa3c1bc9 |
@@ -39,15 +39,7 @@ class PermissionBackend(ModelBackend):
|
|||||||
|
|
||||||
def permission_filter(membership_obj):
|
def permission_filter(membership_obj):
|
||||||
query = Q(pk=-1)
|
query = Q(pk=-1)
|
||||||
if 'mask' in request.GET:
|
|
||||||
try:
|
|
||||||
rank = int(request.GET['mask'])
|
|
||||||
except:
|
|
||||||
rank = 42
|
|
||||||
query &= Q(mask__rank__lte=rank)
|
|
||||||
for scope in request.auth.scope.split(' '):
|
for scope in request.auth.scope.split(' '):
|
||||||
if scope == "openid":
|
|
||||||
continue
|
|
||||||
permission_id, club_id = scope.split('_')
|
permission_id, club_id = scope.split('_')
|
||||||
if int(club_id) == membership_obj.club_id:
|
if int(club_id) == membership_obj.club_id:
|
||||||
query |= Q(pk=permission_id)
|
query |= Q(pk=permission_id)
|
||||||
|
@@ -10,7 +10,6 @@ from note_kfet.middlewares import get_current_request
|
|||||||
from .backends import PermissionBackend
|
from .backends import PermissionBackend
|
||||||
from .models import Permission
|
from .models import Permission
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
class PermissionScopes(BaseScopes):
|
class PermissionScopes(BaseScopes):
|
||||||
"""
|
"""
|
||||||
@@ -33,7 +32,7 @@ class PermissionScopes(BaseScopes):
|
|||||||
|
|
||||||
scopes = {f"{p.id}_{club.id}": f"{p.description} (club {club.name})"
|
scopes = {f"{p.id}_{club.id}": f"{p.description} (club {club.name})"
|
||||||
for p in Permission.objects.all() for club in Club.objects.all()}
|
for p in Permission.objects.all() for club in Club.objects.all()}
|
||||||
scopes['openid'] = _("OpenID Connect (username and email)")
|
scopes['openid'] = "OpenID Connect"
|
||||||
return scopes
|
return scopes
|
||||||
|
|
||||||
def get_available_scopes(self, application=None, request=None, *args, **kwargs):
|
def get_available_scopes(self, application=None, request=None, *args, **kwargs):
|
||||||
|
@@ -4399,7 +4399,7 @@ msgstr "Géré par le BDE"
|
|||||||
|
|
||||||
#: note_kfet/templates/base.html:231
|
#: note_kfet/templates/base.html:231
|
||||||
msgid "Hosted by Cr@ns"
|
msgid "Hosted by Cr@ns"
|
||||||
msgstr "Hébergé par le Cr@ans"
|
msgstr "Hébergé par le Cr@ns"
|
||||||
|
|
||||||
#: note_kfet/templates/base.html:273
|
#: note_kfet/templates/base.html:273
|
||||||
msgid "The note is not available for now"
|
msgid "The note is not available for now"
|
||||||
|
Reference in New Issue
Block a user