[Rt-commit] rt branch, 4.4/custom-role-serializer, created. rt-4.4.2-2-g0e101d5

Shawn Moore shawn at bestpractical.com
Tue Oct 10 11:14:47 EDT 2017


The branch, 4.4/custom-role-serializer has been created
        at  0e101d521a95998a4e45c40e5b85ce27843035a9 (commit)

- Log -----------------------------------------------------------------
commit 2c7bbf54c23251a50ec24beca146859898fd1649
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Oct 10 15:01:40 2017 +0000

    Add CustomRoleObj to ObjectCustomRole dependencies

diff --git a/lib/RT/ObjectCustomRole.pm b/lib/RT/ObjectCustomRole.pm
index 5523a08..e72e4e1 100644
--- a/lib/RT/ObjectCustomRole.pm
+++ b/lib/RT/ObjectCustomRole.pm
@@ -196,6 +196,15 @@ sub Delete {
     return ($ok, $msg);
 }
 
+sub FindDependencies {
+    my $self = shift;
+    my ($walker, $deps) = @_;
+
+    $self->SUPER::FindDependencies($walker, $deps);
+
+    $deps->Add( out => $self->CustomRoleObj );
+    $deps->Add( out => $self->QueueObj );
+}
 
 =head2 id
 

commit 0e101d521a95998a4e45c40e5b85ce27843035a9
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Oct 10 15:05:26 2017 +0000

    Use indirection for serializing ObjectCustomRole -> ObjectId

diff --git a/lib/RT/ObjectCustomRole.pm b/lib/RT/ObjectCustomRole.pm
index e72e4e1..eff3fd1 100644
--- a/lib/RT/ObjectCustomRole.pm
+++ b/lib/RT/ObjectCustomRole.pm
@@ -206,6 +206,19 @@ sub FindDependencies {
     $deps->Add( out => $self->QueueObj );
 }
 
+sub Serialize {
+    my $self = shift;
+    my %args = (@_);
+    my %store = $self->SUPER::Serialize(@_);
+
+    if ($store{ObjectId}) {
+        my $obj = RT::Queue->new( RT->SystemUser );
+        $obj->Load( $store{ObjectId} );
+        $store{ObjectId} = \($obj->UID);
+    }
+    return %store;
+}
+
 =head2 id
 
 Returns the current value of id.

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


More information about the rt-commit mailing list