Skip to content

Commit

Permalink
Allow overriding the authlib roles
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Sep 16, 2023
1 parent 88c6298 commit 7098e7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion authlib/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from functools import partial

from django import forms
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db import models
from django.utils.translation import gettext_lazy as _
Expand All @@ -14,7 +15,7 @@ def allow_deny_globs(user, perm, obj, allow=(), deny=()):
return any(fnmatch(perm, rule) for rule in allow)


AUTHLIB_ROLES = {
DEFAULT_ROLES = {
"default": {
"title": _("default"),
},
Expand All @@ -32,6 +33,7 @@ def allow_deny_globs(user, perm, obj, allow=(), deny=()):
),
},
}
AUTHLIB_ROLES = getattr(settings, "AUTHLIB_ROLES", DEFAULT_ROLES)


class RoleField(models.CharField):
Expand Down

0 comments on commit 7098e7c

Please sign in to comment.