Merge branch 'main' into authorized-fetch
This commit is contained in:
commit
f4de00088f
46 changed files with 685 additions and 27 deletions
|
@ -25,6 +25,10 @@ class Author(BookDataModel):
|
|||
isfdb = fields.CharField(
|
||||
max_length=255, blank=True, null=True, deduplication_field=True
|
||||
)
|
||||
|
||||
website = fields.CharField(
|
||||
max_length=255, blank=True, null=True, deduplication_field=True
|
||||
)
|
||||
# idk probably other keys would be useful here?
|
||||
born = fields.DateTimeField(blank=True, null=True)
|
||||
died = fields.DateTimeField(blank=True, null=True)
|
||||
|
|
|
@ -3,6 +3,7 @@ import datetime
|
|||
from urllib.parse import urljoin
|
||||
import uuid
|
||||
|
||||
import django.contrib.auth.models as auth_models
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import models, IntegrityError
|
||||
from django.dispatch import receiver
|
||||
|
@ -70,6 +71,9 @@ class SiteSettings(SiteModel):
|
|||
allow_invite_requests = models.BooleanField(default=True)
|
||||
invite_request_question = models.BooleanField(default=False)
|
||||
require_confirm_email = models.BooleanField(default=True)
|
||||
default_user_auth_group = models.ForeignKey(
|
||||
auth_models.Group, null=True, blank=True, on_delete=models.PROTECT
|
||||
)
|
||||
|
||||
invite_question_text = models.CharField(
|
||||
max_length=255, blank=True, default="What is your favourite book?"
|
||||
|
@ -90,6 +94,8 @@ class SiteSettings(SiteModel):
|
|||
|
||||
# controls
|
||||
imports_enabled = models.BooleanField(default=True)
|
||||
import_size_limit = models.IntegerField(default=0)
|
||||
import_limit_reset = models.IntegerField(default=0)
|
||||
|
||||
field_tracker = FieldTracker(fields=["name", "instance_tagline", "logo"])
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import re
|
|||
from urllib.parse import urlparse
|
||||
|
||||
from django.apps import apps
|
||||
from django.contrib.auth.models import AbstractUser, Group
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.contrib.postgres.fields import ArrayField, CICharField
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
|
||||
from django.dispatch import receiver
|
||||
from django.db import models, transaction
|
||||
from django.utils import timezone
|
||||
|
@ -356,8 +356,14 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
|
||||
# make users editors by default
|
||||
try:
|
||||
self.groups.add(Group.objects.get(name="editor"))
|
||||
except Group.DoesNotExist:
|
||||
group = (
|
||||
apps.get_model("bookwyrm.SiteSettings")
|
||||
.objects.get()
|
||||
.default_user_auth_group
|
||||
)
|
||||
if group:
|
||||
self.groups.add(group)
|
||||
except ObjectDoesNotExist:
|
||||
# this should only happen in tests
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue