00001 <?php 00002 /* 00003 +-----------------------------------------------------------------------------+ 00004 | ILIAS open source | 00005 +-----------------------------------------------------------------------------+ 00006 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne | 00007 | | 00008 | This program is free software; you can redistribute it and/or | 00009 | modify it under the terms of the GNU General Public License | 00010 | as published by the Free Software Foundation; either version 2 | 00011 | of the License, or (at your option) any later version. | 00012 | | 00013 | This program is distributed in the hope that it will be useful, | 00014 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00015 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00016 | GNU General Public License for more details. | 00017 | | 00018 | You should have received a copy of the GNU General Public License | 00019 | along with this program; if not, write to the Free Software | 00020 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 00021 +-----------------------------------------------------------------------------+ 00022 */ 00023 00034 require_once "class.ilObject.php"; 00035 00036 class ilObjAuthSettings extends ilObject 00037 { 00044 function ilObjAuthSettings($a_id = 0,$a_call_by_reference = true) 00045 { 00046 $this->type = "auth"; 00047 $this->ilObject($a_id,$a_call_by_reference); 00048 } 00049 00050 function checkAuthLDAP() 00051 { 00052 $settings = $this->ilias->getAllSettings(); 00053 00054 if (!$settings["ldap_server"] or !$settings["ldap_basedn"] or !$settings["ldap_port"]) 00055 { 00056 return false; 00057 } 00058 00059 return true; 00060 } 00061 00062 function checkAuthRADIUS() 00063 { 00064 $settings = $this->ilias->getAllSettings(); 00065 00066 return true; 00067 00068 if (!$settings["ldap_server"] or !$settings["ldap_basedn"] or !$settings["ldap_port"]) 00069 { 00070 return false; 00071 } 00072 00073 return true; 00074 } 00075 00076 function checkAuthScript() 00077 { 00078 $settings = $this->ilias->getAllSettings(); 00079 00080 if (!$settings["auth_script_name"]) 00081 { 00082 return false; 00083 } 00084 00085 return true; 00086 } 00087 00094 function update() 00095 { 00096 if (!parent::update()) 00097 { 00098 return false; 00099 } 00100 00101 // put here object specific stuff 00102 00103 return true; 00104 } 00105 00113 function ilClone($a_parent_ref) 00114 { 00115 global $rbacadmin; 00116 00117 // always call parent clone function first!! 00118 $new_ref_id = parent::ilClone($a_parent_ref); 00119 00120 // get object instance of cloned object 00121 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); 00122 00123 // create a local role folder & default roles 00124 //$roles = $newObj->initDefaultRoles(); 00125 00126 // ...finally assign role to creator of object 00127 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n"); 00128 00129 // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree! 00130 //unset($newObj); 00131 00132 // ... and finally always return new reference ID!! 00133 return $new_ref_id; 00134 } 00135 00142 function delete() 00143 { 00144 // always call parent delete function first!! 00145 if (!parent::delete()) 00146 { 00147 return false; 00148 } 00149 00150 //put here your module specific stuff 00151 00152 return true; 00153 } 00154 00164 function initDefaultRoles() 00165 { 00166 global $rbacadmin; 00167 00168 // create a local role folder 00169 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId()); 00170 00171 // create moderator role and assign role to rolefolder... 00172 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId()); 00173 //$roles[] = $roleObj->getId(); 00174 00175 //unset($rfoldObj); 00176 //unset($roleObj); 00177 00178 return $roles ? $roles : array(); 00179 } 00180 00194 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0) 00195 { 00196 global $tree; 00197 00198 switch ($a_event) 00199 { 00200 case "link": 00201 00202 //var_dump("<pre>",$a_params,"</pre>"); 00203 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id; 00204 //exit; 00205 break; 00206 00207 case "cut": 00208 00209 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id; 00210 //exit; 00211 break; 00212 00213 case "copy": 00214 00215 //var_dump("<pre>",$a_params,"</pre>"); 00216 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id; 00217 //exit; 00218 break; 00219 00220 case "paste": 00221 00222 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id; 00223 //exit; 00224 break; 00225 00226 case "new": 00227 00228 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id; 00229 //exit; 00230 break; 00231 } 00232 00233 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter 00234 if ($a_node_id==$_GET["ref_id"]) 00235 { 00236 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id); 00237 $parent_type = $parent_obj->getType(); 00238 if($parent_type == $this->getType()) 00239 { 00240 $a_node_id = (int) $tree->getParentId($a_node_id); 00241 } 00242 } 00243 00244 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params); 00245 } 00246 } // END class.ilObjAuthSettings 00247 ?>