[Rt-commit] rt branch, admin_ui, updated. 5014e43d8452ad5a14f8dd55c353e9116004929e

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Dec 1 01:38:33 EST 2009


The branch, admin_ui has been updated
       via  5014e43d8452ad5a14f8dd55c353e9116004929e (commit)
      from  670bd315c0ba97cd1ddf88f3f64a0e6c805eb3d6 (commit)

Summary of changes:
 lib/RT/Action/EditGroupRights.pm |   10 +---------
 lib/RT/Action/EditRights.pm      |   15 +++++++++++++--
 lib/RT/Action/EditUserRights.pm  |   10 +---------
 3 files changed, 15 insertions(+), 20 deletions(-)

- Log -----------------------------------------------------------------
commit 5014e43d8452ad5a14f8dd55c353e9116004929e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Dec 1 14:38:22 2009 +0800

    move comment arguments stuff to base class for rights action

diff --git a/lib/RT/Action/EditGroupRights.pm b/lib/RT/Action/EditGroupRights.pm
index 4c63e32..2393f96 100644
--- a/lib/RT/Action/EditGroupRights.pm
+++ b/lib/RT/Action/EditGroupRights.pm
@@ -9,15 +9,7 @@ use Scalar::Defer;
 sub arguments {
     my $self = shift;
     return {} unless $self->object;
-    my $args = {};
-    $args->{object_id} = {
-        render_as     => 'hidden',
-        default_value => $self->object->id,
-    };
-    $args->{object_type} = {
-        render_as     => 'hidden',
-        default_value => ref $self->object,
-    };
+    my $args = $self->SUPER::arguments( @_ );
 
     my @groups;
 
diff --git a/lib/RT/Action/EditRights.pm b/lib/RT/Action/EditRights.pm
index 32b7c12..d055540 100644
--- a/lib/RT/Action/EditRights.pm
+++ b/lib/RT/Action/EditRights.pm
@@ -8,10 +8,21 @@ use Scalar::Defer;
 
 __PACKAGE__->mk_accessors('object');
 
+# don't use this directly, use EditUserRights or EditGroupRights instead
 sub arguments {
     my $self = shift;
-    $self->log->fatal(
-        "Use one of the subclasses, EditUserRights or EditGroupRights" );
+    return {} unless $self->object;
+
+    my $args = {};
+    $args->{object_id} = {
+        render_as     => 'hidden',
+        default_value => $self->object->id,
+    };
+    $args->{object_type} = {
+        render_as     => 'hidden',
+        default_value => ref $self->object,
+    };
+    return $args;
 }
 
 =head2 take_action
diff --git a/lib/RT/Action/EditUserRights.pm b/lib/RT/Action/EditUserRights.pm
index 3d6d5ef..3d0741c 100644
--- a/lib/RT/Action/EditUserRights.pm
+++ b/lib/RT/Action/EditUserRights.pm
@@ -9,15 +9,7 @@ use Scalar::Defer;
 sub arguments {
     my $self = shift;
     return {} unless $self->object;
-    my $args = {};
-    $args->{object_id} = {
-        render_as     => 'hidden',
-        default_value => $self->object->id,
-    };
-    $args->{object_type} = {
-        render_as     => 'hidden',
-        default_value => ref $self->object,
-    };
+    my $args = $self->SUPER::arguments( @_ );
 
     my $privileged =
       RT::Model::Group->new( current_user => Jifty->web->current_user );

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


More information about the Rt-commit mailing list