[nag] Nag Shares assistance
John H. Bennett III
bennettj at thebennetthome.com
Thu May 3 04:24:28 UTC 2012
Hello all,
I'm currently testing horde 4 and I need some help with Nag 3.0.7.
I'm current with the other horde components. My issue is that I need
to login with a userid and need to store my information in mysql as
user at domain.com. With horde 3, I have a realm set up in imp
servers.php and my info is stored correctly. With horde4 and imp,
realms are no longer supported, so it is suggested to use the
authusername hook in horde, which I am trying to use.
This is what I have in hooks.local.php
class Horde_Hooks
{
// USERNAME HOOK: See above for description of format.
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);
$vdomain = Horde_String::lower($vdomain);
$userId = Horde_String::lower($userId);
if ($toHorde) {
return $userId . '@' . $vdomain;
} else {
return (substr($userId, -strlen($vdomain)) == $vdomain)
? substr($userId, 0, -strlen($vdomain))
: $userId;
}
}
}
I'm not a coder, so some of this was put together from the example in
hooks.php.dist and searching on the web. I need to be able to ignore
the x.mydomin.com. It doesn't matter what x is. I don't understand
how to do this with the preg_replace example in the hook. Anyway,
using the above, the userid and domain is always sent in lowercase.
This seems to work fine, when I login, I see in my logs
May 2 22:46:00 www HORDE: [imp] Login success for admin (Horde user
admin at mydomain.com) [10.10.10.125] to {localhost:993 [imap]} [pid
30731 on line 176 of "/home/httpd/html/horde/imp/lib/Auth.php"]
May 2 22:46:00 www HORDE: [horde] Login success for
admin at mydomain.com [10.10.10.125] to horde. [pid 30731 on line 153 of
"/home/httpd/html/horde/login.php"]
When I choose tasks, looking at the nag_shares table, I see that share
owner is admin at mydomain.com. If I create a new share, the owner will
also be admin at mydomain.com. When I go to change the permissions, the
owner tab shows at admin@, and I see this in my log:
ay 2 22:59:32 www HORDE: [horde] Share id 0 not found [pid 30826 on
line 234 of "/usr/share/pear/Horde/Share/Sql.php"]
If I add the show and read permission, then save and finish, the share
owner changes to admin@@mydomain.com. If I go back and change or
remove any permisions, then save and finish again, the share owner
changes to admin@@@mydomain.com. An additional @ character is added
everytime you do something with the permissions, and the Share id
error is shown in the logs.
I don't know what to do to correct this. I've tried various changes
to the hook to try to understand what's going on, but nothing works
for me.
Also, would someone else confirm that when you create a new share,
then try to choose the color using the color picker, that trying to
drag the circle to a color to see the hex code doesn't work. I check
the bugs, but didn't see this listed, so I want to make sure if this
is only something I'm seeing.
I would appreciate any assistance. This is a test box, so I should be
able to give whatever addiional information you need.
Thanks very much in advance.
John H. Bennett III
More information about the nag
mailing list