[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-419-g92e1181

Shawn Moore sartak at bestpractical.com
Mon Aug 16 22:22:52 EDT 2010


The branch, 3.9-trunk has been updated
       via  92e11814d3802a2d76e0ecc5b38f1e287b28ee78 (commit)
      from  772a66f518414c62329256dc7e33578eacb39815 (commit)

Summary of changes:
 lib/RT/Queue_Overlay.pm |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit 92e11814d3802a2d76e0ecc5b38f1e287b28ee78
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Aug 16 22:20:28 2010 -0400

    Split _CreateQueueGroups into three methods for easier reuse

diff --git a/lib/RT/Queue_Overlay.pm b/lib/RT/Queue_Overlay.pm
index c020b1c..dc6201b 100755
--- a/lib/RT/Queue_Overlay.pm
+++ b/lib/RT/Queue_Overlay.pm
@@ -664,25 +664,38 @@ It will return true on success and undef on failure.
 
 =cut
 
+sub _RoleGroupTypes {
+    return qw(Cc AdminCc Requestor Owner);
+}
 
 sub _CreateQueueGroups {
     my $self = shift;
 
-    my @types = qw(Cc AdminCc Requestor Owner);
+    my @types = $self->_RoleGroupTypes;
 
     foreach my $type (@types) {
-        my $type_obj = RT::Group->new($self->CurrentUser);
-        my ($id, $msg) = $type_obj->CreateRoleGroup(Instance => $self->Id, 
-                                                     Type => $type,
-                                                     Domain => 'RT::Queue-Role');
-        unless ($id) {
-            $RT::Logger->error("Couldn't create a Queue group of type '$type' for queue ".
-                               $self->Id.": ".$msg);
-            return(undef);
-        }
-     }
-    return(1);
-   
+        my $ok = $self->_CreateQueueRoleGroup($type);
+        return undef if !$ok;
+    }
+
+    return 1;
+}
+
+sub _CreateQueueRoleGroup {
+    my $self = shift;
+    my $type = shift;
+
+    my $type_obj = RT::Group->new($self->CurrentUser);
+    my ($id, $msg) = $type_obj->CreateRoleGroup(Instance => $self->Id, 
+                                                    Type => $type,
+                                                    Domain => 'RT::Queue-Role');
+    unless ($id) {
+        $RT::Logger->error("Couldn't create a Queue group of type '$type' for queue ".
+                            $self->Id.": ".$msg);
+        return(undef);
+    }
+
+    return $id;
 }
 
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list