forked from mirrors/bookwyrm
Make users editors by default
This commit is contained in:
parent
3ecdc8f93e
commit
54687b7b35
1 changed files with 4 additions and 1 deletions
|
@ -3,7 +3,7 @@ import re
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser, Group
|
||||||
from django.core.validators import MinValueValidator
|
from django.core.validators import MinValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
@ -208,6 +208,9 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
# an id needs to be set before we can proceed with related models
|
# an id needs to be set before we can proceed with related models
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
# make users editors by default
|
||||||
|
self.groups.add(Group.objects.get(name='editor'))
|
||||||
|
|
||||||
# create keys and shelves for new local users
|
# create keys and shelves for new local users
|
||||||
self.key_pair = KeyPair.objects.create(
|
self.key_pair = KeyPair.objects.create(
|
||||||
remote_id='%s/#main-key' % self.remote_id)
|
remote_id='%s/#main-key' % self.remote_id)
|
||||||
|
|
Loading…
Reference in a new issue