\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
\part{Migrating an existing horde installation's group from SQL to LDAP}
\section{Manually}
I strongly suggest you don't play around in production!

\subsection{Basics}
- Configure a separate vhost each for the db-based and the sql-based setup\newline
- create conf-\{sqlvhost\}.host.com.php and conf-\{ldapvhost\}.host.com.php each containing only the php tag and all \$conf['group'] stuff. \newline
- use the docs on how to setup horde for ldap groups.\newline
- ensure both are basically working (create some bogus group and add some user in each backend)\newline
- Now open https://\{host\}/horde/admin/groups.php\footnote{https://\{host\}/horde/admin/groups.php} or  https://\{host\}/admin/groups.php\footnote{https://\{host\}/admin/groups.php} in each site.\newline
- Create all the missing groups in the ldap backend. add all the missing users.

\subsection{Permissions}
(assuming SQL backend) select * from horde\_perms where perm\_data like "\%groups\%";

Each permission assigned to a group by numeric group id must be cloned to be used by the ldap group backend.\newline
Best use the group admin screen.

Do not attempt to edit the perms using an sql statement.

\subsection{Shares}
(assuming sharesng sql backend is used)\newline
Find any apps using sharesng shares\newline
mysql> show tables like "\%sharesng\_groups\%";

For each found table,

For each group\_uid which is numeric, look up the group name\newline
and build a query to create a corresponding entry with the same perms.

\subsubsection{KRONOLITH}
select DISTINCT CONCAT(\newline
"INSERT INTO kronolith\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
", ",\newline
perm\_1024,\newline
");"\newline
) \newline
as query from kronolith\_sharesng\_groups, horde\_groups \newline
WHERE kronolith\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND kronolith\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{NAG}
select DISTINCT CONCAT(\newline
"INSERT INTO nag\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from nag\_sharesng\_groups, horde\_groups \newline
WHERE nag\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND nag\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{ansel}
select DISTINCT CONCAT(\newline
"INSERT INTO ansel\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from ansel\_sharesng\_groups, horde\_groups \newline
WHERE ansel\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND ansel\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{gollem}
select DISTINCT CONCAT(\newline
"INSERT INTO gollem\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from gollem\_sharesng\_groups, horde\_groups \newline
WHERE gollem\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND gollem\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{ingo}
select DISTINCT CONCAT(\newline
"INSERT INTO ingo\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from ingo\_sharesng\_groups, horde\_groups \newline
WHERE ingo\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND ingo\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{mnemo}
select DISTINCT CONCAT(\newline
"INSERT INTO mnemo\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from mnemo\_sharesng\_groups, horde\_groups \newline
WHERE mnemo\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND mnemo\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{turba }
select DISTINCT CONCAT(\newline
"INSERT INTO turba\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from turba\_sharesng\_groups, horde\_groups \newline
WHERE turba\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND turba\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsubsection{whups}
select DISTINCT CONCAT(\newline
"INSERT INTO whups\_sharesng\_groups VALUES(",\newline
share\_id,\newline
", \\"cn=",\newline
horde\_groups.group\_name,\newline
",ou=hordegroups,dc=domain,dc=com\\"",\newline
", ",\newline
perm\_2,\newline
", ",\newline
perm\_4,\newline
", ",\newline
perm\_8,\newline
", ",\newline
perm\_16,\newline
");"\newline
) \newline
as query from whups\_sharesng\_groups, horde\_groups \newline
WHERE whups\_sharesng\_groups.group\_uid REGEXP "\^\^[0-9]+\$" \newline
AND whups\_sharesng\_groups.group\_uid=horde\_groups.group\_uid;

\subsection{Cache}
Clear horde group cache and horde shares cache once you're done.

\section{By script}
TBD

\end{document}
