[Rt-commit] r6202 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Sat Oct 14 21:51:01 EDT 2006


Author: ruz
Date: Sat Oct 14 21:51:00 2006
New Revision: 6202

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm

Log:
 r3943 at cubic-pc:  cubic | 2006-10-13 01:27:32 +0400
 * check empty right earlier
 * check that canonicalizing right works fine


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm	Sat Oct 14 21:51:00 2006
@@ -215,11 +215,18 @@
 
 sub Create {
     my $self = shift;
-    my %args = ( PrincipalId   => undef,
-                 PrincipalType => undef,
-                 RightName     => undef,
-                 Object        => undef,
-                 @_ );
+    my %args = (
+        PrincipalId   => undef,
+        PrincipalType => undef,
+        RightName     => undef,
+        Object        => undef,
+        @_
+    );
+
+    unless ( $args{'RightName'} ) {
+        return ( 0, $self->loc('No right specified') );
+    }
+
     #if we haven't specified any sort of right, we're talking about a global right
     if (!defined $args{'Object'} && !defined $args{'ObjectId'} && !defined $args{'ObjectType'}) {
         $args{'Object'} = $RT::System;
@@ -261,11 +268,11 @@
     # }}}
 
     # {{{ Canonicalize and check the right name
-    unless ( $args{'RightName'} ) {
-        return ( 0, $self->loc('Invalid right') );
+    my $canonic_name = $self->CanonicalizeRightName( $args{'RightName'} );
+    unless ( $canonic_name ) {
+        return ( 0, $self->loc("Invalid right. Couldn't canonicalize right '$args{'RightName'}'") );
     }
-
-    $args{'RightName'} = $self->CanonicalizeRightName( $args{'RightName'} );
+    $args{'RightName'} = $canonic_name;
 
     #check if it's a valid RightName
     if ( ref ($args{'Object'} eq 'RT::Queue'  )) {


More information about the Rt-commit mailing list