define User.is_sftp_user and fix minor template issues
This commit is contained in:
parent
b98b05220f
commit
cff35dd408
2 changed files with 6 additions and 2 deletions
|
@ -266,6 +266,10 @@ class User(TimeStampedModel, models.Model):
|
|||
_LOGGER.info("set LDAP password for %s", dn)
|
||||
return True
|
||||
|
||||
def is_sftp_user(self):
|
||||
return self.additionalgroup_set.filter(
|
||||
group__groupname=settings.OSUSER_SFTP_GROUP
|
||||
).exists()
|
||||
|
||||
@transaction.atomic
|
||||
def save(self, *args, **kwargs):
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{% endwith %}
|
||||
<dt>{% trans "Mailboxes" %}</dt>
|
||||
<dd>{% blocktrans with num=hostingpackage.used_mailbox_count total=hostingpackage.mailbox_count %}{{ num }} of {{ total }} in use{% endblocktrans %} <span class="glyphicon
|
||||
glyphicon-info-sign" title="{% blocktrans with mailboxes=hostingpackage.mailboxcount %}The package provides {{ mailboxcount }} mailboxes the difference comes from mailbox options.{% endblocktrans %}"></span></dd>
|
||||
glyphicon-info-sign" title="{% blocktrans with mailboxcount=hostingpackage.mailboxcount %}The package provides {{ mailboxcount }} mailboxes the difference comes from mailbox options.{% endblocktrans %}"></span></dd>
|
||||
<dt>{% if osuser.is_sftp_user %}{% trans "SFTP username" %}{% else %}{% trans "SSH/SFTP username" %}{% endif %}</dt>
|
||||
<dd>{{ osuser.username }}</dd>
|
||||
<dt>{% trans "Upload server" %}</dt>
|
||||
|
@ -67,7 +67,7 @@
|
|||
<div class="panel-heading">{% trans "Hosting Package Actions" %}</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><a href="#" title="{% trans "Edit Hosting Package Description" %}">{% trans "Edit description" %}</a></li>
|
||||
<li class="list-group-item"><a href="{% url "set_osuser_password" slug=osuser.username %}">{% if osuser.is_sftp %}{% trans "Set SFTP password" %}{% else %}{% trans "Set SSH/SFTP password" %}{% endif %}</a></li>
|
||||
<li class="list-group-item"><a href="{% url "set_osuser_password" slug=osuser.username %}">{% if osuser.is_sftp_user %}{% trans "Set SFTP password" %}{% else %}{% trans "Set SSH/SFTP password" %}{% endif %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue