[Rt-devel] [3.5 Patch] Duplicate methods in User_Overlay.pm

Joby Walker joby at u.washington.edu
Wed Jul 20 17:08:52 EDT 2005


Two methods are duplicated in RT::User_Overlay.
-- 

Joby Walker
ITI SSG, University of Washington
--
PGP key: https://staff.washington.edu/joby/joby-u-pub.asc
-------------- next part --------------
==== Patch <User_Overlay.pm> level 1
Source: [No source]
Target: e417ac7c-1bcc-0310-8ffa-8f5827389a85:/rt/branches/3.5-TESTING/lib/RT:3397
        (svn://svn.bestpractical.com/rt/branches/3.5-TESTING)
Log:
* Remove duplicate methods
=== User_Overlay.pm
==================================================================
--- User_Overlay.pm  (revision 3397)
+++ User_Overlay.pm  (patch User_Overlay.pm level 1)
@@ -1768,101 +1768,6 @@
 
 # }}}
 
-# {{{ sub SetPreferences
-
-=head2 SetPreferences NAME/OBJ VALUE
-
-  Set user preferences associated with given object or name.
-
-=cut
-
-sub SetPreferences {
-    my $self  = shift;
-    my $name = _PrefName (shift);
-    my $value = shift;
-    my $attr = RT::Attribute->new ($self->CurrentUser);
-    $attr->LoadByNameAndObject (Object => $self, Name => $name);
-    if ($attr->Id) {
-	return $attr->SetContent ($value);
-    }
-    else {
-	return $self->AddAttribute ( Name => $name, Content => $value );
-    }
-}
-
-# }}}
-
-# {{{ sub _CleanupInvalidDelegations
-
-=head2 sub _CleanupInvalidDelegations { InsideTransaction => undef }
-
-Revokes all ACE entries delegated by this user which are inconsistent
-with their current delegation rights.  Does not perform permission
-checks.  Should only ever be called from inside the RT library.
-
-If called from inside a transaction, specify a true value for the
-InsideTransaction parameter.
-
-Returns a true value if the deletion succeeded; returns a false value
-and logs an internal error if the deletion fails (should not happen).
-
-=cut
-
-# XXX Currently there is a _CleanupInvalidDelegations method in both
-# RT::User and RT::Group.  If the recursive cleanup call for groups is
-# ever unrolled and merged, this code will probably want to be
-# factored out into RT::Principal.
-
-sub _CleanupInvalidDelegations {
-    my $self = shift;
-    my %args = ( InsideTransaction => undef,
-		  @_ );
-
-    unless ( $self->Id ) {
-	$RT::Logger->warning("User not loaded.");
-	return (undef);
-    }
-
-    my $in_trans = $args{InsideTransaction};
-
-    return(1) if ($self->HasRight(Right => 'DelegateRights',
-				  Object => $RT::System));
-
-    # Look up all delegation rights currently posessed by this user.
-    my $deleg_acl = RT::ACL->new($RT::SystemUser);
-    $deleg_acl->LimitToPrincipal(Type => 'User',
-				 Id => $self->PrincipalId,
-				 IncludeGroupMembership => 1);
-    $deleg_acl->Limit( FIELD => 'RightName',
-		       OPERATOR => '=',
-		       VALUE => 'DelegateRights' );
-    my @allowed_deleg_objects = map {$_->Object()}
-	@{$deleg_acl->ItemsArrayRef()};
-
-    # Look up all rights delegated by this principal which are
-    # inconsistent with the allowed delegation objects.
-    my $acl_to_del = RT::ACL->new($RT::SystemUser);
-    $acl_to_del->DelegatedBy(Id => $self->Id);
-    foreach (@allowed_deleg_objects) {
-	$acl_to_del->LimitNotObject($_);
-    }
-
-    # Delete all disallowed delegations
-    while ( my $ace = $acl_to_del->Next() ) {
-	my $ret = $ace->_Delete(InsideTransaction => 1);
-	unless ($ret) {
-	    $RT::Handle->Rollback() unless $in_trans;
-	    $RT::Logger->warning("Couldn't delete delegated ACL entry ".$ace->Id);
-	    return (undef);
-	}
-    }
-
-    $RT::Handle->Commit() unless $in_trans;
-    return (1);
-}
-
-# }}}
-
 # {{{ sub _Set
 
 sub _Set {

==== BEGIN SVK PATCH BLOCK ====
Version: svk 1.00 (linux)

eJxtkktu2zAQht11V72BF8ymgC3xpYcLqN6kRVEgLRKlW2FIjWIBtCRQtFED3PkMvUJPkUv0RqWk
BOiimwEH88/Hfzj8ZMsPe+qLIvaExv7hx9fd7js4fbgJGUk81q3rLZHe4BkN4d70T0T4Do4Yqg7s
E7qioKE5W5pv54ZXiJgYClzfjSSfYZWziIR6tud+z3yIIaGh2A/YVbbvXcBTxtNQrCZL2vQjVlPr
JJeTnL3Km9YElvSPI9rq2xmtgct2OM7EFwqfKPKFUrcWdbB3mRQLbq7CMJhL5fCnq9E4mK/gzFOe
J6lKmhpzQFBC5ciEEk2cN1SDQsJEGPputbr++Xh9fvM2HH4Pq9Wvd9fn7V78a38xulAbFXwJxVkt
ALgElsUSkIHMVM2TOJ3ds8S/X9/jsT/juj4NptXgcH1Ed+jr8T8jFwXzhLFlB+W8lt3usWuDYARz
k/jwHgO4Q9igxXNITqe2Jpz6yLpIWej0AceIb+WmvH0ov9x9jkyrovsyKDnPU8LDVxA0BZ3qDVVa
b2JO403WNBCCzFjKsxwy+Rcrt78C
==== END SVK PATCH BLOCK ====


More information about the Rt-devel mailing list