*** empty log message ***

This commit is contained in:
jgutierr25 2007-05-21 07:11:12 +00:00
parent ab53054fd1
commit c8afa50ba5
8 changed files with 4167 additions and 440 deletions

1284
auth/cas/CAS/CAS.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,240 @@
<?php
/**
* @file CAS/PGTStorage/pgt-file.php
* Basic class for PGT file storage
*/
/**
* @class PGTStorageFile
* The PGTStorageFile class is a class for PGT file storage. An instance of
* this class is returned by CASClient::SetPGTStorageFile().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageFile
*/
class PGTStorageFile extends PGTStorage
{
/**
* @addtogroup internalPGTStorageFile
* @{
*/
/**
* a string telling where PGT's should be stored on the filesystem. Written by
* PGTStorageFile::PGTStorageFile(), read by getPath().
*
* @private
*/
var $_path;
/**
* This method returns the name of the directory where PGT's should be stored
* on the filesystem.
*
* @return the name of a directory (with leading and trailing '/')
*
* @private
*/
function getPath()
{
return $this->_path;
}
/**
* a string telling the format to use to store PGT's (plain or xml). Written by
* PGTStorageFile::PGTStorageFile(), read by getFormat().
*
* @private
*/
var $_format;
/**
* This method returns the format to use when storing PGT's on the filesystem.
*
* @return a string corresponding to the format used (plain or xml).
*
* @private
*/
function getFormat()
{
return $this->_format;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "file";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageInfo()
{
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageFile().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
* @param $path the path where the PGT's should be stored
*
* @public
*/
function PGTStorageFile($cas_parent,$format,$path)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
// check that the path is an absolute path
if ( $path[0] != '/' ) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
// store the path (with a leading and trailing '/')
$path = preg_replace('|[/]*$|','/',$path);
$path = preg_replace('|^[/]*|','/',$path);
$this->_path = $path;
// check the format and store it
switch ($format) {
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
$this->_format = $format;
break;
default:
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
}
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
phpCAS::traceEnd();
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This method returns the filename corresponding to a PGT Iou.
*
* @param $pgt_iou the PGT iou.
*
* @return a filename
* @private
*/
function getPGTIouFilename($pgt_iou)
{
phpCAS::traceBegin();
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
phpCAS::traceEnd($filename);
return $filename;
}
/**
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
* warning on error.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @public
*/
function write($pgt,$pgt_iou)
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if ( $f=fopen($fname,"w") ) {
if ( fputs($f,$pgt) === FALSE ) {
phpCAS::error('could not write PGT to `'.$fname.'\'');
}
fclose($f);
} else {
phpCAS::error('could not open `'.$fname.'\'');
}
phpCAS::traceEnd();
}
/**
* This method reads a PGT corresponding to a PGT Iou and deletes the
* corresponding file.
*
* @param $pgt_iou the PGT iou
*
* @return the corresponding PGT, or FALSE on error
*
* @public
*/
function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = FALSE;
$fname = $this->getPGTIouFilename($pgt_iou);
if ( !($f=fopen($fname,"r")) ) {
phpCAS::trace('could not open `'.$fname.'\'');
} else {
if ( ($pgt=fgets($f)) === FALSE ) {
phpCAS::trace('could not read PGT from `'.$fname.'\'');
}
fclose($f);
}
// delete the PGT file
@unlink($fname);
phpCAS::traceEnd($pgt);
return $pgt;
}
/** @} */
}
?>

View File

