[Rt-commit] r3512 - in rt/branches/3.5-TESTING: . lib/RT

trs at bestpractical.com trs at bestpractical.com
Wed Jul 20 18:25:40 EDT 2005


Author: trs
Date: Wed Jul 20 18:25:39 2005
New Revision: 3512

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/lib/RT/User_Overlay.pm
Log:
 r5318 at wintermute:  tom | 2005-07-20 18:23:57 -0400
 Two methods were duplicated.  Discovery and patch by Joby Walker.


Modified: rt/branches/3.5-TESTING/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/User_Overlay.pm	(original)
+++ rt/branches/3.5-TESTING/lib/RT/User_Overlay.pm	Wed Jul 20 18:25:39 2005
@@ -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 {


More information about the Rt-commit mailing list