/**
  * Get default global role
  * @return 
  */
 public static function getDefaultRole()
 {
     if (self::$default_role) {
         return self::$default_role;
     }
     include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
     include_once './Services/LDAP/classes/class.ilLDAPServer.php';
     return self::$default_role = ilLDAPAttributeMapping::_lookupGlobalRole(ilLDAPServer::_getFirstActiveServer());
 }
Example #2
0
 /**
  * Constructur
  *
  * @access private
  * @param object ilLDAPServer or subclass
  * @throws ilLDAPQueryException
  * 
  */
 public function __construct(ilLDAPServer $a_server, $a_url = '')
 {
     global $ilLog;
     $this->settings = $a_server;
     if (strlen($a_url)) {
         $this->ldap_server_url = $a_url;
     } else {
         $this->ldap_server_url = $this->settings->getUrl();
     }
     $this->mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->settings->getServerId());
     $this->log = $ilLog;
     $this->fetchUserProfileFields();
     $this->connect();
 }
 /**
  * Check if an update is required
  * @return 
  * @param string $a_username
  */
 protected function updateRequired($a_username)
 {
     if (!ilObjUser::_checkExternalAuthAccount("apache", $a_username)) {
         return true;
     }
     // Check attribute mapping on login
     include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
     if (ilLDAPAttributeMapping::hasRulesForUpdate($this->server->getServerId())) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Required 2');
         return true;
     }
     include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
     if (ilLDAPRoleAssignmentRule::hasRulesForUpdate()) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Required 3');
         return true;
     }
     return false;
 }
 /**
  * Used for old style table.
  * @deprecated
  * @return 
  * @param object $a_as_select[optional]
  */
 private function prepareRoleSelect($a_as_select = true)
 {
     global $rbacreview, $ilObjDataCache;
     include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
     $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(), 'object_data', 'title', 'obj_id');
     $select[0] = $this->lng->txt('links_select_one');
     foreach ($global_roles as $role_id) {
         $select[$role_id] = ilObject::_lookupTitle($role_id);
     }
     if ($a_as_select) {
         return ilUtil::formSelect(ilLDAPAttributeMapping::_lookupGlobalRole($this->server->getServerId()), 'global_role', $select, false, true);
     } else {
         return $select;
     }
 }
Example #5
0
 /**
  * Get attribute array for pear auth data
  *
  * @access private
  * @param 
  * 
  */
 private function getPearAtributeArray()
 {
     if ($this->enabledSyncOnLogin()) {
         include_once 'Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
         include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
         $mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->getServerId());
         return array_merge(array($this->getUserAttribute()), $mapping->getFields(), array('dn'), ilLDAPRoleAssignmentRules::getAttributeNames());
     } else {
         return array($this->getUserAttribute());
     }
 }
 /**
  * Check if an update is required
  * @return bool
  */
 protected function isUpdateRequired()
 {
     if (!$this->getInternalAccount()) {
         return true;
     }
     // Check attribute mapping on login
     include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
     if (ilLDAPAttributeMapping::hasRulesForUpdate($this->getServer()->getServerId())) {
         return true;
     }
     // Check if there is any change in role assignments
     include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
     if (ilLDAPRoleAssignmentRule::hasRulesForUpdate()) {
         return true;
     }
     return false;
 }
 private function initLDAPAttributeMapping()
 {
     include_once 'Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
     $this->mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->server_settings->getServerId());
 }