[Rt-commit] rt branch, 4.2/drop-has-entry-from-acl, created. rt-4.0.6-495-g58de069
Ruslan Zakirov
ruz at bestpractical.com
Sun Aug 26 17:45:15 EDT 2012
The branch, 4.2/drop-has-entry-from-acl has been created
at 58de0690619aa6477b6a12208610419bc6bbccb4 (commit)
- Log -----------------------------------------------------------------
commit 58de0690619aa6477b6a12208610419bc6bbccb4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Aug 27 01:39:34 2012 +0400
delete ->HasEntry from ACL class
it is not used anywhere in the core
slow downs search as it builds hash after every search even
if it's never used
HasEntry calls uncoditionaly ->_DoSearch which repeats SQL
and rebuilds the hash. So this method even worse than
$ACE->LoadByCols check.
It should die in fire.
diff --git a/lib/RT/ACL.pm b/lib/RT/ACL.pm
index 49a7f1d..34fa471 100644
--- a/lib/RT/ACL.pm
+++ b/lib/RT/ACL.pm
@@ -252,76 +252,6 @@ sub Next {
}
-
-
-
-#wrap around _DoSearch so that we can build the hash of returned
-#values
-sub _DoSearch {
- my $self = shift;
- # $RT::Logger->debug("Now in ".$self."->_DoSearch");
- my $return = $self->SUPER::_DoSearch(@_);
- # $RT::Logger->debug("In $self ->_DoSearch. return from SUPER::_DoSearch was $return");
- if ( $self->{'must_redo_search'} ) {
- $RT::Logger->crit(
-"_DoSearch is not so successful as it still needs redo search, won't call _BuildHash"
- );
- }
- else {
- $self->_BuildHash();
- }
- return ($return);
-}
-
-
-#Build a hash of this ACL's entries.
-sub _BuildHash {
- my $self = shift;
-
- while (my $entry = $self->Next) {
- my $hashkey = join '-', map $entry->__Value( $_ ),
- qw(ObjectType ObjectId RightName PrincipalId PrincipalType);
-
- $self->{'as_hash'}->{"$hashkey"} =1;
-
- }
-}
-
-
-
-=head2 HasEntry
-
-=cut
-
-sub HasEntry {
-
- my $self = shift;
- my %args = ( RightScope => undef,
- RightAppliesTo => undef,
- RightName => undef,
- PrincipalId => undef,
- PrincipalType => undef,
- @_ );
-
- #if we haven't done the search yet, do it now.
- $self->_DoSearch();
-
- if ($self->{'as_hash'}->{ $args{'RightScope'} . "-" .
- $args{'RightAppliesTo'} . "-" .
- $args{'RightName'} . "-" .
- $args{'PrincipalId'} . "-" .
- $args{'PrincipalType'}
- } == 1) {
- return(1);
- }
- else {
- return(undef);
- }
-}
-
-# }}}
-
-
=head2 NewItem
Returns an empty new RT::ACE item
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list