Rt-dump-metadata improvements

Dear Best Practical,

I needed to create a working copy of our main RT instance, so I had to
patch a few things on rt-dump-metadata to make it useful. Bear with me
for 5 branches, of which a few are quite dependent on each other.

a) Fix the dumping of non-local groups


I might’ve missed a reason why this code was inside the $Local_Only if,
but it seemed implausible to ever dump non-user defined groups. I’m
curious why it’s not been noticed before.

b) An option to limit the Users to only dump the privileged ones


Since we have 680k unprivileged users this feature really shines for

c) The previous patch will introduce a bug, the current ACL dumping
code doesn’t work when principal IDs get renumbered. This is probably a
bug in itself, because we could’ve used the rt-shredder to remove users,
so the ACL code is bugged anyway. I’ve fixed the ACL dumping, sadly
leading to a large diff:


Running git diff by hand with -w will show you the diff without the
whitespace. Dunno how to massage github’s web compare :).
This is basically a reverse engineered version of the documentation of
Initialdata you guys made available on the website. That was a great

d) Then, as I thought this would be handy, but again, the patch might
be a bit on the ugly side as it creates tests on several key points in
the code:


This partly fixes a few bugs in the 4.0/feature-dump-working-acls, as I
used a bare ‘return’ where that obviously wouldn’t work.

e) A week later I needed to move a few CustomFields from a testing
environment back to production, and the Categories were missing. I
crafted another patch.


This last one (e) is not dependent on the other work.

Anyway, is it worth to create pull requests for these units of work? Or
is the 4.2 work too much in the way? Are there any tests to be taken
into account?