Merge branch 'master' into sso
This commit is contained in:
commit
42ef28d3ee
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -7,3 +7,6 @@
|
||||||
local_settings.py
|
local_settings.py
|
||||||
build
|
build
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
/.Trash*
|
||||||
|
/.git
|
||||||
|
/.idea
|
||||||
|
|
|
@ -58,12 +58,12 @@ class DatabaseForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class DatabaseCreationForm(DatabaseUserCreationForm):
|
class DatabaseCreationForm(DatabaseUserCreationForm):
|
||||||
username = forms.CharField(label=_("Username"), max_length=16,
|
username = forms.CharField(label=_("Username"), max_length=32,
|
||||||
required=False, validators=[validators.validate_name],
|
required=False, validators=[validators.validate_name],
|
||||||
help_text=_("Required. 16 characters or fewer. Letters, digits and "
|
help_text=_("Required. 32 characters or fewer. Letters, digits and "
|
||||||
"@/./+/-/_ only."),
|
"@/./+/-/_ only."),
|
||||||
error_messages={
|
error_messages={
|
||||||
'invalid': _("This value may contain 16 characters or fewer, only letters, numbers and "
|
'invalid': _("This value may contain 32 characters or fewer, only letters, numbers and "
|
||||||
"@/./+/-/_ characters.")})
|
"@/./+/-/_ characters.")})
|
||||||
user = forms.ModelChoiceField(required=False, queryset=DatabaseUser.objects)
|
user = forms.ModelChoiceField(required=False, queryset=DatabaseUser.objects)
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,8 @@ class MailboxAdmin(ChangePasswordAdminMixin, SelectAccountAdminMixin, ExtendedMo
|
||||||
old = Mailbox.objects.get(pk=obj.pk)
|
old = Mailbox.objects.get(pk=obj.pk)
|
||||||
if old.custom_filtering != obj.custom_filtering:
|
if old.custom_filtering != obj.custom_filtering:
|
||||||
messages.warning(request, msg)
|
messages.warning(request, msg)
|
||||||
|
# pass var to the backend so you don't change the password
|
||||||
|
obj.changepass = None
|
||||||
elif obj.custom_filtering:
|
elif obj.custom_filtering:
|
||||||
messages.warning(request, msg)
|
messages.warning(request, msg)
|
||||||
super(MailboxAdmin, self).save_model(request, obj, form, change)
|
super(MailboxAdmin, self).save_model(request, obj, form, change)
|
||||||
|
|
|
@ -69,6 +69,7 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
||||||
self.append(textwrap.dedent("""
|
self.append(textwrap.dedent("""
|
||||||
# Update/create %(user)s user state
|
# Update/create %(user)s user state
|
||||||
if id %(user)s ; then
|
if id %(user)s ; then
|
||||||
|
if [[ "%(changepass)s" == "True" ]]; then
|
||||||
old_password=$(getent shadow %(user)s | cut -d':' -f2)
|
old_password=$(getent shadow %(user)s | cut -d':' -f2)
|
||||||
usermod %(user)s \\
|
usermod %(user)s \\
|
||||||
--shell %(initial_shell)s \\
|
--shell %(initial_shell)s \\
|
||||||
|
@ -77,6 +78,7 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
||||||
# Postfix SASL caches passwords
|
# Postfix SASL caches passwords
|
||||||
RESTART_POSTFIX=1
|
RESTART_POSTFIX=1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
useradd %(user)s \\
|
useradd %(user)s \\
|
||||||
--home %(home)s \\
|
--home %(home)s \\
|
||||||
|
@ -135,6 +137,11 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
||||||
super().commit()
|
super().commit()
|
||||||
|
|
||||||
def get_context(self, mailbox):
|
def get_context(self, mailbox):
|
||||||
|
# Check if you have to change password
|
||||||
|
try:
|
||||||
|
changepass = mailbox.changepass
|
||||||
|
except:
|
||||||
|
changepass = True
|
||||||
context = {
|
context = {
|
||||||
'user': mailbox.name,
|
'user': mailbox.name,
|
||||||
'group': mailbox.name,
|
'group': mailbox.name,
|
||||||
|
@ -144,6 +151,7 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
||||||
'maildir': os.path.join(mailbox.get_home(), 'Maildir'),
|
'maildir': os.path.join(mailbox.get_home(), 'Maildir'),
|
||||||
'initial_shell': self.SHELL,
|
'initial_shell': self.SHELL,
|
||||||
'banner': self.get_banner(),
|
'banner': self.get_banner(),
|
||||||
|
'changepass': changepass,
|
||||||
}
|
}
|
||||||
context['deleted_home'] = settings.MAILBOXES_MOVE_ON_DELETE_PATH % context
|
context['deleted_home'] = settings.MAILBOXES_MOVE_ON_DELETE_PATH % context
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -19,7 +19,7 @@ class NextCloudAPIMixin(object):
|
||||||
def validate_response(self, response):
|
def validate_response(self, response):
|
||||||
request = response.request
|
request = response.request
|
||||||
context = (request.method, response.url, request.body, response.status_code)
|
context = (request.method, response.url, request.body, response.status_code)
|
||||||
sys.stderr.write("%s %s '%s' HTTP %s\n" % context)
|
# sys.stderr.write("%s %s '%s' HTTP %s\n" % context)
|
||||||
if response.status_code != requests.codes.ok:
|
if response.status_code != requests.codes.ok:
|
||||||
raise RuntimeError("%s %s '%s' HTTP %s" % context)
|
raise RuntimeError("%s %s '%s' HTTP %s" % context)
|
||||||
root = ET.fromstring(response.text)
|
root = ET.fromstring(response.text)
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
# migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -25,7 +25,7 @@ class Migration(migrations.Migration):
|
||||||
('directory', models.CharField(blank=True, help_text="Optional directory relative to user's home.", max_length=256, verbose_name='directory')),
|
('directory', models.CharField(blank=True, help_text="Optional directory relative to user's home.", max_length=256, verbose_name='directory')),
|
||||||
('shell', models.CharField(choices=[('/dev/null', 'No shell, FTP only'), ('/bin/rssh', 'No shell, SFTP/RSYNC only'), ('/usr/bin/git-shell', 'No shell, GIT only'), ('/bin/bash', '/bin/bash')], default='/dev/null', max_length=32, verbose_name='shell')),
|
('shell', models.CharField(choices=[('/dev/null', 'No shell, FTP only'), ('/bin/rssh', 'No shell, SFTP/RSYNC only'), ('/usr/bin/git-shell', 'No shell, GIT only'), ('/bin/bash', '/bin/bash')], default='/dev/null', max_length=32, verbose_name='shell')),
|
||||||
('is_active', models.BooleanField(default=True, help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
('is_active', models.BooleanField(default=True, help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
||||||
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='systemusers', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
# ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='systemusers', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
||||||
('groups', models.ManyToManyField(blank=True, help_text='A new group will be created for the user. Which additional groups would you like them to be a member of?', to='systemusers.SystemUser')),
|
('groups', models.ManyToManyField(blank=True, help_text='A new group will be created for the user. Which additional groups would you like them to be a member of?', to='systemusers.SystemUser')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -6,5 +6,4 @@ from orchestra.admin.utils import admin_date
|
||||||
|
|
||||||
display_last_run_at = admin_date('last_run_at', short_description=_("Last run"))
|
display_last_run_at = admin_date('last_run_at', short_description=_("Last run"))
|
||||||
|
|
||||||
|
|
||||||
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')
|
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')
|
Loading…
Reference in a new issue