1 (edited by 7t3chguy 2015-01-28 07:02:13)

Topic: New Roundcube Plugin - iRedMail MySQL Global Address Book

Would anyone be interested if I share a modified version of my own Global Address Book plugin? It basically builds an addressbook from all the entries in the vmail db through a view in the roundcube db. The addressbook is grouped by domain name and is read only, supports autocomplete, non-configurable.
Could add configuration options for stuff like name of Address Book.
My version also only lists all domains if the logged in user is part of specificdomain.com, for otherdomain.com it just lists *@specificdomain.com and *@otherdomain.com
[Use scenario is specificdomain.com is the company 'hosting' or managing the e-mail services of otherdomain.com, helps because otherdomain.com can't see all addresses of otherotherdomain.com]
[Does not support Aliases, etc. If this is a wished upon feature then I could add it as a configurable option]

First Release: https://github.com/t3chguy/webdevguru_s … s/releases

----

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

2

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

This plugin was requested by many iRedMail users before, it's so glad that you have one and willing to share it in public. smile

3

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

7t3chguy wrote:

Would anyone be interested if I share a modified version of my own Global Address Book plugin? It basically builds an addressbook from all the entries in the vmail db through a view in the roundcube db. The addressbook is grouped by domain name and is read only, supports autocomplete, non-configurable.
Could add configuration options for stuff like name of Address Book.
My version also only lists all domains if the logged in user is part of specificdomain.com, for otherdomain.com it just lists *@specificdomain.com and *@otherdomain.com
[Use scenario is specificdomain.com is the company 'hosting' or managing the e-mail services of otherdomain.com, helps because otherdomain.com can't see all addresses of otherotherdomain.com]
[Does not support Aliases, etc. If this is a wished upon feature then I could add it as a configurable option]

How to get it? Mail to my gmail 'michaelchong2005',thanks.

4 (edited by 7t3chguy 2015-01-28 17:36:58)

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

michael wrote:
7t3chguy wrote:

Would anyone be interested if I share a modified version of my own Global Address Book plugin? It basically builds an addressbook from all the entries in the vmail db through a view in the roundcube db. The addressbook is grouped by domain name and is read only, supports autocomplete, non-configurable.
Could add configuration options for stuff like name of Address Book.
My version also only lists all domains if the logged in user is part of specificdomain.com, for otherdomain.com it just lists *@specificdomain.com and *@otherdomain.com
[Use scenario is specificdomain.com is the company 'hosting' or managing the e-mail services of otherdomain.com, helps because otherdomain.com can't see all addresses of otherotherdomain.com]
[Does not support Aliases, etc. If this is a wished upon feature then I could add it as a configurable option]

How to get it? Mail to my gmail 'michaelchong2005',thanks.

I will attach a zip of the most basic one later today, the maybe I will update it with requests.

Edit: Attaching, should have no bugs, is fairly simple and I plan to add features to it.
To Install:
1. First please download and unzip the file.
2. Find the initial.sql file and apply it to roundcube's MySQL Database, i.e run 'use roundcubemail' and then the code in the file.
3. Upload the zip to %roundcubebasedir%/plugins
4. Add 'webdevguru_contacts' to your $config['plugins'] in %roundcubebasedir%/config/config.inc.php

P.S Hey Zhang, you know now that I'm Moderator, can I get a different Title, like Moderator instead of Member tongue?

5

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

*) How about create a github/bitbucket repository and share your code there?
*) I checked 'initial.sql', it creates a VIEW. But how about access `vmail` database directly? We can ask system admin to add required SQL username/password in config file. This way we don't need to create additional VIEW or SQL table.

6

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:

How about create a github/bitbucket repository and share your code there?

I'm planning to, its just a for now solution

7

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

I have some idea about global address book, both LDAP and SQL backends. not sure whether you're interested in them. big_smile

8

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:

I have some idea about global address book, both LDAP and SQL backends. not sure whether you're interested in them. big_smile

I have never played with LDAP, I guess everything I'd need is in the PHP Libs, ldap_connect etc so it'd work fine. I might eventually do it but it'd most likely be a seperate plugin since the majority of the codebase would be different. I'll set up a GitHub repo for this later.
So yeah sure, let me know your ideas.

GitHub: https://github.com/t3chguy/webdevguru_s … s/releases

9

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

Updated to v1.3, next update will refactor the configuration and add some improvements to the code trying to make it more efficient if possible.

10

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

*) Is this plugin tight to iRedMail? or just a general Roundcube plugin which should work for all Roundcube setup (including iRedMail and non-iRedMail)?
*) MIT license is nice.
*) I understand you want to leave some footprint in your work, but no footprint is another footprint. so, how about rename the plugin, and remove 'webdevguru', 'wdg' string in function/class names in source code? Just a suggestion, it's up to you. smile
*) 80 characters per line in config.inc.php.dist is better, but not big deal.
*) What's Whitelist and Blacklist mentioned in config.inc.php.dist?
*) No option (wdg_sql_mode) for "Show Users from the same Domain without white/blacklist"?
*) Again, how about access `vmail` database directly instead of creating a VIEW? We can ask system admin to add required SQL username/password in config file. This way we don't need to create additional VIEW or SQL table.
*) Any plan to show mail alias account in address book? Maybe placed under group "Mail List" instead of mixed with mail users.

