[Rt-commit] rt branch, 4.2/user-set-privileged-transaction, created. rt-4.2.12-126-g59801ee

Dustin Graves dustin at bestpractical.com
Thu May 26 18:31:39 EDT 2016


The branch, 4.2/user-set-privileged-transaction has been created
        at  59801eeea11766dd1c7aaf1732163965a228a22f (commit)

- Log -----------------------------------------------------------------
commit 59801eeea11766dd1c7aaf1732163965a228a22f
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Thu May 26 22:31:14 2016 +0000

    log a transaction when setting or unsetting Privileged status on a User

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index 39b8197..a54e4da 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -260,6 +260,15 @@ sub Create {
         $self->_NewTransaction( Type => "Create" );
     }
 
+    if ( $privileged ) {
+        $self->_NewTransaction(
+            Type => 'Set',
+            Field     => 'Privileged',
+            NewValue  => 1,
+            OldValue  => 0,
+        );
+    }
+
     $RT::Handle->Commit;
 
     return ( $id, $self->loc('User created') );
@@ -363,6 +372,12 @@ sub _SetPrivileged {
         }
         my ($status, $msg) = $priv->_AddMember( InsideTransaction => 1, PrincipalId => $principal);
         if ($status) {
+            $self->_NewTransaction(
+                Type => 'Set',
+                Field     => 'Privileged',
+                NewValue  => 1,
+                OldValue  => 0,
+            );
             return (1, $self->loc("That user is now privileged"));
         } else {
             return (0, $msg);
@@ -383,6 +398,12 @@ sub _SetPrivileged {
         }
         my ($status, $msg) = $unpriv->_AddMember( InsideTransaction => 1, PrincipalId => $principal);
         if ($status) {
+            $self->_NewTransaction(
+                Type => 'Set',
+                Field     => 'Privileged',
+                NewValue  => 0,
+                OldValue  => 1,
+            );
             return (1, $self->loc("That user is now unprivileged"));
         } else {
             return (0, $msg);

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


More information about the rt-commit mailing list