[Rt-commit] rt branch, 3.8-trunk, updated. dbc6ad7e5ad5a5d50be54b66d39dae4a63431a5a
Ruslan Zakirov
ruz at bestpractical.com
Wed Jul 29 11:51:32 EDT 2009
The branch, 3.8-trunk has been updated
via dbc6ad7e5ad5a5d50be54b66d39dae4a63431a5a (commit)
via 5e987067f1d9bd545e03cde193f7160e5905ef5d (commit)
via 20d879f2c391c6631b90f8544a453c7993997350 (commit)
via f7df4041284ccd547531affe489cb6de0b323060 (commit)
from 9dd1750c323ab97262cd6abf143f498205a96c13 (commit)
Summary of changes:
etc/upgrade/3.8.4/content | 3 ++-
lib/RT/User_Overlay.pm | 21 +++++++++++----------
share/html/Elements/ShowUserConcise | 23 ++---------------------
3 files changed, 15 insertions(+), 32 deletions(-)
- Log -----------------------------------------------------------------
commit f7df4041284ccd547531affe489cb6de0b323060
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date: Wed Jul 29 14:46:17 2009 +0400
* use strict in upgrade subs, fix varaible typo
diff --git a/etc/upgrade/3.8.4/content b/etc/upgrade/3.8.4/content
index ddf778c..be5a6bf 100644
--- a/etc/upgrade/3.8.4/content
+++ b/etc/upgrade/3.8.4/content
@@ -2,6 +2,7 @@
@Final = (
sub {
$RT::Logger->debug("Going to correct arguments of NotifyGroup actions if you have any");
+ use strict;
my $actions = RT::ScripActions->new( $RT::SystemUser );
$actions->Limit(
@@ -41,7 +42,7 @@
my $argument = $action->Argument;
my $new = '';
local $@;
- if ( my $struct = eval { Storable::thaw( $arg ) } ) {
+ if ( my $struct = eval { Storable::thaw( $argument ) } ) {
$new = $converter->( $struct );
} else {
$new = join /, /, grep length, split /[^0-9]+/, $argument;
commit 20d879f2c391c6631b90f8544a453c7993997350
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date: Wed Jul 29 19:47:04 2009 +0400
* delete Privileged check from ShowUserConcise
This check can cause at least two SQL queries what is not desirable
in such often called component
diff --git a/share/html/Elements/ShowUserConcise b/share/html/Elements/ShowUserConcise
index 1cbba1b..3cdba10 100644
--- a/share/html/Elements/ShowUserConcise
+++ b/share/html/Elements/ShowUserConcise
@@ -46,26 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
%# Released under the terms of version 2 of the GNU Public License
-<%INIT>
-if ($User) {
- my $printable;
- if ( $User->Privileged ) {
- $printable = $User->RealName
- || $User->NickName
- || $User->Name
- || $User->EmailAddress;
- }
- else {
- $printable = $User->EmailAddress
- || $User->Name
- || $User->RealName
- || $User->NickName;
- }
- $m->out( $m->interp->apply_escapes( $printable, 'h' ) );
-}
-
-</%INIT>
+<% $User->RealName || $User->Name %>\
<%ARGS>
-$User => undef
-$Address => undef
+$User
</%ARGS>
commit 5e987067f1d9bd545e03cde193f7160e5905ef5d
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date: Wed Jul 29 19:49:54 2009 +0400
get rid of PrincipalObj call where it's possible before calling HasMember
PrincipalObj can generate a SQL query when HasMember works just fine
with principal's id.
diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index bfd7271..a7982e5 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -282,9 +282,9 @@ sub SetPrivileged {
unless ( $self->CurrentUser->HasRight(Right => 'AdminUsers', Object => $RT::System) ) {
return ( 0, $self->loc('Permission Denied') );
}
+
my $priv = RT::Group->new($self->CurrentUser);
$priv->LoadSystemInternalGroup('Privileged');
-
unless ($priv->Id) {
$RT::Logger->crit("Could not find Privileged pseudogroup");
return(0,$self->loc("Failed to find 'Privileged' users pseudogroup."));
@@ -297,13 +297,14 @@ sub SetPrivileged {
return(0,$self->loc("Failed to find 'Unprivileged' users pseudogroup"));
}
+ my $principal = $self->PrincipalId;
if ($val) {
- if ($priv->HasMember($self->PrincipalObj)) {
+ if ($priv->HasMember($principal)) {
#$RT::Logger->debug("That user is already privileged");
return (0,$self->loc("That user is already privileged"));
}
- if ($unpriv->HasMember($self->PrincipalObj)) {
- $unpriv->_DeleteMember($self->PrincipalId);
+ if ($unpriv->HasMember($principal)) {
+ $unpriv->_DeleteMember($principal);
} else {
# if we had layered transactions, life would be good
# sadly, we have to just go ahead, even if something
@@ -311,7 +312,7 @@ sub SetPrivileged {
$RT::Logger->crit("User ".$self->Id." is neither privileged nor ".
"unprivileged. something is drastically wrong.");
}
- my ($status, $msg) = $priv->_AddMember( InsideTransaction => 1, PrincipalId => $self->PrincipalId);
+ my ($status, $msg) = $priv->_AddMember( InsideTransaction => 1, PrincipalId => $principal);
if ($status) {
return (1, $self->loc("That user is now privileged"));
} else {
@@ -319,12 +320,12 @@ sub SetPrivileged {
}
}
else {
- if ($unpriv->HasMember($self->PrincipalObj)) {
+ if ($unpriv->HasMember($principal)) {
#$RT::Logger->debug("That user is already unprivileged");
return (0,$self->loc("That user is already unprivileged"));
}
- if ($priv->HasMember($self->PrincipalObj)) {
- $priv->_DeleteMember( $self->PrincipalId);
+ if ($priv->HasMember($principal)) {
+ $priv->_DeleteMember( $principal );
} else {
# if we had layered transactions, life would be good
# sadly, we have to just go ahead, even if something
@@ -332,7 +333,7 @@ sub SetPrivileged {
$RT::Logger->crit("User ".$self->Id." is neither privileged nor ".
"unprivileged. something is drastically wrong.");
}
- my ($status, $msg) = $unpriv->_AddMember( InsideTransaction => 1, PrincipalId => $self->PrincipalId);
+ my ($status, $msg) = $unpriv->_AddMember( InsideTransaction => 1, PrincipalId => $principal);
if ($status) {
return (1, $self->loc("That user is now unprivileged"));
} else {
@@ -351,7 +352,7 @@ sub Privileged {
my $self = shift;
my $priv = RT::Group->new($self->CurrentUser);
$priv->LoadSystemInternalGroup('Privileged');
- if ($priv->HasMember($self->PrincipalObj)) {
+ if ( $priv->HasMember( $self->PrincipalId ) ) {
return(1);
}
else {
commit dbc6ad7e5ad5a5d50be54b66d39dae4a63431a5a
Merge: 5e98706... 9dd1750...
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date: Wed Jul 29 19:51:19 2009 +0400
Merge branch '3.8-trunk' of git+ssh://diesel.bestpractical.com/git/rt into 3.8-trunk
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list