11

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

7t3chguy wrote:

I have never played with LDAP, I guess everything I'd need is in the PHP Libs, ldap_connect etc so it'd work fine.

Roundcube already offers some functions to use LDAP as address book, you can reuse them. What we need is just flexible way to display mail users and mail lists/aliases.

Currently, built-in LDAP address book cannot show list members when you click mail list. Because iRedMail uses another LDAP attribute and structure to store membership.

12

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:

*) Is this plugin tight to iRedMail? or just a general Roundcube plugin which should work for all Roundcube setup (including iRedMail and non-iRedMail)?
*) MIT license is nice.
*) I understand you want to leave some footprint in your work, but no footprint is another footprint. so, how about rename the plugin, and remove 'webdevguru', 'wdg' string in function/class names in source code? Just a suggestion, it's up to you. smile
*) 80 characters per line in config.inc.php.dist is better, but not big deal.
*) What's Whitelist and Blacklist mentioned in config.inc.php.dist?
*) No option (wdg_sql_mode) for "Show Users from the same Domain without white/blacklist"?
*) Again, how about access `vmail` database directly instead of creating a VIEW? We can ask system admin to add required SQL username/password in config file. This way we don't need to create additional VIEW or SQL table.
*) Any plan to show mail alias account in address book? Maybe placed under group "Mail List" instead of mixed with mail users.

It is tied to the view for two reasons, security through obscurity, an admin can rest assured that I do not have permissions to read their pass hashes because I literally can't access them. But also I can create a different view for different mail systems, the .sql file is named iredmail.sql because it creates the view to make the plugin compatible with iredmail systems.
I will be removing the footprint by the next version, Whitelist means show only certain domains, Blacklist means hide specific domains, setting either of those to NULL [default] will disable Whitelisting or Blacklisting.
Mail Alias I am considering adding, but that'll be a later version.
On version2 [complete rewrite] I'll be using a Ruler of 120 with a soft ruler of 80.

So to Show Users from the same Domain without White/Blacklist, you just select 0, 1 or 2 and leave whitelist and blacklist NULL. If you have 5 domains, one of which you want to hide, just add it to the blacklist array for example. I will create a Readme file explaining this. The new config [v2] currently looks like so:

//All Books Support the Whitelist of '*', it is implied.
//Therefore a blacklist of '*' is not supported as it is like a WL of nothing.

//The `Support Book` is an Address Book which will not get shown to members of itself.
//The definition does not support any placeholders, can support multiple domains per book.
//The definition can also support multiple books, the definition goes like:
//    array(array('Support Book', 'webdevguru.co.uk', 'support.co.uk'), array(...))
//Multidimensional Array, of no limit, first sub-element is the Specified Name of the Support Book.
//    The rest of the elements are the Domains that should be within that Support Book.
$config['wdg_sql_supportbook']     = array();

//The `Domain Book` is an Address Book which will contain all the members which have the same
//e-mail domain as the logged in user themself, the only values for configuration are:
//NULL for disable, a string in an array as the name of the `Domain Book`.
//READ Rules, in format {array(whitelist), array(blacklist)} for who can see this Book.
//DATA Rules, in format {array(whitelist), array(blacklist)} for what data is loaded.
//Default for both rules is Everything/Everyone is whitelisted and nothing Blacklisted.
$config['wdg_sql_domainbook']      = NULL;
$config['wdg_sql_domainbook_read'] = array(array('*'), array());
$config['wdg_sql_domainbook_data'] = array(array('*'), array());

//The `Global Book` is an Address Book which will contain all the members of the Database View
//Configure as NULL for disable or a string in an array as the name of the `Global Book`.
//READ Rules, in format {array(whitelist), array(blacklist)} for who can see this Book.
//DATA Rules, in format {array(whitelist), array(blacklist)} for what data is loaded.
//Default for both rules is Everything/Everyone is whitelisted and nothing Blacklisted.
$config['wdg_sql_globalbook']      = NULL;
$config['wdg_sql_globalbook_gp']   = true;
$config['wdg_sql_globalbook_read'] = array(array('*'), array());
$config['wdg_sql_globalbook_data'] = array(array('*'), array());

