コード例 #1
0
 /**
  * Check if a rule matches
  * @return 
  * @param object $a_user_data
  */
 public function matches($a_user_data)
 {
     global $ilLog;
     switch ($this->getType()) {
         case self::TYPE_PLUGIN:
             include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
             return ilLDAPRoleAssignmentRules::callPlugin($this->getPluginId(), $a_user_data);
         case self::TYPE_ATTRIBUTE:
             $attn = strtolower($this->getAttributeName());
             if (!isset($a_user_data[$attn])) {
                 return false;
             }
             if (!is_array($a_user_data[$attn])) {
                 $attribute_val = array(0 => $a_user_data[$attn]);
             } else {
                 $attribute_val = $a_user_data[$attn];
             }
             foreach ($attribute_val as $value) {
                 if ($this->wildcardCompare(trim($this->getAttributeValue()), trim($value))) {
                     $ilLog->write(__METHOD__ . ': Found role mapping: ' . ilObject::_lookupTitle($this->getRoleId()));
                     return true;
                 }
                 /*					
                 if(trim($value) == trim($this->getAttributeValue()))
                 {
                 				 		$ilLog->write(__METHOD__.': Found role mapping: '.ilObject::_lookupTitle($this->getRoleId()));
                 	return true;
                 }
                 */
             }
             return false;
         case self::TYPE_GROUP:
             return $this->isGroupMember($a_user_data);
     }
 }