[horde] Rename users?
Robin Rainton
robin at rainton.com
Thu Nov 3 14:17:40 PST 2005
In case anyone looks, this seems to work... YMMV:
#!/bin/sh
function horde_rename() {
$pass=your.horde.db.pass
new=$2; old=$1
echo Rename $old \-\> $new
mysql -u horde -p$pass horde << EOF
update hermes_timeslices set employee_id = '$new' where employee_id = '$old';
update horde_datatree set user_uid = '$new' where user_uid = '$old';
update horde_datatree set datatree_name = '$new' where datatree_name = '$old'
and user_uid = '$new';
update horde_datatree_attributes set attribute_value = '$new' where
attribute_value = '$old' and attribute_key = 'who';
update horde_datatree_attributes set attribute_key= '$new' where
attribute_key =
'$old' and attribute_name = 'perm_users';
update horde_datatree_attributes set attribute_value = '$new' where
attribute_value = '$old' and attribute_name = 'owner';
# horde_datatree_attributes
update horde_prefs set pref_uid = '$new' where pref_uid = '$old';
update kronolith_events set event_creator_id = '$new' where event_creator_id =
'$old';
update kronolith_events set calendar_id = '$new' where calendar_id = '$old';
update mnemo_memos set memo_owner = '$new' where memo_owner = '$old';
update nag_tasks set task_owner = '$new' where task_owner = '$old';
update turba_objects set owner_id = '$new' where owner_id = '$old';
update whups_queues_users set user_uid = '$new' where user_uid = '$old';
update whups_users_searches set user_uid = '$new' where user_uid = '$old';
EOF
echo Done with $new
}
horde_rename 'fred' 'fred at his.domain.com'
Quoting Robin Rainton <robin at rainton.com>:
> Hi,
>
> Have done a few searches on this and seems there's not immediate answer... to
> put it simply, I'm looking for a way to rename users in the Horde system.
>
> This need arises as we're looking at moving from an older system to new,
> 'proper' virtual hosts system. Ie:
>
> Old user: fred
> New user: fred at his.domain.com
>
> I was hoping there was a way whereby a unique internal ID was related to the
> login name in just one place. Sadly these seems spread all over the place
> though. I've started to constuct a script a little like:
>
> update hermes_timeslices set employee_id = '$new' where employee_id = '$old';
> update kronolith_events set event_creator_id = '$new' where
> event_creator_id =
> '$old';
>
> etc. but hit a problem in the horde_datatree_attributes table, that seems
> particularly complicated.
>
> Has this been done before? Is there an easier way? Anyone have any advice or
> other scripts that might be useful?
>
> Apps in use are:
>
> Address Book (turba)
> Calendar (kronolith)
> File Manager (gollem)
> Filters (ingo)
> Horde (horde)
> Mail (imp)
> News (jonah)
> Notes (mnemo)
> Password (passwd)
> Tasks (nag)
> Tickets (whups)
> Time Tracking (hermes)
>
> Thanks,
>
> Robin
>
> --
> Horde mailing list - Join the hunt: http://horde.org/bounties/#horde
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>
More information about the horde
mailing list