--- /dev/null
+<?php
+/*******************************************************************************
+ * Copyright (C) 2007 Easter-eggs
+ * http://ldapsaisie.labs.libre-entreprise.org
+ *
+ * Author: See AUTHORS file in top-level directory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+******************************************************************************/
+
+/*
+ ***********************************************************
+ * Configuration of the Anonymous authentification support *
+ ***********************************************************
+ */
+
+// User id used for anonymous connections
+define('LSAUTHMETHOD_ANONYMOUS_USER','ls');
+
+?>
static private $params = array (
'displayLoginForm' => true,
- 'displayLogoutBtn' => true
+ 'displayLogoutBtn' => true,
+ 'displaySelfAccess' => true
);
function start() {
return self :: $params['displayLogoutBtn'];
}
+ /**
+ * Disable self access
+ *
+ * @retval void
+ **/
+ public function disableSelfAccess() {
+ self :: $params['displaySelfAccess'] = false;
+ }
+
+ /**
+ * Can display or not self access
+ *
+ * @retval boolean
+ **/
+ public function displaySelfAccess() {
+ return self :: $params['displaySelfAccess'];
+ }
+
/*
* For compatibillity until loginForm is migrated in LSauth
*/
--- /dev/null
+<?php
+/*******************************************************************************
+ * Copyright (C) 2007 Easter-eggs
+ * http://ldapsaisie.labs.libre-entreprise.org
+ *
+ * Author: See AUTHORS file in top-level directory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+******************************************************************************/
+
+/**
+ * Anonymous authentication provider for LSauth
+ *
+ * @author Benjamin Renard <brenard@easter-eggs.com>
+ */
+class LSauthMethod_anonymous extends LSauthMethod {
+
+ function LSauthMethod_anonymous() {
+ LSauth :: disableLoginForm();
+ LSauth :: disableLogoutBtn();
+ LSauth :: disableSelfAccess();
+
+ if (!parent :: LSauthMethod())
+ return;
+
+ if ( (!defined('LSAUTHMETHOD_ANONYMOUS_USER')) || (constant('LSAUTHMETHOD_ANONYMOUS_USER') == "")) {
+ LSerror :: addErrorCode('LSauthMethod_anonymous_01');
+ return;
+ }
+ return true;
+ }
+
+ /**
+ * Check Auth Data
+ *
+ * Return authentication data or false
+ *
+ * @retval Array|false Array of authentication data or False
+ **/
+ public function getAuthData() {
+ $this -> authData = array(
+ 'username' => LSAUTHMETHOD_ANONYMOUS_USER
+ );
+ return $this -> authData;
+ }
+
+}
+/*
+ * Error Codes
+ */
+LSerror :: defineError('LSauthMethod_anonymous_01',
+_("LSauthMethod_anonymous : You must define the LSAUTHMETHOD_ANONYMOUS_USER contant in the configuration file.")
+);
+?>
$GLOBALS['Smarty'] -> assign('lang_label',_('Language'));
$GLOBALS['Smarty'] -> assign('displayLogoutBtn',LSauth :: displayLogoutBtn());
+ $GLOBALS['Smarty'] -> assign('displaySelfAccess',LSauth :: displaySelfAccess());
// Infos
if((!empty($_SESSION['LSsession_infos']))&&(is_array($_SESSION['LSsession_infos']))) {
$LSaccess[self :: $topDn] = $access;
}
}
- foreach($LSaccess as $dn => $access) {
- $LSaccess[$dn] = array_merge(
- array(
- 'SELF' => 'My account'
- ),
- $access
- );
+ if (LSauth :: displaySelfAccess()) {
+ foreach($LSaccess as $dn => $access) {
+ $LSaccess[$dn] = array_merge(
+ array(
+ 'SELF' => 'My account'
+ ),
+ $access
+ );
+ }
}
self :: $LSaccess = $LSaccess;
</select>
<input type='submit' value='->'/>
</form>
- {$connected_as} <span id='user_name'>{$LSsession_username}</span>{if $displayLogoutBtn} <a href='index.php?LSsession_logout'><img src='{$LS_IMAGES_DIR}/logout.png' alt='Logout' title='Logout' /></a>{/if}
+ {if $displaySelfAccess}{$connected_as} <span id='user_name'>{$LSsession_username}</span>{/if}{if $displayLogoutBtn} <a href='index.php?LSsession_logout'><img src='{$LS_IMAGES_DIR}/logout.png' alt='Logout' title='Logout' /></a>{/if}
</td>
</tr>
<tr>