Discord Permission integration
jchristgit opened this issue · 0 comments
jchristgit commented
Django brings a feature-rich User authentication system that is also used by django-allauth
(see my fork). Currently, all the integration we have with this is checking whether a user is logged in through user.is_authenticated
. This is a bit sparse.
When a user is logged in, his permissions from the Discord server should be synchronized to the permissions of Django's user model:
user.is_member
should beTrue
if the associated Discord account is part of our Discord and has theMember
role. We can check this by testing the user's permission bit flags against0x10000
- that is, "Read Message History".user.is_superuser
should beTrue
if the user has theStaff
role on the Discord. Can be checked by using the0x8
bit flag against the user's permission bit flags.
This can most likely be done through further customizing the DefaultSocialAccountAdapter
of django-allauth
on my fork - see this for further details.
An alternative for messing with the user attributes would be custom permissions, which are also supported by Django's authentication system.