Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-11 Thread Ruslan Zakirov
Hi RT users,

A new version of MergeUsers extension has been released to the CPAN.


On Thu, Sep 5, 2013 at 6:54 PM, Nathan Cutler wrote:

> > Can you test the following patch?
>
> I've applied the patch on both our testing and production instances.
> It seems to work! Will keep an eye on it to see if there are any
> undesired consequences.
>
> Thanks alot!





-- 
Best regards, Ruslan.


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-05 Thread Nathan Cutler
> Can you test the following patch?

I've applied the patch on both our testing and production instances.
It seems to work! Will keep an eye on it to see if there are any
undesired consequences.

Thanks alot!

Nathan


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-05 Thread Thomas Bätzler
Hello Ruslan,

> Can you test the following patch?

This seems to fix the problem with Nathan's script aswell as mine where my user 
didn't show up in "modify ticket".

Thank you for your help!

Cheers,
Thomas


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-05 Thread Ruslan Zakirov
Hi guys,

Can you test the following patch?


On Thu, Sep 5, 2013 at 12:21 PM, Nathan Cutler wrote:

> > I'm planning to look at it later tonight or tomorrow.
>
> Thanks, Ruslan.
>
> > Guys, please send version of DBIx::SearchBuilder, just in case it's not
> the
> > latest.
>
> I'm running 1.63.
>



-- 
Best regards, Ruslan.


MergeUsers-dont-skip-records-in-collection.patch
Description: Binary data


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-05 Thread Nathan Cutler
> I'm planning to look at it later tonight or tomorrow.

Thanks, Ruslan.

> Guys, please send version of DBIx::SearchBuilder, just in case it's not the
> latest.

I'm running 1.63.


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-04 Thread Ruslan Zakirov
On Wed, Sep 4, 2013 at 2:45 PM, Thomas Bätzler wrote:

> Hi,
>
> Nathan Cutler wrote:
>
> > > Find `sub Next` in lib/RT/Extension/MergeUsers.pm, put logging or
> printing
> > > debug statements there to check what is going on.
> >
> > OK, I'll try that. I ran some more tests on my testing RT instance.
> > Here's what I just found out:
> >
> > When no users are merged, the script produces the same output (same
> > users, same number of users) as the SELECT statement. When I then go
> > and merge a single user into another user, the number of users
> > produced by the script decreases by *two* -- the merged user *plus*
> > the alphabetically last user.
>
> I can reproduce this on our installation (RT 4.0.17). I suspect it's also
> the cause for the problem I reported earlier last week - while logged in as
> a "merged" user, my user wouldn't show up as potential owner when modi
> fying a ticket. It's not a rights problem in my case since this user can
> "take" any ticket.
>

agree.


>
> I did try to trace the problem in the code, but I got lost in the vast
> wilderness of DBIx::SearchBuilder  subclasses ;-)
>


I'm planning to look at it later tonight or tomorrow.

Guys, please send version of DBIx::SearchBuilder, just in case it's not the
latest.


>
>
> MfG,
> Thomas Bätzler
> --
> BRINGE Informationstechnik GmbH
> Zur Seeplatte 12
> D-76228 Karlsruhe
> Germany
>
> Fon: +49 721 94246-0
> Fon: +49 171 5438457
> Fax: +49 721 94246-66
> Web: http://www.bringe.de/
>
> Geschäftsführer: Dipl.-Ing. (FH) Martin Bringe
> Ust.Id: DE812936645, HRB 108943 Mannheim
>
>
>
>


-- 
Best regards, Ruslan.


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-04 Thread Thomas Bätzler
Hi,

Nathan Cutler wrote:

> > Find `sub Next` in lib/RT/Extension/MergeUsers.pm, put logging or printing
> > debug statements there to check what is going on.
> 
> OK, I'll try that. I ran some more tests on my testing RT instance.
> Here's what I just found out:
> 
> When no users are merged, the script produces the same output (same
> users, same number of users) as the SELECT statement. When I then go
> and merge a single user into another user, the number of users
> produced by the script decreases by *two* -- the merged user *plus*
> the alphabetically last user.

I can reproduce this on our installation (RT 4.0.17). I suspect it's also the 
cause for the problem I reported earlier last week - while logged in as a 
"merged" user, my user wouldn't show up as potential owner when modi fying a 
ticket. It's not a rights problem in my case since this user can "take" any 
ticket.

I did try to trace the problem in the code, but I got lost in the vast 
wilderness of DBIx::SearchBuilder  subclasses ;-)


MfG,
Thomas Bätzler
-- 
BRINGE Informationstechnik GmbH
Zur Seeplatte 12
D-76228 Karlsruhe
Germany

Fon: +49 721 94246-0
Fon: +49 171 5438457
Fax: +49 721 94246-66
Web: http://www.bringe.de/

