social account admin group support
This commit is contained in:
@@ -85,5 +85,9 @@ class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
|
|||||||
Populate the user with data from the social account. Stub is kept in case
|
Populate the user with data from the social account. Stub is kept in case
|
||||||
global default permissions are implemented in the future.
|
global default permissions are implemented in the future.
|
||||||
"""
|
"""
|
||||||
# TODO: If default global permissions are implemented, should also be here
|
user = super().populate_user(request, sociallogin, data)
|
||||||
return super().populate_user(request, sociallogin, data) # pragma: no cover
|
groups = sociallogin.account.extra_data.get(settings.SOCIALACCOUNT_ADMIN_GROUP_SCOPE)
|
||||||
|
if groups:
|
||||||
|
if settings.SOCIALACCOUNT_ADMIN_GROUP in groups:
|
||||||
|
user.is_superuser = True
|
||||||
|
return user # pragma: no cover
|
||||||
|
|||||||
@@ -459,6 +459,8 @@ SOCIALACCOUNT_AUTO_SIGNUP = __get_boolean("PAPERLESS_SOCIAL_AUTO_SIGNUP")
|
|||||||
SOCIALACCOUNT_PROVIDERS = json.loads(
|
SOCIALACCOUNT_PROVIDERS = json.loads(
|
||||||
os.getenv("PAPERLESS_SOCIALACCOUNT_PROVIDERS", "{}"),
|
os.getenv("PAPERLESS_SOCIALACCOUNT_PROVIDERS", "{}"),
|
||||||
)
|
)
|
||||||
|
SOCIALACCOUNT_ADMIN_GROUP = os.getenv("PAPERLESS_SOCIALACCOUNT_ADMIN_GROUP", "admin")
|
||||||
|
SOCIALACCOUNT_ADMIN_GROUP_SCOPE = os.getenv("SOCIALACCOUNT_ADMIN_GROUP_SCOPE", "groups")
|
||||||
|
|
||||||
ACCOUNT_EMAIL_SUBJECT_PREFIX = "[Paperless-ngx] "
|
ACCOUNT_EMAIL_SUBJECT_PREFIX = "[Paperless-ngx] "
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user