1

Topic: How to add a custom service in iRedAdmin-Pro

==== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in: LDAP
- Linux/BSD distribution name and version: Debian wheezy
- Related log if you're reporting an issue:
====

I just upgrade from iRedAdmin-Pro-LDAP-2.1.1 to iRedAdmin-Pro-LDAP-2.1.2 and the changes i had made before following this tutorial : http://www.iredmail.org/wiki/index.php? … om.Service

do not works anymore.

I have this in /usr/share/apache2/iredadmin/libs/ldaplib/attrs.py :

# Services for normal user
USER_SERVICES_OF_NORMAL_USER = [
    'internal', 'doveadm', 'lib-storage', 'mail',
    'smtp', 'smtpsecured',
    'pop3', 'pop3secured',
    'imap', 'imapsecured',
    'deliver', 'lda', 'lmtp',
    'recipientbcc', 'senderbcc',
    'managesieve', 'managesievesecured', 'sieve', 'sievesecured',
    'forward', 'shadowaddress',
    'displayedInGlobalAddressBook',
    'jabber',
]

each mail account have a "jabber" field, but the jabber service does not appear in iRedadmin under "advanced" setting of email account.

What am i doing wrong ?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: How to add a custom service in iRedAdmin-Pro

ZhangHuangbin : iRedAdmin-Pro just not show it in 'Advanced' tab, but it should be stored there. Did you verify it?

I'm not sure to understand what you mean by "verify it". Of course i checked if my custom service "jabber" was displayed in the advanced tab of the mail account edit page. And my new custom service "jabber" never appear there.

3

Re: How to add a custom service in iRedAdmin-Pro

aliocha wrote:

I'm not sure to understand what you mean by "verify it". Of course i checked if my custom service "jabber" was displayed in the advanced tab of the mail account edit page. And my new custom service "jabber" never appear there.

iRedAdmin-Pro doesn't display custom services, this is right.
Did you export LDIF of this user to check whether it has custom service names? You can export account in LDIF format in user profile page, under tab "General" (search "ldif" or "export" please).

4

Re: How to add a custom service in iRedAdmin-Pro

Yes, all email accounts have my custom service :

enabledService: jabber


I added it manually with phpLDAPadmin.


I just recheck with the "Export account to LDIF" on one account.

5

Re: How to add a custom service in iRedAdmin-Pro

So, is it ok for you? Do you still need to show custom service names in iRedAdmin-Pro?

6 (edited by aliocha 2014-05-17 11:47:57)

Re: How to add a custom service in iRedAdmin-Pro

^^ No, it's not ok! I need to provide a way for my users to enable or disable the jabber service for each email account. I need the same behavior than before the upgrade of iRedadmin.

7

Re: How to add a custom service in iRedAdmin-Pro

Yes, i still need to show custom service names in iRedAdmin-Pro...

8

Re: How to add a custom service in iRedAdmin-Pro

i see.

Maybe a new setting parameter 'CUSTOM_ENABLED_SERVICES = []' in future release, customers can add all custom service names in this list (Python). For example:

CUSTOM_ENABLED_SERVICES = ['vpn', 'jabber']

9

Re: How to add a custom service in iRedAdmin-Pro

Yes, it can be a very thing to add this parameter in a future release. But why my custom service dos not display since the last upgrade ?

10

Re: How to add a custom service in iRedAdmin-Pro

As mentioned in previous reply, iRedAdmin-Pro doesn't display custom service names.
Will try to improve it in future release.

11 (edited by aliocha 2014-05-19 08:15:03)

Re: How to add a custom service in iRedAdmin-Pro

Well, i just wanted to know what changed between iRedAdmin-Pro-LDAP-2.1.1 and iRedAdmin-Pro-LDAP-2.1.2. Because my modifications, as described in my first post was working (and i followed a tutorial on the iredmail wiki). So, yes, iRedadmin-Pro can display custom services before the V2.1.1 (LDAP version).

For a 700€ pro license, your answers are quite disappointing...

I think i have to dig in your python code myself to figure out what happens and / or wait for the next release.

Thx anyway

12

Re: How to add a custom service in iRedAdmin-Pro

aliocha wrote:

For a 700€ pro license, your answers are quite disappointing...

I appreciate your purchase, but purchasing doesn't mean seller has to achieve all features buyer requested.
And i already said i will try to improve it in future release, hope it's ok for you.

13

Re: How to add a custom service in iRedAdmin-Pro

Yep, we agree, i didn't pay for extra features. Just, you know, maybe give a hand to your clients. Anyway, i will make a diff of the 2 versions myself and find out what changed, without any guidance from you, sadly. Have a nice day.

14

Re: How to add a custom service in iRedAdmin-Pro

With below patch, you can add custom service names in new parameter in iRedAdmin-Pro config file "settings.py". For example:

# iRedAdmin-Pro config file: settings.py
ADDITION_USER_SERVICES = ['vpn', 'jabber', 'ftp']

Restart Apache, then you can see custom services in user profile page, under tab "Advanced".

diff -r 6d6591e46b87 controllers/ldap/user.py
--- a/controllers/ldap/user.py    Tue May 20 11:01:48 2014 +0800
+++ b/controllers/ldap/user.py    Wed May 21 20:57:07 2014 +0800
@@ -279,6 +279,7 @@
             inbound_throttle_setting=inbound_throttle_setting,
             outbound_throttle_setting=outbound_throttle_setting,
             greylisted=greylisted,
