[horde] horde-remove-user-data script usage

John H. Bennett III bennettj at thebennetthome.com
Tue Nov 5 04:06:20 UTC 2013


Quoting Michael M Slusarz <slusarz at horde.org>:

> Quoting "John H. Bennett III" <bennettj at thebennetthome.com>:
>
>> Quoting Michael M Slusarz <slusarz at horde.org>:
>>
>>> Quoting "John H. Bennett III" <bennettj at thebennetthome.com>:
>>>
>>>> Quoting Michael M Slusarz <slusarz at horde.org>:
>>>>
>>>>> Quoting "John H. Bennett III" <bennettj at thebennetthome.com>:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> How is one supposed to use this script?  I log in to my server  
>>>>>> as root and run
>>>>>>
>>>>>> php /usr/bin/horde-remove-user-data
>>>>>>
>>>>>> I get the below, no matter if I try to put in a valid user or not.
>>>>>>
>>>>>> [root at www Horde_Smtp]# php /usr/bin/horde-remove-user-data
>>>>>> [  INFO  ] Horde directory: /home/httpd/html/horde
>>>>>>
>>>>>> Username: john
>>>>>>
>>>>>> Application to remove data from (blank for all apps):
>>>>>>
>>>>>> Are you sure you want to remove user data?
>>>>>> (y) Yes
>>>>>> (n) No
>>>>>>
>>>>>> Type your choice [n]: y
>>>>>>
>>>>>> ====================
>>>>>>
>>>>>> Fatal Error:
>>>>>> You are not allowed to remove user data.
>>>>>>
>>>>>> 1. Horde_Cli->fatal() /usr/bin/horde-remove-user-data:53
>>>>>
>>>>> You have at least one admin user defined in your config?
>>>>>
>>>>> michael
>>>>>
>>>>> ___________________________________
>>>>> Michael Slusarz [slusarz at horde.org]
>>>>>
>>>>
>>>> Yes, I sure do:
>>>>
>>>> $conf['auth']['admins'] = array('admin at mytest.com', );
>>>
>>> No idea.  Works here.  You'll need to track down the issue locally.
>>>
>>> michael
>>>
>>
>> Well crud.  Since this is a test box, I reloaded, and I get the  
>> same thing.  Would you or someone else help me to help myself in  
>> trying to debug this, please?  My files are current as of today.
>
> That script runs with the 'user_admin' flag set to true.  This means  
> that the Horde Registry sets the user to the first user it finds in  
> the admin config variable when initializing the script (see line  
> ~325 of the Horde_Registry library).  This should cause all further  
> calls to Horde_Registry#isAdmin() to return true.  That obviously  
> isn't happening in your case, so you need to debug why that method  
> is returning false instead of true (~line 2140 of Horde_Registry).
>
> michael
>

I've tracked down what makes this not work.  I'm using this hook to  
append the domainname when the user logs in.

class Horde_Hooks
{
       public function authusername($userId, $toHorde)
       {
           // Example #1: Append the virtual domain to the username.
           // ex. $HTTP_HOST = 'mail.mydomain.com', $userId = 'myname' returns:
           // 'myname at mydomain.com'
           $vdomain = getenv('HTTP_HOST');
           $vdomain = substr($vdomain,strpos($vdomain,".")+1);

           if ($toHorde) {
               $userId = strtolower($userId);
               return $userId . '@' . $vdomain;
           } else {
               return (substr($userId, -strlen($vdomain)) == $vdomain)
                 ? substr($userId, 0, -strlen($vdomain)-1)
                 : $userId;
           }
       }
}



?>

When using this hook, the script doesn't work. So, you say, then don't  
use a hook, well the distro I'm using has been using horde since  
version 2, and we've always used the hook to append user at domain.com  
when a user logs in.  If I remove the hook, then a users preferences  
are no longer saved, used, and visible, and I personally, am not smart  
enough yet to migrate all the various data in MySQL to not use a hook.  
  Hope some of that makes sense.  So, could there be a way to use this  
script while also using the hook?  I know the hook doesn't match  
exactly the example, but I couldn't get the example to work, so I kept  
trying things until something finally worked for me.

Thanks again,

John




More information about the horde mailing list