Author Topic: Free LDAP Server  (Read 10439 times)

Offline Guillermolococo

  • Newbie
  • *
  • Posts: 6
Free LDAP Server
« on: September 08, 2006, 06:02:56 AM »
Is some LDAP server ?
Like free DNS server GraniteCanyon ?
(My Hosting dont have LDAP support)

Thanks to all !

Offline Guillermolococo

  • Newbie
  • *
  • Posts: 6
Re: Free LDAP Server
« Reply #1 on: September 08, 2006, 08:23:17 AM »
If "NO" global contact exist, I have created a method.

INSERT into database ROUNDCUBE, table "contacts", contacts with user_id = empty,

INSERT INTO `contacts` ( `contact_id` , `user_id` , `changed` , `del` , `name` , `email` , `firstname` , `surname` , `vcard` )
VALUES
(NULL , '', '0000-00-00 00:00:00', '0', '', 'guillermolococo1@domain.com', '', '', ''),
(NULL , '', '0000-00-00 00:00:00', '0', '', 'guillermolococo2@domain.com', '', '', ''),
.....

AND then modify /program/steps/mail/compose.inc in line 753

$sql_result = $DB->query("SELECT name, email
             FROM ".get_table_name('contacts')." WHERE user_id=?
             AND del<>1",$_SESSION['user_id']);

 .. to ..

$sql_result = $DB->query("SELECT name, email
             FROM ".get_table_name('contacts')." WHERE ( user_id=? OR user_id='' )
             AND del<>1",$_SESSION['user_id']);

and now GLOBAL CONTACTS have been installed without LDAP.

Offline rocky

  • Newbie
  • *
  • Posts: 4
Re: Free LDAP Server
« Reply #2 on: September 13, 2006, 09:21:04 AM »
Hmm, this gave me an idea.
How about adding a 'public' flag to each contact entry, so that when a user adds a contact he can chose to tick the 'public' checkbox and make the contact available for all?

This would of course mean that we would have to make two separate views, one for personal contacts and one for public, but that's more or less trivial I think.

Offline Guillermolococo

  • Newbie
  • *
  • Posts: 6
Re: Free LDAP Server
« Reply #3 on: September 15, 2006, 03:46:51 AM »
Good idea ! :)

Nice !
Change the Query, add 1 row in mysql, and change addcontacts.

(I try that the next week. Now Im with problems opening attachments.
Im running RoundCube in 150 email client company and open PDF is high priority.)

Offline qpmailman

  • Newbie
  • *
  • Posts: 8
Re: Free LDAP Server
« Reply #4 on: October 12, 2006, 02:17:27 PM »
Just to update this:

The user_id field is required, and defaults to 0 (for MySQL at least)
To make this work, I had to change
Code: [Select]
( user_id=? OR user_id='' ) to
Code: [Select]
( user_id=? OR user_id=0 ) because user_id defaults to 0

The code in compose.inc was located on line 783 in my install (0.1-beta2)

[edit]You will also need to change line 128 of compose.inc if you want to be able to send to global contacts from the address book
this bit:
Code: [Select]
   $sql_result = $DB->query("SELECT name, email
                 FROM ".get_table_name('contacts')."
                 WHERE user_id=?
                 AND  del<>1
                 AND  contact_id IN (".$_GET['_to'].")",
                 $_SESSION['user_id']);
change line 128 to
Code: [Select]
WHERE ( user_id=? OR user_id=0 )[/edit]

Just changing /program/steps/mail/compose.inc means that the global contacts will only appear when someone composes a message (in the autocomplete).
If you want the global contacts to appear in the addressbook, then modify all instances of
Code: [Select]
( user_id=? OR user_id='' ) to
Code: [Select]
( user_id=? OR user_id=0 ) in /program/steps/addressbook/func.inc
[edit]You will also have to modify /program/steps/addressbook/list.inc in order to see more than one page of contacts[/edit]
This will allow viewing the list of contacts, but not the contact details for shared contacts.
If you want to enable viewing details of the shared contacts, then modify the same code in /program/steps/addressbook/show.inc
when a user tries to edit a shared contact, they will see contact not found.

to enable editing modify: /program/steps/addressbook/edit.inc
to enable deletion modify: /program/steps/addressbook/delete.inc

I tried modifying /program/steps/addressbook/list.inc but I didn't see any changes. If anyone knows what that file does, then let me know.

Also when you enable view of the shared contacts in the address book, selecting a contact and choosing compose mail to does not work. I will let you guys know if I find out how to fix that.[edit]I fixed it, see above[/edit]



Offline awmartin

  • Newbie
  • *
  • Posts: 8
Re: Free LDAP Server
« Reply #5 on: October 12, 2006, 10:06:43 PM »
Quote from: rocky
Hmm, this gave me an idea.
How about adding a 'public' flag to each contact entry, so that when a user adds a contact he can chose to tick the 'public' checkbox and make the contact available for all?

This would of course mean that we would have to make two separate views, one for personal contacts and one for public, but that's more or less trivial I think.

Rocky,

I really like your idea here. I would like to figure out how to do this, but I am somewhat of a newbie. I have been looking over the code now for 4 hours and still have no clue what I need to do to accomplish this. I actually would like to have a set of radio buttons where one is Public and the other is Private. If you have any pointers for me please let me know.

Thanks.

Offline toto99x

  • Newbie
  • *
  • Posts: 6
Re: Free LDAP Server
« Reply #6 on: October 17, 2006, 12:00:35 PM »
This is fascinating, especially as I was looking for something just like this!

I'm a newbie to roundcube, and would like to ask: we have a hundred or so users that I'd like to include in the db. If I do, for example, this ..

INSERT INTO `contacts` ( `contact_id` , `user_id` , `changed` , `del` , `name` , `email` , `firstname` , `surname` , `vcard` )
VALUES
(NULL , '', '0000-00-00 00:00:00', '0', '', 'guillermolococo1@domain.com', '', '', ''),
(NULL , '', '0000-00-00 00:00:00', '0', '', 'guillermolococo2@domain.com', '', '', ''),
.....


... as already mentioned.... can I put other values in those lines where there are commas? Sort of like..

(NULL , '', '0000-00-00 00:00:00', '0', '', 'guillermolococo1@domain.com', ''his_first_name ''his_second_name''),


..?

Would that work?

Also, roundcube on my FreeBSD system was installed via the ports collection. To change the compose.inc, do I need to compile by hand?

Thanks..

Offline qpmailman

  • Newbie
  • *
  • Posts: 8
Re: Free LDAP Server
« Reply #7 on: October 17, 2006, 02:21:28 PM »
PhpMyAdmin is a good tool to use to modify the db. You can import from a properly formatted .csv file Export the addressbook db to a .cvs file to see the format.

all of the files that rouncube uses are plain text files, just mod them with a text editor, and refresh the page. Make sure to backup the originals.

Offline robin.one

  • Newbie
  • *
  • Posts: 9
Re: Free LDAP Server
« Reply #8 on: January 10, 2007, 11:54:41 PM »
Just to let everyone in this thread know, I've taken parts of these steps and combined them with another method here - http://roundcubeforum.net/forum/index.php?topic=1055.msg5057#msg5057

Works pretty good on my server.

Cheers

Offline demis

  • Newbie
  • *
  • Posts: 1
Re: Free LDAP Server
« Reply #9 on: March 22, 2007, 03:53:20 PM »
Hi,

Thanks qpmailman for your post about global addressbook.

you said:
Also when you enable view of the shared contacts in the address book, selecting a contact and choosing compose mail to does not work. I will let you guys know if I find out how to fix that.

Abou that, i found the solution. in ../steps//mail/compose.inc a line like:

/****** get contacts for this user and add them to client scripts********/

$sql_result = $DB->query("SELECT name, email
             FROM ".get_table_name('contacts')." WHERE (user_id=? OR user_id=0)
             AND del<>1",$_SESSION['user_id']);

add the condition again there.

bye!