an absolute slew of changes.
This commit is contained in:
parent
9499e17cfd
commit
e33c7bebc3
22 changed files with 80 additions and 68 deletions
|
|
@ -51,7 +51,7 @@ via WebGUI::Session::switchAdminOff()
|
|||
sub www_switchOffAdmin {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
return "" unless ($session->user->isInGroup(12));
|
||||
WebGUI::Session::switchAdminOff();
|
||||
$session->var->switchAdminOff();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -60,14 +60,13 @@ sub www_switchOffAdmin {
|
|||
=head2 www_adminConsole ( )
|
||||
|
||||
If the current user is in the Turn On Admin Group, then allow them to turn on Admin mode.
|
||||
via WebGUI::Session::switchAdminOn()
|
||||
|
||||
=cut
|
||||
|
||||
sub www_switchOnAdmin {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
return "" unless ($session->user->isInGroup(12));
|
||||
WebGUI::Session::switchAdminOn();
|
||||
$session->var->switchAdminOn();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ Get the instance of this object or create a new instance if none exists
|
|||
=cut
|
||||
|
||||
sub getInstance {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
#Get Auth Settings
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
#Get Auth Settings
|
||||
my $authMethod = $session->user->authMethod || $session->setting->get("authMethod");
|
||||
$authMethod = $session->setting->get("authMethod") if($session->user->userId eq '1');
|
||||
$authMethod = $_[0] if($_[0] && isIn($_[0], @{$session->config->get("authMethods")}));
|
||||
|
|
@ -41,8 +41,8 @@ sub getInstance {
|
|||
my $load = "use ".$cmd;
|
||||
eval($load);
|
||||
$session->errorHandler->fatal("Authentication module failed to compile: $cmd.".$@) if($@);
|
||||
my $auth = eval{$cmd->new($session, $authMethod,$userId)};
|
||||
$session->errorHandler->fatal("Couldn't instantiate authentication module: $authMethod. Root cause: ".$@) if($@);
|
||||
my $auth = eval{$cmd->new($session, $authMethod,$userId)};
|
||||
$session->errorHandler->fatal("Couldn't instantiate authentication module: $authMethod. Root cause: ".$@) if($@);
|
||||
return $auth;
|
||||
}
|
||||
|
||||
|
|
@ -59,16 +59,16 @@ is returned.
|
|||
|
||||
sub www_auth {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my $auth;
|
||||
($auth) = $session->db->quickArray("select authMethod from users where username=".$session->db->quote($session->form->process("username"))) if($session->form->process("username"));
|
||||
my $authMethod = getInstance($session,$auth);
|
||||
my $methodCall = shift || $session->form->process("method") || "init";
|
||||
if(!$authMethod->isCallable($methodCall)){
|
||||
$session->errorHandler->security("access uncallable auth method");
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
return $i18n->get(1077);
|
||||
}
|
||||
return $session->style->userStyle($authMethod->$methodCall);
|
||||
my $auth;
|
||||
($auth) = $session->db->quickArray("select authMethod from users where username=".$session->db->quote($session->form->process("username"))) if($session->form->process("username"));
|
||||
my $authMethod = getInstance($session,$auth);
|
||||
my $methodCall = shift || $session->form->process("method") || "init";
|
||||
if(!$authMethod->isCallable($methodCall)){
|
||||
$session->errorHandler->security("access uncallable auth method");
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
return $i18n->get(1077);
|
||||
}
|
||||
return $session->style->userStyle($authMethod->$methodCall);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ sub www_flushCache {
|
|||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||
my $cache = WebGUI::Cache->new($session,);
|
||||
$cache->flush;
|
||||
return www_manageCache();
|
||||
return www_manageCache($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -108,7 +108,7 @@ sub www_manageCache {
|
|||
'</td></tr>';
|
||||
|
||||
$output .= "</table>";
|
||||
return _submenu($output);
|
||||
return _submenu($session,$output);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ sub validateProfileData {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editProfile {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
return WebGUI::Operation::Auth::www_auth("init") if($session->user->userId eq '1');
|
||||
return WebGUI::Operation::Auth::www_auth($session,"init") if($session->user->userId eq '1');
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} .= '<h1>'.$i18n->get(338).'</h1>';
|
||||
|
|
@ -105,7 +105,7 @@ sub www_editProfile {
|
|||
$vars->{'profile.form.hidden'} = WebGUI::Form::hidden($session,{"name"=>"op","value"=>"editProfileSave"});
|
||||
$vars->{'profile.form.hidden'} .= WebGUI::Form::hidden($session,{"name"=>"uid","value"=>$session->user->userId});
|
||||
my @array = ();
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
next unless $category->isEditable;
|
||||
my @temp = ();
|
||||
foreach my $field (@{$category->getFields}) {
|
||||
|
|
@ -150,7 +150,7 @@ sub www_editProfileSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_viewProfile {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my $u = WebGUI::User->new($session->form->process("uid"));
|
||||
my $u = WebGUI::User->new($session,$session->form->process("uid"));
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} = '<h1>'.$i18n->get(347).' '.$u->username.'</h1>';
|
||||
|
|
@ -161,7 +161,7 @@ sub www_viewProfile {
|
|||
return $session->privilege->insufficient() if(!$session->user->isInGroup(2));
|
||||
|
||||
my @array = ();
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
next unless ($category->get("visible"));
|
||||
push(@array, {'profile.category' => $category->getLabel});
|
||||
foreach my $field (@{$category->getFields}) {
|
||||
|
|
@ -175,9 +175,10 @@ sub www_viewProfile {
|
|||
}
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
if ($session->user->userId eq $session->form->process("uid")) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions($session);
|
||||
}
|
||||
return $session->style->userStyle(WebGUI::Asset::Template->new("PBtmpl0000000000000052")->process($vars));
|
||||
|
||||
return $session->style->userStyle(WebGUI::Asset::Template->new($session,"PBtmpl0000000000000052")->process($vars));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ sub www_editProfileField {
|
|||
-value => $data->{dataDefault},
|
||||
);
|
||||
my %hash;
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
$hash{$category->getId} = $category->getLabel;
|
||||
}
|
||||
$f->selectBox(
|
||||
|
|
@ -266,7 +266,7 @@ sub www_editProfileSettings {
|
|||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||
my $i18n = WebGUI::International->new($session,"WebGUIProfile");
|
||||
my $output = "";
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
$output .= $session->icon->delete('op=deleteProfileCategoryConfirm;cid='.$category->getId,'',$i18n->get(466));
|
||||
$output .= $session->icon->edit('op=editProfileCategory;cid='.$category->getId);
|
||||
$output .= $session->icon->moveUp('op=moveProfileCategoryUp;cid='.$category->getId);
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ sub www_editUser {
|
|||
my $style = '" style="display: none;' unless ($_ eq $u->authMethod);
|
||||
$tabform->getTab("account")->raw('<tr id="'.$_.$style.'"><td colspan="2" align="center"><table>'.$authInstance->editUserForm.'<tr><td width="170"> </td><td> </td></tr></table></td></tr>');
|
||||
}
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories($session)}) {
|
||||
$tabform->getTab("profile")->raw('<tr><td colspan="2" class="tableHeader">'.$category->getLabel.'</td></tr>');
|
||||
foreach my $field (@{$category->getFields}) {
|
||||
next if $field->getId =~ /contentPositions/;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ sub www_setup {
|
|||
$session->setting->set('companyURL',$session->form->url("companyURL"));
|
||||
$session->setting->set('companyEmail',$session->form->email("companyEmail"));
|
||||
$session->http->setRedirect($session->url->gateway());
|
||||
$session->http->getHeader;
|
||||
return "";
|
||||
} else {
|
||||
$output .= '<legend align="left">Admin Account</legend>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue