Skip to content

Commit

Permalink
Item9646: Default to AdminUser, not group, for cli scripts
Browse files Browse the repository at this point in the history
Item9675: Propagate user cli paramter when not in GATEWAY environment

This change overrides a WARNING in UI.pm, and needs review before
being accepted as a good fix for 1.1.

Issue with statistics only processing the Main web by default
still exists.

git-svn-id: http://svn.foswiki.org/trunk@9148 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Sep 16, 2010
1 parent e442e20 commit 605fa12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Engine/CLI.pm
Expand Up @@ -77,7 +77,7 @@ sub prepareHeaders {
delete $this->{user};
}
else {
$req->remoteUser( $Foswiki::cfg{SuperAdminGroup} );
$req->remoteUser( $Foswiki::cfg{AdminUserWikiName} );
}
}

Expand Down
14 changes: 10 additions & 4 deletions core/lib/Foswiki/UI.pm
Expand Up @@ -290,8 +290,6 @@ $sub method. Returns the Foswiki::Response object.
sub _execute {
my ( $req, $sub, %initialContext ) = @_;

# DO NOT pass in $req->remoteUser here (even though it appears to be right)
# because it may occlude the login manager.
my $session;
my $res;

Expand All @@ -303,7 +301,15 @@ sub _execute {
# Error::Simple and EngineException indicate something more
# basic, however, that we can't clean up.
try {
$session = new Foswiki( undef, $req, \%initialContext );

# DO NOT pass in $req->remoteUser here (even though it appears to be right)
# because it may occlude the login manager. Exception is when running in
# CLI environment.

$session = new Foswiki(
( defined $ENV{GATEWAY_INTERFACE} ) ? undef : $req->remoteUser(),
$req, \%initialContext );

$res = $session->{response};
unless ( defined $res->status() && $res->status() =~ /^\s*3\d\d/ ) {
$session->getLoginManager()->checkAccess();
Expand Down Expand Up @@ -384,7 +390,7 @@ sub _execute {
$html .= CGI::end_html();
$res->print($html);
}
$Foswiki::engine->finalizeError($res, $session->{request});
$Foswiki::engine->finalizeError( $res, $session->{request} );
return $e->{status};
}
catch Error::Simple with {
Expand Down

0 comments on commit 605fa12

Please sign in to comment.