Geschäftsführer: Dipl.-Ing. (FH) Martin Bringe
Ust.Id: DE812936645, HRB 108943 Mannheim





Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-03 Thread Nathan Cutler
> Find `sub Next` in lib/RT/Extension/MergeUsers.pm, put logging or printing
> debug statements there to check what is going on.

OK, I'll try that. I ran some more tests on my testing RT instance.
Here's what I just found out:

When no users are merged, the script produces the same output (same
users, same number of users) as the SELECT statement. When I then go
and merge a single user into another user, the number of users
produced by the script decreases by *two* -- the merged user *plus*
the alphabetically last user.

For example: with no users merged, the SELECT and the script both
return 63 rows (users). After user X is merged into user Y, the script
returns 61 rows (users), instead of 62 that would be expected. The two
missing users are user X and user Z (the last user in the alphabetical
listing produced by SELECT).

In my production instance, I have 8 merged users and the number of
users produced by the script is 16 less than the SELECT listing. In
addition to the 8 merged users, the 8 users at the end of the alphabet
are missing.

So it looks like an "off-by-one" bug.

Nathan


Re: [rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-03 Thread Ruslan Zakirov
Find `sub Next` in lib/RT/Extension/MergeUsers.pm, put logging or printing
debug statements there to check what is going on.


On Tue, Sep 3, 2013 at 2:29 PM, Nathan Cutler wrote:

> > Call `print $RT_enabled_users->BuildSelectQuery, "\n";`, check SQL
> manually
> > and it is correct then move to Next function.
>
> Thanks, Ruslan. I tried your suggestion. It outputs the following
> SELECT statement:
>
> SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1
> ON ( Principals_1.id = main.id )  WHERE (Principals_1.Disabled = '0')
> AND (Principals_1.PrincipalType = 'User')  ORDER BY main.Name ASC
>
> which I cut-and-pasted into the mysql prompt. This gives me 167 rows
> in alphabetical order. The Perl script's output, however, shows only
> 151 rows.
>
> I changed the SELECT statement to output just main.Name (into a file).
> Then, I modified my script to output just the Name of each enabled
> user (also to a file). And then I diffed the two resulting files. The
> SELECT statement yields 16 more users than the Perl script does.
>
> Here's my guess at what's happening: I'm using the MergeUsers
> extension. The SELECT statement ignores the fact that some of the
> users have been merged, and simply grabs them all. The Perl script, by
> contrast, attempts to get only those users that have not been merged
> into other users. But for some reason it fails to do this correctly,
> leaving out more users than it should. Significantly, it leaves out 8
> users at the end of the list. This would indicate that it's getting a
> wrong count of the number of non-merged users. Once it reaches the end
> of the count, it simply ignores the remaining users, even though they
> are non-merged.
>
> It's quite possible that I have merged 8 users. These 8 are not in the
> list generated by the Perl script. In addition to these 8, another 8
> (at the end of the alphabet) are also missing. It's very weird and it
> definitely smells like a bug.
>
> Any ideas appreciated.
>
> Nathan
>



-- 
Best regards, Ruslan.


[rt-users] Fwd: How to list all enabled users in Perl script?

2013-09-03 Thread Nathan Cutler
> Call `print $RT_enabled_users->BuildSelectQuery, "\n";`, check SQL manually
> and it is correct then move to Next function.

Thanks, Ruslan. I tried your suggestion. It outputs the following
SELECT statement:

SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1
ON ( Principals_1.id = main.id )  WHERE (Principals_1.Disabled = '0')
AND (Principals_1.PrincipalType = 'User')  ORDER BY main.Name ASC

which I cut-and-pasted into the mysql prompt. This gives me 167 rows
in alphabetical order. The Perl script's output, however, shows only
151 rows.

I changed the SELECT statement to output just main.Name (into a file).
Then, I modified my script to output just the Name of each enabled
user (also to a file). And then I diffed the two resulting files. The
SELECT statement yields 16 more users than the Perl script does.

Here's my guess at what's happening: I'm using the MergeUsers
extension. The SELECT statement ignores the fact that some of the
users have been merged, and simply grabs them all. The Perl script, by
contrast, attempts to get only those users that have not been merged
into other users. But for some reason it fails to do this correctly,
leaving out more users than it should. Significantly, it leaves out 8
users at the end of the list. This would indicate that it's getting a
wrong count of the number of non-merged users. Once it reaches the end
of the count, it simply ignores the remaining users, even though they
are non-merged.

It's quite possible that I have merged 8 users. These 8 are not in the
list generated by the Perl script. In addition to these 8, another 8
(at the end of the alphabet) are also missing. It's very weird and it
definitely smells like a bug.

Any ideas appreciated.

Nathan