index d416b06027d965b640cbfd65db2f92974d5c8cb6..e9c646ecb38a96a9893d599298b774aa11473fdb 100644 (file)
/* ObjectClasses for this Object*/
var $objectclasses = array("top","FAIclass","FAIprofile");
- /* Class name of the Ldap ObjectClass for the Sub Object */
- var $subClass = "FAIscriptEntry";
- var $subClasses = array("top","FAIclass","FAIscriptEntry");
-
/* Specific attributes */
var $old_cn = "";
var $cn = ""; // The class name for this object
var $FAIclasses = array(); // Contains classname seperated in an array
var $FAIAllclasses = array(); // Contains all possible Classnames
+ var $FAIstate = "";
+
function faiProfile($config, $dn= NULL)
{
/* Load Attributes */
plugin::plugin ($config, $dn);
$ldap=$this->config->get_ldap_link();
+ $this->acl = "#all#";
+
+ if($this->dn != "new"){
+ /* Set acls
+ */
+ $ui = get_userinfo();
+ $acl = get_permissions ($this->dn, $ui->subtreeACL);
+ $acli = get_module_permission($acl, "FAIclass", $this->dn);
+ $this->acl=$acli;
+ }
+
/* Parse ldap attribute to get all assigned classes */
$tmp = split(" ",$this->FAIclass);
$tmp2 = array();
$tmp2[trim($class)] = trim($class);
}
}
-
+
+ if(isset($this->attrs['FAIstate'][0])){
+ $this->FAIstate = $this->attrs['FAIstate'][0];
+ }
+
/* Sort assigned classes */
if(is_array($tmp2)){
foreach($tmp2 as $class){
}
}
- $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackage");
+ $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
/* Build filter */
$filter= "";
}
/* Get ldap connection */
- $base = $_SESSION['faifilter']['base'];
+ $base = $_SESSION['CurrentMainBase'];
$ldap->cd($base);
$sort = array();
$objTypes['FAItemplate'] = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>";
$objTypes['FAIscript'] = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>";
$objTypes['FAIvariable'] = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>";
- $objTypes['FAIpackages'] = "<img src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
+ $objTypes['FAIpackageList'] = "<img src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
$objTypes['FAIpartitionTable'] = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>";
/* Delete button */
$field1 = array("string"=> $usedClass,"attach"=>"");
$field2 = array("string"=> $str,"attach"=>"");
- $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).preg_replace("/%s/",base64_encode($usedClass),$linkupdown),"attach"=>"style='border-right:none;'");
+ if($this->FAIstate != "freeze"){
+ $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).
+ preg_replace("/%s/",base64_encode($usedClass),$linkupdown),
+ "attach"=>"style='border-right:none;'");
+ }else{
+ $field3 = array("string"=>" ", "attach"=>"style='border-right:none;'");
+ }
$divlist->AddEntry(array($field1,$field2,$field3));
}
}
}
+ foreach($this->attributes as $attr){
+ if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+ $smarty->assign($attr."ACL"," disabled ");
+ }else{
+ $smarty->assign($attr."ACL"," ");
+ }
+ }
$display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
return($display);
{
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
- $ldap->rmdir_recursive($this->dn);
+
+ $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+ if($_SESSION['faifilter']['branch'] == "main"){
+ $use_dn = $this->dn;
+ }
+
+ prepare_to_save_FAI_object($use_dn,array(),true);
$this->handle_post_events("remove");
}
+
/* Save data to object
*/
function save_object()
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
if(count($this->FAIclasses) == 0){
$message[]=_("Please assign at least one class to this profile.");
}
$ldap = $this->config->get_ldap_link();
- $ldap->cd($_SESSION['faifilter']['base']);
+ $ldap->cd($_SESSION['CurrentMainBase']);
$ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
if($ldap->count()){
$this->attrs['FAIclass']=trim($this->FAIclass);
- $ldap->cat($this->dn);
- if($ldap->count()!=0){
- /* Write FAIscript to ldap*/
- $ldap->cd($this->dn);
- $this->cleanup();
-$ldap->modify ($this->attrs);
-
- }else{
- /* Write FAIscript to ldap*/
- $ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error());
+ prepare_to_save_FAI_object($this->dn,$this->attrs);
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
+
+ /* Do object tagging */
+ $this->handle_object_tagging();
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
+ }
+
+
+ /* Return plugin informations for acl handling */
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Profile"),
+ "plDescription" => _("FAI profile"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("administration"),
+ "plCategory" => array("fai"),
+ "plProvidedAcls" => array(
+ "cn" => _("Name"),
+ "description" => _("Description"),
+ "FAIclass" => _("FAI classes"))
+ ));
}
}