+            addition_services=settings.ADDITION_USER_SERVICES,
             languagemaps=get_language_maps(),
             msg=i.get('msg', None),
         )
diff -r 6d6591e46b87 libs/default_settings.py
--- a/libs/default_settings.py    Tue May 20 11:01:48 2014 +0800
+++ b/libs/default_settings.py    Wed May 21 20:57:07 2014 +0800
@@ -123,7 +123,6 @@
 #   - without timestamp: domain.ltd/username/
 MAILDIR_APPEND_TIMESTAMP = True
 
-
 #######################################
 # OpenLDAP backend related settings.
 #
@@ -135,6 +134,11 @@
 # LDAP connection trace level. Must be an integer.
 LDAP_CONN_TRACE_LEVEL = 0
 
+# Addition values (in lower cases) for attribute 'enabledService'.
+# Values will be listed in user profile page, and will be added for newly
+# created mail users.
+ADDITION_USER_SERVICES = []
+
 #######################################
 # MySQL/PostgreSQL backends related settings.
 #
diff -r 6d6591e46b87 libs/ldaplib/user.py
--- a/libs/ldaplib/user.py    Tue May 20 11:01:48 2014 +0800
+++ b/libs/ldaplib/user.py    Wed May 21 20:57:07 2014 +0800
@@ -1035,7 +1035,7 @@
             # Enabled services.
             self.enabledService = [str(v)
                                    for v in data.get('enabledService', [])
-                                   if v in attrs.USER_SERVICES_OF_NORMAL_USER + ['domainadmin']]
+                                   if v in attrs.USER_SERVICES_OF_NORMAL_USER + ['domainadmin'] + settings.ADDITION_USER_SERVICES]
 
             # Append 'sieve', 'sievesecured' for dovecot-1.2.
             if 'managesieve' in self.enabledService:
diff -r 6d6591e46b87 templates/default/ldap/user/profile.html
--- a/templates/default/ldap/user/profile.html    Tue May 20 11:01:48 2014 +0800
+++ b/templates/default/ldap/user/profile.html    Wed May 21 20:57:07 2014 +0800
@@ -531,7 +531,10 @@
 
         {# Enabled services #}
         <div class="bt-space0">&nbsp;</div>
-        {{ display_enabled_services(accountType='user', enabledService=enabledService, greylisted=greylisted) }}
+        {{ display_enabled_services(accountType='user',
+                                    enabledService=enabledService,
+                                    additionServices=addition_services,
+                                    greylisted=greylisted) }}
 
         {# Maildir #}
         {% if session.get('is_global_admin') is sameas true %}
diff -r 6d6591e46b87 templates/default/macros/ldap.html
--- a/templates/default/macros/ldap.html    Tue May 20 11:01:48 2014 +0800
+++ b/templates/default/macros/ldap.html    Wed May 21 20:57:07 2014 +0800
@@ -61,7 +61,7 @@
     - accountType: domain, admin, user, maillist, alias.
     - enabledService: list of all enabled services.
 #}
-{% macro display_enabled_services(accountType, enabledService, greylisted=false) -%}
+{% macro display_enabled_services(accountType, enabledService, additionServices=[], greylisted=false) -%}
     {# Set list of available services for different account types.
         Format:
             [
@@ -128,9 +128,17 @@
                 <h4 class="size-250 fl-space">&nbsp;</h4>
             {% endif %}
             <div class="form-checkbox-item clear">
-                <input type="{{ srv[0] }}" name="enabledService" value="{{ srv[1] }}" {% if srv[1] in enabledService  or srv[1] |lower in enabledService %}checked{%endif%} class="{{ srv[0] }} fl-space" rel="checkboxhorizont" />
+                <input type="{{ srv[0] }}" name="enabledService" value="{{ srv[1] }}" {% if srv[1] in enabledService or srv[1] |lower in enabledService %}checked{%endif%} class="{{ srv[0] }} fl-space" rel="checkboxhorizont" />
                 <label>{{ srv[2] }}</label>
             </div>
         {% endfor %}
+
+        {% for srv in additionServices %}
+            <h4 class="size-250 fl-space">&nbsp;</h4>
+            <div class="form-checkbox-item clear">
+                <input type="checkbox" name="enabledService" value="{{ srv }}" {% if srv in enabledService or srv |lower in enabledService %}checked{%endif%} class="{{ srv }} fl-space" rel="checkboxhorizont" />
+                <label>{{ srv }}</label>
+            </div>
+        {% endfor %}
 {%- endmacro %}

NOTE: This patch is for iRedAdmin-Pro-LDAP-2.1.2. And it doesn't work for iRedAdmin-Pro for MySQL/PostgreSQL edition.

15

Re: How to add a custom service in iRedAdmin-Pro

Thank you very much. I'll try your patch as soon as possible then tell you if it's ok.
Thx again.

16

Re: How to add a custom service in iRedAdmin-Pro

Thanks for this extra feature Zhang! It really helped me out.
I'm using ownCloud with LDAP authentication and now I can give access to users from just one interface.

I hope it wil stay in future releases of iRedAdmin-Pro!

17

Re: How to add a custom service in iRedAdmin-Pro

Jeronymus wrote:

I hope it wil stay in future releases of iRedAdmin-Pro!

Sure thing.

18

Re: How to add a custom service in iRedAdmin-Pro

I just applied the patch, it works well. Thank you. I also hope that this feature will be in the next releases. Like Jeronymus, i use LDAP authentification of my iredmail users for many other services, as ejabberd, owncloud, radicale (Caldav & Cardav server).