Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add an option to skip disabled objects

  • Loading branch information...
commit 3019f3112a5f0d949b7be304f57fbff852eb5475 1 parent a84865b
@giganteous authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 sbin/rt-dump-metadata.in
View
17 sbin/rt-dump-metadata.in
@@ -79,7 +79,9 @@ BEGIN {
use Getopt::Long;
my %opt;
-GetOptions( \%opt, "help|h", "limit-to-privileged|l" );
+GetOptions( \%opt, "help|h",
+ "limit-to-privileged|l",
+ "skip-disabled|s" );
if ( $opt{help} ) {
require Pod::Usage;
@@ -117,7 +119,7 @@ my @classes = qw(
foreach my $class (@classes) {
require "RT/$class.pm";
my $objects = "RT::$class"->new( RT->SystemUser );
- $objects->{find_disabled_rows} = 1;
+ $objects->{find_disabled_rows} = 1 unless $opt{'skip-disabled'};
$objects->UnLimit;
$objects->LimitToPrivileged if $class eq 'Users'
&& $opt{'limit-to-privileged'};
@@ -152,6 +154,7 @@ foreach my $class (@classes) {
}
my %fields;
+OBJECT:
while ( my $obj = $objects->Next ) {
next
if $obj->can('LastUpdatedBy')
@@ -216,16 +219,16 @@ foreach my $class (@classes) {
# 2) Pick a level: Granted on Queue, CF, CF+Queue, or Globally?
for ( $obj->ObjectType ) {
if ( /^RT::Queue$/ ) {
- #return if $obj->Object->Disabled;
+ next OBJECT if $opt{'skip-disabled'} && $obj->Object->Disabled;
$rv->{Queue} = $obj->Object->Name;
}
elsif ( /^RT::CustomField$/ ) {
- #return if $obj->Object->Disabled;
+ next OBJECT if $opt{'skip-disabled'} && $obj->Object->Disabled;
$rv->{CF} = $obj->Object->Name;
}
elsif ( /^RT::Group$/ ) {
# No support for RT::Group ACLs in RT::Handle yet.
- return;
+ next OBJECT;
}
elsif ( /^RT::System$/ ) {
# skip setting anything on $rv;
@@ -235,7 +238,7 @@ foreach my $class (@classes) {
# 3) Pick a Principal; User or Group or Role
if ( $obj->PrincipalType eq 'Group' ) {
- #return if $obj->PrincipalObj->Disabled;
+ next OBJECT if $opt{'skip-disabled'} && $obj->PrincipalObj->Disabled;
my $group = $obj->PrincipalObj->Object;
for ( $group->Domain ) {
# An internal user group
@@ -246,7 +249,7 @@ foreach my $class (@classes) {
# An individual user
elsif ( /^ACLEquivalence$/ ) {
my $member = $group->MembersObj->Next->MemberObj;
- #return if $member->Disabled;
+ next OBJECT if $opt{'skip-disabled'} && $member->Disabled;
$rv->{UserId} = $member->Object->Name;
}
# A group you created
Please sign in to comment.
Something went wrong with that request. Please try again.