diff --git a/lib/WebGUI/Operation/DatabaseLink.pm b/lib/WebGUI/Operation/DatabaseLink.pm index ce8266760..15c882e2b 100644 --- a/lib/WebGUI/Operation/DatabaseLink.pm +++ b/lib/WebGUI/Operation/DatabaseLink.pm @@ -31,7 +31,7 @@ Utility routine for creating the AdminConsole for DatabaseLink functions. =head3 $session -The current WebGUI session variable. +The current WebGUI session object. =head3 $workarea diff --git a/lib/WebGUI/Operation/LDAPLink.pm b/lib/WebGUI/Operation/LDAPLink.pm index 36df6696b..a27ed5a6b 100644 --- a/lib/WebGUI/Operation/LDAPLink.pm +++ b/lib/WebGUI/Operation/LDAPLink.pm @@ -18,56 +18,115 @@ use WebGUI::International; use WebGUI::Paginator; use WebGUI::SQL; +=head1 NAME + +Package WebGUI::Operation::LDAPLink + +=head1 DESCRIPTION + +Operational handler for creating, managing and deleting LDAP Links. Only users +in group Admin (3) are allowed to execute subroutines in this package. + +=cut + #------------------------------------------------------------------- + +=head2 _submenu ( $session, $workarea, $title, $help ) + +Utility routine for creating the AdminConsole for LDAPLink functions. + +=head3 $session + +The current WebGUI session object. + +=head3 $workarea + +The content to display to the user. + +=head3 $title + +The title of the Admin Console. This should be an entry in the i18n +table in the WebGUI namespace. + +=head3 $help + +An entry in the Help system in the WebGUI namespace. This will be shown +as a link to the user. + +=cut + sub _submenu { my $session = shift; my $workarea = shift; my $title = shift; my $i18n = WebGUI::International->new($session,"AuthLDAP"); - $title = $i18n->get($title) if ($title); - my $help = shift; - my $ac = WebGUI::AdminConsole->new($session,"ldapconnections"); - if ($help) { - $ac->setHelp($help,"AuthLDAP"); - } - my $returnUrl = ""; - if($session->form->process("returnUrl")) { - $returnUrl = ";returnUrl=".$session->url->escape($session->form->process("returnUrl")); - } - $ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid=new'.$returnUrl), $i18n->get("LDAPLink_982")); - if ($session->form->process("op") eq "editLDAPLink" && $session->form->process("llid") ne "new") { - $ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid='.$session->form->process("llid").$returnUrl), $i18n->get("LDAPLink_983")); - $ac->addSubmenuItem($session->url->page('op=copyLDAPLink;llid='.$session->form->process("llid").$returnUrl), $i18n->get("LDAPLink_984")); - $ac->addSubmenuItem($session->url->page('op=deleteLDAPLink;llid='.$session->form->process("llid")), $i18n->get("LDAPLink_985")); - $ac->addSubmenuItem($session->url->page('op=listLDAPLinks'.$returnUrl), $i18n->get("LDAPLink_986")); - } - return $ac->render($workarea, $title); + $title = $i18n->get($title) if ($title); + my $help = shift; + my $ac = WebGUI::AdminConsole->new($session,"ldapconnections"); + if ($help) { + $ac->setHelp($help,"AuthLDAP"); + } + my $returnUrl = ""; + if($session->form->process("returnUrl")) { + $returnUrl = ";returnUrl=".$session->url->escape($session->form->process("returnUrl")); + } + $ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid=new'.$returnUrl), $i18n->get("LDAPLink_982")); + if ($session->form->process("op") eq "editLDAPLink" && $session->form->process("llid") ne "new") { + $ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid='.$session->form->process("llid").$returnUrl), $i18n->get("LDAPLink_983")); + $ac->addSubmenuItem($session->url->page('op=copyLDAPLink;llid='.$session->form->process("llid").$returnUrl), $i18n->get("LDAPLink_984")); + $ac->addSubmenuItem($session->url->page('op=deleteLDAPLink;llid='.$session->form->process("llid")), $i18n->get("LDAPLink_985")); + $ac->addSubmenuItem($session->url->page('op=listLDAPLinks'.$returnUrl), $i18n->get("LDAPLink_986")); + } + return $ac->render($workarea, $title); } #------------------------------------------------------------------- +=head2 www_copyLDAPLink ( $session ) + +Copies the requested LDAP link in the form variable C. Adds the words +"Copy of" to the link name. +Returns the user to the List LDAP Links screen. + +=cut + sub www_copyLDAPLink { my $session = shift; - return $session->privilege->insufficient unless ($session->user->isInGroup(3)); - my (%db); - tie %db, 'Tie::CPHash'; - %db = $session->db->quickHash("select * from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid"))); - $db{ldapLinkId} = "new"; - $db{ldapLinkName} = "Copy of ".$db{ldapLinkName}; - $session->db->setRow("ldapLink","ldapLinkId",\%db); - $session->form->process("op") = "listLDAPLinks"; - return www_listLDAPLinks(); + return $session->privilege->insufficient unless ($session->user->isInGroup(3)); + my (%db); + tie %db, 'Tie::CPHash'; + %db = $session->db->quickHash("select * from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid"))); + $db{ldapLinkId} = "new"; + $db{ldapLinkName} = "Copy of ".$db{ldapLinkName}; + $session->db->setRow("ldapLink","ldapLinkId",\%db); + $session->form->process("op") = "listLDAPLinks"; + return www_listLDAPLinks($session); } #------------------------------------------------------------------- + +=head2 www_deleteLDAPLink ( $session ) + +Deletes the requested LDAP Link in the form variable C. Returns the user to the List LDAP Links screen. + +=cut + sub www_deleteLDAPLink { my $session = shift; - return $session->privilege->insufficient unless ($session->user->isInGroup(3)); - $session->db->write("delete from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid"))); - $session->form->process("op") = "listLDAPLinks"; - return www_listLDAPLinks(); + return $session->privilege->insufficient unless ($session->user->isInGroup(3)); + $session->db->write("delete from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid"))); + $session->form->process("op") = "listLDAPLinks"; + return www_listLDAPLinks($session); } #------------------------------------------------------------------- + +=head2 www_editLDAPLink ( $session ) + +Creates a new LDAPLink or edits the LDAPLink defined by form variable C. +Calls www_editLDAPLinkSave when done. + +=cut + sub www_editLDAPLink { my $session = shift; return $session->privilege->insufficient unless ($session->user->isInGroup(3)); @@ -85,15 +144,15 @@ sub www_editLDAPLink { -name => "llid", -value => $session->form->process("llid"), ); - $f->hidden( + $f->hidden( -name => "returnUrl", -value => $session->form->process("returnUrl"), ); - $f->readOnly( + $f->readOnly( -label => $i18n->get("LDAPLink_991"), -value => $session->form->process("llid"), - ); - $f->text( + ); + $f->text( -name => "ldapLinkName", -label => $i18n->get("LDAPLink_992"), -hoverHelp => $i18n->get("LDAPLink_992 description"), @@ -141,13 +200,13 @@ sub www_editLDAPLink { -hoverHelp => $i18n->get('8 description'), -value => $db{ldapPasswordName}, ); - $f->yesNo( - -name=>"ldapSendWelcomeMessage", - -value=>$db{ldapSendWelcomeMessage}, - -label=>$i18n->get(868), - -hoverHelp=>$i18n->get('868 description'), - ); - $f->textarea( + $f->yesNo( + -name=>"ldapSendWelcomeMessage", + -value=>$db{ldapSendWelcomeMessage}, + -label=>$i18n->get(868), + -hoverHelp=>$i18n->get('868 description'), + ); + $f->textarea( -name=>"ldapWelcomeMessage", -value=>$db{ldapWelcomeMessage}, -label=>$i18n->get(869), @@ -181,32 +240,48 @@ sub www_editLDAPLink { } #------------------------------------------------------------------- + +=head2 www_editLDAPLinkSave ( $session ) + +Form post processor for www_editLDAPLink. +Returns the user to www_listLDAPLinks when done. + +=cut + sub www_editLDAPLinkSave { my $session = shift; - return $session->privilege->insufficient unless ($session->user->isInGroup(3)); - my $properties = {}; - $properties->{ldapLinkId} = $session->form->process("llid"); - $properties->{ldapLinkName} = $session->form->process("ldapLinkName"); - $properties->{ldapUrl} = $session->form->process("ldapUrl"); - $properties->{connectDn} = $session->form->process("connectDn"); - $properties->{identifier} = $session->form->process("ldapIdentifier"); - $properties->{ldapUserRDN} = $session->form->process("ldapUserRDN"); - $properties->{ldapIdentity} = $session->form->process("ldapIdentity"); - $properties->{ldapIdentityName} = $session->form->process("ldapIdentityName"); - $properties->{ldapPasswordName} = $session->form->process("ldapPasswordName"); - $properties->{ldapSendWelcomeMessage} = $session->form->yesNo("ldapSendWelcomeMessage"); - $properties->{ldapWelcomeMessage} = $session->form->textarea("ldapWelcomeMessage"); - $properties->{ldapAccountTemplate} = $session->form->template("ldapAccountTemplate"); - $properties->{ldapCreateAccountTemplate} = $session->form->template("ldapCreateAccountTemplate"); - $properties->{ldapLoginTemplate} = $session->form->template("ldapLoginTemplate"); - $session->db->setRow("ldapLink","ldapLinkId",$properties); - if($session->form->process("returnUrl")) { - $session->http->setRedirect($session->form->process("returnUrl")); - } - return www_listLDAPLinks(); + return $session->privilege->insufficient unless ($session->user->isInGroup(3)); + my $properties = {}; + $properties->{ldapLinkId} = $session->form->process("llid"); + $properties->{ldapLinkName} = $session->form->process("ldapLinkName"); + $properties->{ldapUrl} = $session->form->process("ldapUrl"); + $properties->{connectDn} = $session->form->process("connectDn"); + $properties->{identifier} = $session->form->process("ldapIdentifier"); + $properties->{ldapUserRDN} = $session->form->process("ldapUserRDN"); + $properties->{ldapIdentity} = $session->form->process("ldapIdentity"); + $properties->{ldapIdentityName} = $session->form->process("ldapIdentityName"); + $properties->{ldapPasswordName} = $session->form->process("ldapPasswordName"); + $properties->{ldapSendWelcomeMessage} = $session->form->yesNo("ldapSendWelcomeMessage"); + $properties->{ldapWelcomeMessage} = $session->form->textarea("ldapWelcomeMessage"); + $properties->{ldapAccountTemplate} = $session->form->template("ldapAccountTemplate"); + $properties->{ldapCreateAccountTemplate} = $session->form->template("ldapCreateAccountTemplate"); + $properties->{ldapLoginTemplate} = $session->form->template("ldapLoginTemplate"); + $session->db->setRow("ldapLink","ldapLinkId",$properties); + if($session->form->process("returnUrl")) { + $session->http->setRedirect($session->form->process("returnUrl")); + } + return www_listLDAPLinks($session); } #------------------------------------------------------------------- + +=head2 www_listLDAPLinks ( $session ) + +Create a paginated form that lists all LDAP links and allows the user to add, edit or copy LDAP +links. Each LDAP link is tested and the status of that test is returned. + +=cut + sub www_listLDAPLinks { my $session = shift; return $session->privilege->adminOnly() unless($session->user->isInGroup(3)); diff --git a/lib/WebGUI/Operation/Profile.pm b/lib/WebGUI/Operation/Profile.pm index 955a664d0..a187acee6 100644 --- a/lib/WebGUI/Operation/Profile.pm +++ b/lib/WebGUI/Operation/Profile.pm @@ -39,7 +39,7 @@ to be used as template variables in the WebGUI template system. =head3 $session -The current WebGUI session variable. +The current WebGUI session object. =cut @@ -87,7 +87,7 @@ Saves profile data to a user's profile. Does not validate any of the data. =head3 $session -WebGUI session variable +WebGUI session object =head3 $user diff --git a/lib/WebGUI/Operation/ProfileSettings.pm b/lib/WebGUI/Operation/ProfileSettings.pm index 725860098..1ba0a63c1 100644 --- a/lib/WebGUI/Operation/ProfileSettings.pm +++ b/lib/WebGUI/Operation/ProfileSettings.pm @@ -34,11 +34,11 @@ Only users in group Admin (3) are allowed to call subroutines in this package. =head2 _submenu ( $session, $workarea, $title, $help ) -Utility routine for creating the AdminConsole for DatabaseLink functions. +Utility routine for creating the AdminConsole for ProfileSetting functions. =head3 $session -The current WebGUI session variable. +The current WebGUI session object. =head3 $workarea diff --git a/lib/WebGUI/Operation/Replacements.pm b/lib/WebGUI/Operation/Replacements.pm index c23eefb34..a76a4e7c0 100644 --- a/lib/WebGUI/Operation/Replacements.pm +++ b/lib/WebGUI/Operation/Replacements.pm @@ -27,11 +27,11 @@ a search and replace function in word processors. =head2 _submenu ( $session, $workarea, $title, $help ) -Utility routine for creating the AdminConsole for DatabaseLink functions. +Utility routine for creating the AdminConsole for Replacement functions. =head3 $session -The current WebGUI session variable. +The current WebGUI session object. =head3 $workarea diff --git a/lib/WebGUI/Operation/Statistics.pm b/lib/WebGUI/Operation/Statistics.pm index c78e74dec..64fc3b778 100644 --- a/lib/WebGUI/Operation/Statistics.pm +++ b/lib/WebGUI/Operation/Statistics.pm @@ -31,7 +31,7 @@ Utility routine for creating the AdminConsole for Statistics functions. =head3 $session -The current WebGUI session variable. +The current WebGUI session object. =head3 $workarea