//To be implemnted: `Custom Books`

VERSION 2 PUSHED, Let me know what you think Zhang:
https://github.com/t3chguy/Roundcube-SQ … s/releases

13

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

7t3chguy wrote:

It is tied to the view for two reasons, security through obscurity, an admin can rest assured that I do not have permissions to read their pass hashes because I literally can't access them. But also I can create a different view for different mail systems, the .sql file is named iredmail.sql because it creates the view to make the plugin compatible with iredmail systems.

That makes sense, and good idea.

7t3chguy wrote:

I will be removing the footprint by the next version, Whitelist means show only certain domains, Blacklist means hide specific domains, setting either of those to NULL [default] will disable Whitelisting or Blacklisting.

Maybe rename them to something like "public_domains = array(...);", "hidden_domains = array(...);" for better understanding. "white/blacklist" is confused.

14

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:
7t3chguy wrote:

It is tied to the view for two reasons, security through obscurity, an admin can rest assured that I do not have permissions to read their pass hashes because I literally can't access them. But also I can create a different view for different mail systems, the .sql file is named iredmail.sql because it creates the view to make the plugin compatible with iredmail systems.

That makes sense, and good idea.

7t3chguy wrote:

I will be removing the footprint by the next version, Whitelist means show only certain domains, Blacklist means hide specific domains, setting either of those to NULL [default] will disable Whitelisting or Blacklisting.

Maybe rename them to something like "public_domains = array(...);", "hidden_domains = array(...);" for better understanding. "white/blacklist" is confused.

Good idea

All but one method have been refactored from scratch into v2.0, nothing has actually been tested yet :')

15

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:
7t3chguy wrote:

It is tied to the view for two reasons, security through obscurity, an admin can rest assured that I do not have permissions to read their pass hashes because I literally can't access them. But also I can create a different view for different mail systems, the .sql file is named iredmail.sql because it creates the view to make the plugin compatible with iredmail systems.

That makes sense, and good idea.

7t3chguy wrote:

I will be removing the footprint by the next version, Whitelist means show only certain domains, Blacklist means hide specific domains, setting either of those to NULL [default] will disable Whitelisting or Blacklisting.

Maybe rename them to something like "public_domains = array(...);", "hidden_domains = array(...);" for better understanding. "white/blacklist" is confused.

It now supports Aliases, through an alternate SQL File. It basically adds it as an additional e-mail within the respective Owner's Contact Entry, and it works for autocomplete. PURPOSEFULLY IGNORES CATCHALL ADDRESSES!
Incidentally this provides Pseudo Mailing List functionality due to Roundcube allowing you to Search for an Address Book Group and send it to the whole group, if using the Global Book with Domain Grouping Enabled you can send to an entire domain without typing each out. Building Release v2.2, eventually will automate the building through PHPCI so builds are cleaner.

16

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

*) How about add a 'INSTALL' file to describe how to install and configure this plugin?
*) Split 'SQL/iredmail+alias.sql' to two files: iredmail-users.sql, iredmail-alias.sql.
*) Tested v2.2 and git version on Debian 7 (php 5.4.36), got an error and Roundcube is not accessible:

Jan 29 19:11:34 d7 roundcube: PHP Fatal error:  Call to undefined function array_column() in /usr/share/apache2/roundcubemail-1.0.4/plugins/wdgrc_sql_contacts/wdgrc_sql_contacts.php on line 18

17

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

ZhangHuangbin wrote:

*) How about add a 'INSTALL' file to describe how to install and configure this plugin?
*) Split 'SQL/iredmail+alias.sql' to two files: iredmail-users.sql, iredmail-alias.sql.
*) Tested v2.2 and git version on Debian 7 (php 5.4.36), got an error and Roundcube is not accessible:

Jan 29 19:11:34 d7 roundcube: PHP Fatal error:  Call to undefined function array_column() in /usr/share/apache2/roundcubemail-1.0.4/plugins/wdgrc_sql_contacts/wdgrc_sql_contacts.php on line 18

Oh wow, didn't realise that array column was a fairly new function. I'll write a helper function to remedy it. I don't see how I can split the sql files since its literally a difference of one sql line.
I will be adding an install file and better instructions info the md.

18

Re: New Roundcube Plugin - iRedMail MySQL Global Address Book

Is this plugin still functional?