@ -0,0 +1,189 @@
<?php
/**
* @file CAS/PGTStorage/pgt-main.php
* Basic class for PGT storage
*/
/**
* @class PGTStorage
* The PGTStorage class is a generic class for PGT storage. This class should
* not be instanciated itself but inherited by specific PGT storage classes.
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorage
*/
class PGTStorage
{
/**
* @addtogroup internalPGTStorage
* @{
*/
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The constructor of the class, should be called only by inherited classes.
*
* @param $cas_parent the CASclient instance that creates the current object.
*
* @protected
*/
function PGTStorage($cas_parent)
{
phpCAS::traceBegin();
if ( !$cas_parent->isProxy() ) {
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
}
phpCAS::traceEnd();
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This virtual method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @public
*/
function getStorageType()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
// ########################################################################
// ERROR HANDLING
// ########################################################################
/**
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
* read by PGTStorage::getErrorMessage().
*
* @hideinitializer
* @private
* @deprecated not used.
*/
var $_error_message=FALSE;
/**
* This method sets en error message, which can be read later by
* PGTStorage::getErrorMessage().
*
* @param $error_message an error message
*
* @protected
* @deprecated not used.
*/
function setErrorMessage($error_message)
{
$this->_error_message = $error_message;
}
/**
* This method returns an error message set by PGTStorage::setErrorMessage().
*
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
* otherwise.
*
* @public
* @deprecated not used.
*/
function getErrorMessage()
{
return $this->_error_message;
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* a boolean telling if the storage has already been initialized. Written by
* PGTStorage::init(), read by PGTStorage::isInitialized().
*
* @hideinitializer
* @private
*/
var $_initialized = FALSE;
/**
* This method tells if the storage has already been intialized.
*
* @return a boolean
*
* @protected
*/
function isInitialized()
{
return $this->_initialized;
}
/**
* This virtual method initializes the object.
*
* @protected
*/
function init()
{
$this->_initialized = TRUE;
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This virtual method stores a PGT and its corresponding PGT Iuo.
* @note Should never be called.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @protected
*/
function write($pgt,$pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
* the corresponding storage entry.
* @note Should never be called.
*
* @param $pgt_iou the PGT iou
*
* @protected
*/
function read($pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/** @} */
}
// include specific PGT storage classes
include_once(dirname(__FILE__).'/pgt-file.php');
// incompatibility with Moodle
//include_once(dirname(__FILE__).'/pgt-db.php');
?>

2078
auth/cas/CAS/client.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,4 @@
CAS-module README
Please read comments from lib.php for auth/cas module
The auth/cas module is using part of the /auth/ldap module. The /auth/ldap directory should exist.
The auth/cas use the PHPCAS project from http://esup-phpcas.sourceforge.net

View File

@ -15,7 +15,7 @@ if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir.'/authlib.php');
require_once('CAS/CAS.php');
require_once($CFG->dirroot.'/auth/cas/CAS/CAS.php');
/**
* CAS authentication plugin.
*/

View File

@ -1,434 +1,374 @@
<?php
global $CFG;
require_once 'languages.php';
$createoptions[0] = get_string("no");
$createoptions[1] = get_string("yes");
// set to defaults if undefined (CAS)
if (!isset ($config->hostname))
$config->hostname = '';
if (!isset ($config->port))
$config->port = '';
if (!isset ($config->casversion))
$config->casversion = '';
if (!isset ($config->baseuri))
$config->baseuri = '';
if (!isset ($config->language))
$config->language = '';
if (!isset ($config->use_cas))
$config->use_cas = '';
if (!isset ($config->proxycas))
$config->proxycas = '';
if (!isset ($config->logoutcas))
$config->logoutcas = '';
if (!isset ($config->multiauth))
$config->multiauth = '';
// set to defaults if undefined (LDAP)
if (!isset($config->host_url))
{ $config->host_url = ''; }
if (empty($config->ldapencoding))
{ $config->ldapencoding = 'utf-8'; }
if (!isset($config->contexts))
{ $config->contexts = ''; }
if (!isset($config->user_type))
{ $config->user_type = 'default'; }
if (!isset($config->user_attribute))
{ $config->user_attribute = ''; }
if (!isset($config->search_sub))
{ $config->search_sub = ''; }
if (!isset($config->opt_deref))
{ $config->opt_deref = LDAP_DEREF_NEVER; }
if (!isset($config->bind_dn))
{$config->bind_dn = ''; }
if (!isset($config->bind_pw))
{$config->bind_pw = ''; }
if (!isset($config->version))
{$config->version = '2'; }
if (!isset($config->objectclass))
{$config->objectclass = ''; }
if (!isset($config->memberattribute))
{$config->memberattribute = ''; }
if (!isset($config->memberattribute_isdn))
{$config->memberattribute_isdn = ''; }
if (!isset($config->groupecreators))
{$config->groupecreators = ''; }
if (!isset($config->attrcreators))
{$config->attrcreators = ''; }
if (!isset($config->removeuser))
{$config->removeuser = 0; }
$yesno = array( get_string('no'), get_string('yes') );
if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
notify(get_string('auth_ldap_noextension','auth'));
}
?>
<table cellspacing="0" cellpadding="5" border="0" align="center">
<tr>
<td colspan="2">
<h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_use_cas', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'use_cas', $config->use_cas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_enabled', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
<td>
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
<?php
if (isset($err['hostname'])) {
formerr($err['hostname']);
}
?>
</td>
<td><?php print_string('auth_cas_hostname', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
<td>
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
<?php
if (isset($err['baseuri'])) {
formerr($err['baseuri']);
}
?>
</td>
<td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
<td>
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
<?php
if (isset($err['port'])) {
formerr($err['port']);
}
?>
</td>
<td><?php print_string('auth_cas_port', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
<td>
<input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
<?php
if (isset($err['casversion'])) {
formerr($err['casversion']);
}
?>
</td>
<td><?php print_string('auth_cas_version', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
<td>
<?php
choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
?>
</td>
<td><?php print_string('auth_cas_language', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_proxycas_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'proxycas', $config->proxycas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_proxycas', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'logoutcas', $config->logoutcas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_logoutcas', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_multiauth_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'multiauth', $config->multiauth, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_multiauth', 'auth') ?></td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
<td>
<input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
<?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
</td>
<td>
<?php print_string('auth_ldap_host_url','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
<td>
<?php
$versions = array();
$versions[2] = '2';
$versions[3] = '3';
choose_from_menu($versions, 'version', $config->version, '');
if (isset($err['version'])) formerr($err['version']);
?>
</td>
<td>
<?php print_string('auth_ldap_version','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
<td>
<input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
<?php
if (isset($err['ldapencoding'])) {
formerr($err['ldapencoding']);
}
?>
</td>
<td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
<td>
<input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
<?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
</td><td>
<?php print_string('auth_ldap_bind_dn','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
<td>
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
<?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
</td><td>
<?php print_string('auth_ldap_bind_pw','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
<td>
<?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
<?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
</td>
<td>
<?php print_string('auth_ldap_user_type', 'auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
<td>
<input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
<?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
</td>
<td>
<?php print_string('auth_ldap_contexts', 'auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
<td>
<?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
</td>
<td>
<?php print_string('auth_ldap_search_sub','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
<td>
<?php
$opt_deref = array();
$opt_deref[LDAP_DEREF_NEVER] = get_string('no');
$opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, '');
if (isset($err['opt_deref'])) formerr($err['opt_deref']);
?>
</td>
<td>
<?php print_string('auth_ldap_opt_deref','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
<td>
<input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
<?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
</td>
<td>
<?php print_string('auth_ldap_user_attribute','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
<td>
<input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
<?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
</td><td>
<?php print_string('auth_ldap_memberattribute','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
<td>
<input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
<?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
</td><td>
<?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
<td>
<input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
<?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
</td>
<td>
<?php print_string('auth_ldap_objectclass','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('coursecreators') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="attrcreators_key"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
<td>
<input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
<?php if (isset($err['attrcreators'])) formerr($err['attrcreators']); ?>
</td><td>
<?php print_string('auth_ldap_attrcreators','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="groupecreators_key"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
<td>
<input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
<?php if (isset($err['groupecreators'])) formerr($err['groupecreators']); ?>
</td><td>
<?php print_string('auth_ldap_groupecreators','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top">
<td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
<td>
<?php
$deleteopt = array();
$deleteopt['0'] = get_string('auth_remove_keep','auth');
$deleteopt['1'] = get_string('auth_remove_suspend','auth');
$deleteopt['2'] = get_string('auth_remove_delete','auth');
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
?>
</td>
<td>
<?php print_string('auth_remove_user','auth') ?>
</td>
</tr>
</table>
<?php
$help = get_string('auth_ldapextrafields','auth');
$help .= get_string('auth_updatelocal_expl','auth');
$help .= get_string('auth_fieldlock_expl','auth');
$help .= get_string('auth_updateremote_expl','auth');
$help .= '<hr />';
$help .= get_string('auth_updateremote_ldap','auth');
print_auth_lock_options('cas', $user_fields, $help, true, true);
?>
<?php
global $CFG;
require_once 'languages.php';
$createoptions[0] = get_string("no");
$createoptions[1] = get_string("yes");
// set to defaults if undefined (CAS)
if (!isset ($config->hostname))
$config->hostname = '';
if (!isset ($config->port))
$config->port = '';
if (!isset ($config->casversion))
$config->casversion = '';
if (!isset ($config->baseuri))
$config->baseuri = '';
if (!isset ($config->language))
$config->language = '';
if (!isset ($config->use_cas))
$config->use_cas = '';
if (!isset ($config->proxycas))
$config->proxycas = '';
if (!isset ($config->logoutcas))
$config->logoutcas = '';
if (!isset ($config->multiauth))
$config->multiauth = '';
// set to defaults if undefined (LDAP)
if (!isset($config->host_url))
{ $config->host_url = ''; }
if (empty($config->ldapencoding))
{ $config->ldapencoding = 'utf-8'; }
if (!isset($config->contexts))
{ $config->contexts = ''; }
if (!isset($config->user_type))
{ $config->user_type = 'default'; }
if (!isset($config->user_attribute))
{ $config->user_attribute = ''; }
if (!isset($config->search_sub))
{ $config->search_sub = ''; }
if (!isset($config->opt_deref))
{ $config->opt_deref = LDAP_DEREF_NEVER; }
if (!isset($config->bind_dn))
{$config->bind_dn = ''; }
if (!isset($config->bind_pw))
{$config->bind_pw = ''; }
if (!isset($config->version))
{$config->version = '2'; }
if (!isset($config->objectclass))
{$config->objectclass = ''; }
if (!isset($config->memberattribute))
{$config->memberattribute = ''; }
if (!isset($config->memberattribute_isdn))
{$config->memberattribute_isdn = ''; }
if (!isset($config->groupecreators))
{$config->groupecreators = ''; }
if (!isset($config->attrcreators))
{$config->attrcreators = ''; }
if (!isset($config->removeuser))
{$config->removeuser = 0; }
$yesno = array( get_string('no'), get_string('yes') );
if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
notify(get_string('auth_ldap_noextension','auth'));
}
?>
<table cellspacing="0" cellpadding="5" border="0" align="center">
<tr>
<td colspan="2">
<h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_use_cas', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'use_cas', $config->use_cas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_enabled', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
<td>
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
<?php
if (isset($err['hostname'])) {
formerr($err['hostname']);
}
?>
</td>
<td><?php print_string('auth_cas_hostname', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
<td>
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
<?php
if (isset($err['baseuri'])) {
formerr($err['baseuri']);
}
?>
</td>
<td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
<td>
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
<?php
if (isset($err['port'])) {
formerr($err['port']);
}
?>
</td>
<td><?php print_string('auth_cas_port', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
<td>
<input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
<?php
if (isset($err['casversion'])) {
formerr($err['casversion']);
}
?>
</td>
<td><?php print_string('auth_cas_version', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
<td>
<?php
choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
?>
</td>
<td><?php print_string('auth_cas_language', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_proxycas_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'proxycas', $config->proxycas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_proxycas', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'logoutcas', $config->logoutcas, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_logoutcas', 'auth') ?></td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_multiauth_key', 'auth') ?>:</td>
<td>
<?php
unset($options);
$options[1] = get_string('yes');
choose_from_menu ($options, 'multiauth', $config->multiauth, get_string('no'), '', '');
?>
</td>
<td><?php print_string('auth_cas_multiauth', 'auth') ?></td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
<td>
<input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
<?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
</td>
<td>
<?php print_string('auth_ldap_host_url','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
<td>
<?php
$versions = array();
$versions[2] = '2';
$versions[3] = '3';
choose_from_menu($versions, 'version', $config->version, '');
if (isset($err['version'])) formerr($err['version']);
?>
</td>
<td>
<?php print_string('auth_ldap_version','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
<td>
<input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
<?php
if (isset($err['ldapencoding'])) {
formerr($err['ldapencoding']);
}
?>
</td>
<td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
<td>
<input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
<?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
</td><td>
<?php print_string('auth_ldap_bind_dn','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
<td>
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
<?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
</td><td>
<?php print_string('auth_ldap_bind_pw','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
<td>
<?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
<?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
</td>
<td>
<?php print_string('auth_ldap_user_type', 'auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
<td>
<input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
<?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
</td>
<td>
<?php print_string('auth_ldap_contexts', 'auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
<td>
<?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
</td>
<td>
<?php print_string('auth_ldap_search_sub','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
<td>
<?php
$opt_deref = array();
$opt_deref[LDAP_DEREF_NEVER] = get_string('no');
$opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, '');
if (isset($err['opt_deref'])) formerr($err['opt_deref']);
?>
</td>
<td>
<?php print_string('auth_ldap_opt_deref','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
<td>
<input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
<?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
</td>
<td>
<?php print_string('auth_ldap_user_attribute','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
<td>
<input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
<?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
</td><td>
<?php print_string('auth_ldap_memberattribute','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
<td>
<input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
<?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
</td><td>
<?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
<td>
<input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
<?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
</td>
<td>
<?php print_string('auth_ldap_objectclass','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('coursecreators') ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="attrcreators_key"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
<td>
<input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
<?php if (isset($err['attrcreators'])) formerr($err['attrcreators']); ?>
</td><td>
<?php print_string('auth_ldap_attrcreators','auth') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><label for="groupecreators_key"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
<td>
<input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
<?php if (isset($err['groupecreators'])) formerr($err['groupecreators']); ?>
</td><td>
<?php print_string('auth_ldap_groupecreators','auth') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
</td>
</tr>
<tr valign="top">
<td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
<td>
<?php
$deleteopt = array();
$deleteopt['0'] = get_string('auth_remove_keep','auth');
$deleteopt['1'] = get_string('auth_remove_suspend','auth');
$deleteopt['2'] = get_string('auth_remove_delete','auth');
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
?>
</td>
<td>
<?php print_string('auth_remove_user','auth') ?>
</td>
</tr>
<?php
$help = get_string('auth_ldapextrafields','auth');
$help .= get_string('auth_updatelocal_expl','auth');
$help .= get_string('auth_fieldlock_expl','auth');
$help .= get_string('auth_updateremote_expl','auth');
$help .= '<hr />';
$help .= get_string('auth_updateremote_ldap','auth');
print_auth_lock_options('cas', $user_fields, $help, true, true);
?>
</table>

View File

@ -4,7 +4,6 @@
// You can add langages in /CAS/langage.
// Please send them to http://esup-phpcas.sourceforge.net
$CASLANGUAGES = array (
"greek" => "Modern Greek",
"english" => "English",
"french" => "French");
?>
?>