remove switchAdminOn. anyone in group 12 always has admin on
This commit is contained in:
parent
e9f793365b
commit
45ca3ea8d8
3 changed files with 4 additions and 37 deletions
|
|
@ -800,9 +800,6 @@ sub www_view {
|
||||||
my $var;
|
my $var;
|
||||||
$var->{backToSiteUrl} = $url->page;
|
$var->{backToSiteUrl} = $url->page;
|
||||||
|
|
||||||
# temporary! We are now in admin mode!
|
|
||||||
$session->switchAdminOn;
|
|
||||||
|
|
||||||
# Add vars for AdminBar
|
# Add vars for AdminBar
|
||||||
$var->{adminPlugins} = $self->getAdminPluginTemplateVars;
|
$var->{adminPlugins} = $self->getAdminPluginTemplateVars;
|
||||||
$var->{newContentTabs} = $self->getNewContentTemplateVars;
|
$var->{newContentTabs} = $self->getNewContentTemplateVars;
|
||||||
|
|
|
||||||
|
|
@ -779,6 +779,9 @@ sub start {
|
||||||
$self->{_sessionId} = $sessionId;
|
$self->{_sessionId} = $sessionId;
|
||||||
$self->cache->set($sessionId, $self->{_var}, $timeout);
|
$self->cache->set($sessionId, $self->{_var}, $timeout);
|
||||||
delete $self->{_var}{nextCacheFlush};
|
delete $self->{_var}{nextCacheFlush};
|
||||||
|
if ( $self->user->isInGroup( 12 ) ) { # Turn Admin On!!
|
||||||
|
$self->{_var}{adminOn} = 1;
|
||||||
|
}
|
||||||
$self->db->setRow("userSession","sessionId",$self->{_var}, $sessionId);
|
$self->db->setRow("userSession","sessionId",$self->{_var}, $sessionId);
|
||||||
$self->scratch->set('webguiCsrfToken', $self->id->generate); # create cross site request forgery token
|
$self->scratch->set('webguiCsrfToken', $self->id->generate); # create cross site request forgery token
|
||||||
}
|
}
|
||||||
|
|
@ -815,39 +818,6 @@ sub style {
|
||||||
return $self->{_style}
|
return $self->{_style}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 switchAdminOff ( )
|
|
||||||
|
|
||||||
Disables admin mode.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub switchAdminOff {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{_var}{adminOn} = 0;
|
|
||||||
$self->cache->set($self->getId, $self->{_var}, $self->setting->get('sessionTimeout'));
|
|
||||||
delete $self->{_var}{nextCacheFlush};
|
|
||||||
$self->db->setRow("userSession","sessionId", $self->{_var});
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 switchAdminOn ( )
|
|
||||||
|
|
||||||
Enables admin mode.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub switchAdminOn {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{_var}{adminOn} = 1;
|
|
||||||
$self->cache->set($self->getId, $self->{_var}, $self->setting->get('sessionTimeout'));
|
|
||||||
delete $self->{_var}{nextCacheFlush};
|
|
||||||
$self->db->setRow("userSession","sessionId", $self->{_var});
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 url ( )
|
=head2 url ( )
|
||||||
|
|
@ -889,13 +859,13 @@ sub user {
|
||||||
my $option = shift;
|
my $option = shift;
|
||||||
if (defined $option) {
|
if (defined $option) {
|
||||||
my $userId = $option->{userId} || $option->{user}->userId;
|
my $userId = $option->{userId} || $option->{user}->userId;
|
||||||
$self->start($userId,$self->getId);
|
|
||||||
if ($self->setting->get("passiveProfilingEnabled")) {
|
if ($self->setting->get("passiveProfilingEnabled")) {
|
||||||
$self->db->write("update passiveProfileLog set userId = ? where sessionId = ?",[$userId,$self->getId]);
|
$self->db->write("update passiveProfileLog set userId = ? where sessionId = ?",[$userId,$self->getId]);
|
||||||
}
|
}
|
||||||
delete $self->{_stow};
|
delete $self->{_stow};
|
||||||
$self->{_user} = $option->{user} || WebGUI::User->new($self, $userId);
|
$self->{_user} = $option->{user} || WebGUI::User->new($self, $userId);
|
||||||
$self->request->env->{REMOTE_USER} = $self->{_user}->username if $self->request;
|
$self->request->env->{REMOTE_USER} = $self->{_user}->username if $self->request;
|
||||||
|
$self->start($userId,$self->getId);
|
||||||
}
|
}
|
||||||
elsif (!exists $self->{_user}) {
|
elsif (!exists $self->{_user}) {
|
||||||
$self->{_user} = WebGUI::User->new($self, $self->get('userId'));
|
$self->{_user} = WebGUI::User->new($self, $self->get('userId'));
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue