/**
  * Constructor Method
  *
  */
 function __construct($consumer_type, $params)
 {
     $this->consumerType = $consumer_type;
     $this->name = $params['consumer_name'];
     $this->namePlural = $params['consumer_name_plural'];
     $this->shortName = $params['consumer_short_name'];
     $this->shortNamePlural = $params['consumer_short_name_plural'];
     $this->consumerModule = $params['consumer_module'];
     $this->mappingDirections = $params['consumer_mapping_directions'];
     $this->testLink = l(t('test') . ' ' . $this->name, LDAP_SERVERS_MENU_BASE_PATH . '/authorization/test/' . $this->consumerType);
     $this->editLink = l(t('edit') . ' ' . $this->name, LDAP_SERVERS_MENU_BASE_PATH . '/authorization/edit/' . $this->consumerType);
     ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
     $this->consumerConf = new LdapAuthorizationConsumerConf($this);
 }
Exemplo n.º 2
0
 /**
  * @param ldap entry array $ldap_entry
  *
  * @return string user's mail value or FALSE if none present
  */
 public function userEmailFromLdapEntry($ldap_entry)
 {
     if ($ldap_entry && $this->mail_attr) {
         // not using template
         $mail = isset($ldap_entry[$this->mail_attr][0]) ? $ldap_entry[$this->mail_attr][0] : FALSE;
         return $mail;
     } elseif ($ldap_entry && $this->mail_template) {
         // template is of form [cn]@illinois.edu
         ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
         return ldap_servers_token_replace($ldap_entry, $this->mail_template, 'ldap_entry');
     } else {
         return FALSE;
     }
 }
Exemplo n.º 3
0
<?php

/**
 * @file
 * Simpletest ldapServer class for testing without an actual ldap server
 *
 */
/**
 * LDAP Server Class
 *
 *  This class is used to create, work with, and eventually destroy ldap_server
 * objects.
 *
 * @todo make bindpw protected
 */
ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
class LdapServerTest extends LdapServer
{
    public $entries;
    public $methodResponses;
    public $searchResults;
    public $binddn = FALSE;
    // Default to an anonymous bind.
    public $bindpw = FALSE;
    // Default to an anonymous bind.
    /**
     * Constructor Method
     *
     * can take array of form property_name => property_value
     * or $sid, where sid is used to derive the include file.
     */
Exemplo n.º 4
0
<?php

/**
 * @file
 * Active Directory LDAP Implementation Details
 *
 */
ldap_servers_module_load_include('php', 'ldap_servers', 'ldap_types/LdapTypeAbstract.class');
class LdapTypeNovell extends LdapTypeAbstract
{
    public $documentation = 'http://www.novell.com/documentation/edir873/index.html?page=/documentation/edir873/edir873/data/h0000007.html';
    public $name = 'Novell eDirectory LDAP';
    public $typeId = 'Novell';
    public $description = 'Novell eDirectory LDAP';
    public $port = 389;
    public $tls = 1;
    public $encrypted = 0;
    public $user_attr = 'uid';
    public $mail_attr = 'mail';
    public $groupObjectClassDefault = 'groupOfNames';
    public $groupDerivationModelDefault = LDAP_SERVERS_DERIVE_GROUP_FROM_ENTRY;
    public $groupUserMembershipsAttrExistsEntryAttrDefault = 'members';
    public $groupUserMembershipsAttrExistsEntryUserIdDefault = 'dn';
}
<?php

/**
 * @file
 * class for ldap authorization of organic groups
 *
 * @see LdapAuthorizationConsumerAbstract for property
 *
 */
if (function_exists('ldap_servers_module_load_include')) {
    ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerAbstract.class');
} else {
    module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerAbstract.class');
}
class LdapAuthorizationConsumerOG extends LdapAuthorizationConsumerAbstract
{
    public $consumerType = 'og_group';
    public $allowConsumerObjectCreation = FALSE;
    public $ogVersion = NULL;
    // 1, 2, etc.
    public $defaultMembershipRid;
    public $anonymousRid;
    public $defaultConsumerConfProperties = array('onlyApplyToLdapAuthenticated' => TRUE, 'useMappingsAsFilter' => TRUE, 'synchOnLogon' => TRUE, 'revokeLdapProvisioned' => TRUE, 'regrantLdapProvisioned' => TRUE, 'createConsumers' => TRUE);
    function __construct($consumer_type)
    {
        $this->ogVersion = ldap_authorization_og_og_version();
        if ($this->ogVersion == 1) {
            $this->defaultMembershipRid = ldap_authorization_og1_role_name_to_role_id(OG_AUTHENTICATED_ROLE);
            $this->anonymousRid = ldap_authorization_og1_role_name_to_role_id(OG_ANONYMOUS_ROLE);
        } else {
            //@todo these properties are not used in ldap og 2, but when they are their derivation needs to be examined and tested
 function query()
 {
     ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServer.class');
     $ldap_server = new LdapServer($this->sid);
     $ldap_server->connect();
     $ldap_server->bind();
     $results = array();
     $count = 0;
     foreach ($this->baseDn as $base_dn) {
         $result = $ldap_server->search($base_dn, $this->filter, $this->attributes, 0, $this->sizelimit, $this->timelimit, $this->deref, $this->scope);
         if ($result !== FALSE && $result['count'] > 0) {
             $count = $count + $result['count'];
             $results = array_merge($results, $result);
         }
     }
     $results['count'] = $count;
     return $results;
 }
<?php

/**
 * @file
 * This classextends by LdapAuthenticationConf for configuration and other admin functions
 */
ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConf.class');
class LdapAuthenticationConfAdmin extends LdapAuthenticationConf
{
    protected function setTranslatableProperties()
    {
        /**
         * 0.  Logon Options
         */
        $values['authenticationModeOptions'] = array(LDAP_AUTHENTICATION_MIXED => t('Mixed mode. Drupal authentication is tried first.  On failure, LDAP authentication is performed.'), LDAP_AUTHENTICATION_EXCLUSIVE => t('Only LDAP Authentication is allowed except for user 1.
        If selected, (1) reset password links will be replaced with links to ldap end user documentation below.
        (2) The reset password form will be left available at user/password for user 1; but no links to it
        will be provided to anonymous users.
        (3) Password fields in user profile form will be removed except for user 1.'));
        $values['authenticationServersDescription'] = t('Check all LDAP server configurations to use in authentication.
     Each will be tested for authentication until successful or
     until each is exhausted.  In most cases only one server configuration is selected.');
        /**
         * User Login Interface
         */
        $values['loginUIUsernameTxtDescription'] = t('Text to be displayed to user below the username field of
     the user login screen.');
        $values['loginUIPasswordTxtDescription'] = t('Text to be displayed to user below the password field of
     the user login screen.');
        $values['ldapUserHelpLinkUrlDescription'] = t('URL to LDAP user help/documentation for users resetting
     passwords etc. Should be of form http://domain.com/. Could be the institutions ldap password support page
Exemplo n.º 8
0
<?php

/**
 * @file
 * This class represents a ldap_group module's configuration
 *   including admin functions like save and validate
 */
ldap_servers_module_load_include('module', 'ldap_groups');
ldap_servers_module_load_include('php', 'ldap_groups', 'LdapGroupsConf.class');
class LdapGroupsConfAdmin extends LdapGroupsConf
{
    protected function setTranslatableProperties()
    {
        $values['ldapProvisionSidDescription'] = t('Check ONE LDAP server configuration to
      create ldap groups entries.');
        $values['provisionGroupEntryEventsDescription'] = t('');
        $values['provisionGroupEntryEventsOptions'] = array(LDAP_GROUPS_PROV_ON_LDAP_ENTRY_CREATED => t('When LDAP Entry is created (by Drupal).'), LDAP_GROUPS_PROV_ON_LDAP_ENTRY_UPDATED => t('When LDAP Entry is updated (by Drupal).'), LDAP_GROUPS_PROV_ON_LDAP_ENTRY_DELETED => t('When LDAP Entry is deleted (by Drupal).'));
        $values['provisionOptionsDescription'] = t('');
        $values['provisionOptionsOptions'] = array(LDAP_GROUPS_PROV_NO_CREATE => t('Do not create LDAP Groups if they do not exist.'), LDAP_GROUPS_PROV_NO_REMOVE => t('Do not remove LDAP Group memberships even if user no longer has corresponding Drupal role.'), LDAP_GROUPS_PROV_DELETE_EMPTY_GROUPS => t('Remove empty LDAP groups when last member is removed.'));
        foreach ($values as $property => $value) {
            $this->{$property} = $value;
        }
    }
    protected $ldapProvisionSidDescription;
    protected $ldapProvisionSidOptions = array();
    protected $provisionGroupEntryEventsDescription;
    protected $provisionGroupEntryEventsOptions = array();
    protected $provisionOptionsOptions = array();
    public $errorMsg = NULL;
    public $hasError = FALSE;
    public $errorName = NULL;