1 (edited by dorpha 2015-01-28 22:29:44)

Topic: User/Empolyee ID , Job Title/Responsibility in User won't get updated

======== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  LDAP
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
====

If we put in something in the User/Employee ID , Job Title/Responsibility fields, save it; then clear these fields up (empty them) later on, save it again -- you'll find out that the last info will still be there:

Post's attachments

bug.png
bug.png 21.39 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

----

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

2

Re: User/Empolyee ID , Job Title/Responsibility in User won't get updated

Sorry about this trouble. I can reproduce this bug. Will come back to you later with a fix.

3

Re: User/Empolyee ID , Job Title/Responsibility in User won't get updated

Fixed. here is patch for iRedAdmin-Pro-LDAP-2.2.1. if you're not familiar with patch, i can send you patched version, then you upgrade to patched version by following this short tutorial:
http://www.iredmail.org/docs/migrate.or … admin.html

Note: it's bug that iRedAdmin-Pro cannot save empty value of "User/Employee ID", "Job title", "Mobile". But it's not bug in "Display Name", "First Name", "Last Name", LDAP requires these 3 attributes, and if you submit an empty value, iRedAdmin-Pro will set its value to username part of email address. With this patch, iRedAdmin-Pro will show empty value if its value is same as username part of email address.

diff -r 247d2bd24370 templates/default/ldap/user/profile.html
--- a/templates/default/ldap/user/profile.html    Mon Jan 26 23:11:24 2015 +0800
+++ b/templates/default/ldap/user/profile.html    Thu Jan 29 00:15:41 2015 +0800
@@ -195,7 +195,9 @@
                                     tooltip=_('Full name'),
                                     show_first_last_name=true,
                                     first_name=first_name,
-                                    last_name=last_name) }}
+                                    last_name=last_name,
+                                    email=mail,
+                                    empty_if_equal_to_username=true) }}
                 {{ display_preferred_language(value=entries.get('preferredLanguage', ['en_US'])[0], languagemaps=languagemaps) }}
                 {{ display_quota(value=mailQuota, show_value_in_input=true, used_quota=usedQuota, show_used_quota=true) }}
 
diff -r 247d2bd24370 libs/ldaplib/ldaputils.py
--- a/libs/ldaplib/ldaputils.py    Mon Jan 26 23:11:24 2015 +0800
+++ b/libs/ldaplib/ldaputils.py    Thu Jan 29 00:17:30 2015 +0800
@@ -102,7 +102,7 @@
         if default:
             mod_attr = [(ldap.MOD_REPLACE, attr, default.encode('utf-8'))]
         else:
-            mod_attr = []
+            mod_attr = [(ldap.MOD_REPLACE, attr, None)]
 
     return mod_attr
 
diff -r 247d2bd24370 templates/default/macros/general.html
--- a/templates/default/macros/general.html    Mon Jan 26 23:11:24 2015 +0800
+++ b/templates/default/macros/general.html    Thu Jan 29 00:52:19 2015 +0800
@@ -744,11 +744,28 @@
                           size="size-250",
                           show_first_last_name=false,
                           first_name='',
-                          last_name='') -%}
+                          last_name='',
+                          email='',
+                          empty_if_equal_to_username=true) -%}
     {% if cn is sameas none %}
         {% set cn = '' %}
     {% endif %}
 
+    {% if accountType == 'user' %}
+        {% set username = email.split('@', 1)[0] %}
+        {% if cn == username and empty_if_equal_to_username %}
+            {% set cn = '' %}
+        {% endif %}
+
+        {% if first_name == username and empty_if_equal_to_username %}
+            {% set first_name = '' %}
+        {% endif %}
+
+        {% if last_name == username and empty_if_equal_to_username %}
+            {% set last_name = '' %}
+        {% endif %}
+    {% endif %}
+
     <div class="form-field clear">
         {% if accountType == 'domain' %}
             <h4 class="{{ size }} fl-space">{{ _('Company/Organization Name') }}</h4>

4 (edited by dorpha 2015-01-29 06:34:51)

Re: User/Empolyee ID , Job Title/Responsibility in User won't get updated

Wow that was fast!
The patch fixed the problem, thanks.