diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9807bd8f1..471431026 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -32,6 +32,8 @@ Display the productId in the product manager to make it easier to use with the product macro. http://www.plainblack.com/rfe/request-for-enhancement/product-operation-based#v43RzN_dmRPokd9SCRKWUw + - Added a simple Single Sign On mechanism. + - Added the SessionId macro. 7.3.19 diff --git a/lib/WebGUI/Macro/SessionId.pm b/lib/WebGUI/Macro/SessionId.pm new file mode 100644 index 000000000..a70ef832f --- /dev/null +++ b/lib/WebGUI/Macro/SessionId.pm @@ -0,0 +1,22 @@ +package WebGUI::Macro::SessionId; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2006 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use strict; + +sub process { + my $session = shift; + return $session->getId; +} + + +1; diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index 94d67482c..a4fb13520 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -226,6 +226,8 @@ sub getOperations { 'spectreGetSiteData' => 'WebGUI::Operation::Spectre', 'spectreTest' => 'WebGUI::Operation::Spectre', + 'ssoViaSessionId' => 'WebGUI::Operation::SSO', + 'viewStatistics' => 'WebGUI::Operation::Statistics', 'makePrintable' => 'WebGUI::Operation::Style', diff --git a/lib/WebGUI/Operation/SSO.pm b/lib/WebGUI/Operation/SSO.pm new file mode 100644 index 000000000..37434fd42 --- /dev/null +++ b/lib/WebGUI/Operation/SSO.pm @@ -0,0 +1,55 @@ +package WebGUI::Operation::SSO; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2006 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; + +=head1 NAME + +Package WebGUI::Operation::Admin + +=head1 DESCRIPTION + +Operation handler for admin functions + +=cut + +#------------------------------------------------------------------- + +=head2 www_switchOffAdmin ( ) + +If the current user is in the Turn On Admin Group, then allow them to turn off Admin mode +via WebGUI::Session::Var::switchAdminOff() + + +=cut + +sub www_ssoViaSessionId { + my $session = shift; + my $sessionId = $session->form->get("sessionId"); + if (defined $sessionId && $sessionId ne "") { + if ($sessionId eq $session->getId) { + # we're already the correct session + } + else { + my ($userId) = $session->db->quickArray("select userId from userSession where sessionId=?",[$sessionId]); + if (defined $userId && $userId ne "") { + $session->var->end; + $session->var->start($userId, $sessionId); + } + } + } + return undef; +} + + + +1;