diff --git a/gosa-plugins/fai/admin/fai/class_askClassName.inc b/gosa-plugins/fai/admin/fai/class_askClassName.inc
index 2a40c6366ebc0f34617af05b34840b91999e087c..945c0d54f4a3dd7c23e43592494a3c756580b7c3 100644 (file)
var $forbidden = array();
var $ClassName = "";
var $ClassAlreadyExists = false;
var $forbidden = array();
var $ClassName = "";
var $ClassAlreadyExists = false;
+ var $parent;
function askClassName (&$config,$dn,$ui,$objectClass)
{
$this->ui = $ui;
$this->objectClass = $objectClass;
plugin::plugin ($config, $dn);
function askClassName (&$config,$dn,$ui,$objectClass)
{
$this->ui = $ui;
$this->objectClass = $objectClass;
plugin::plugin ($config, $dn);
- if(!session::is_set('CurrentMainBase')){
- session::set('CurrentMainBase',$this->config->current['BASE']);
- }
}
function execute()
}
function execute()
$smarty = get_smarty();
$display= "";
$smarty = get_smarty();
$display= "";
- /* The faifilter contais
- * The base for all fai objects
- */
- $faifilter = session::get('faifilter');
-
/* First search for every ou, in given fai base
* With a second search detect all object that belong to the different ous.
*/
/* First search for every ou, in given fai base
* With a second search detect all object that belong to the different ous.
*/
- $base = get_ou('faiou').session::get('CurrentMainBase');
- if($faifilter['branch'] != "main"){
- $base = $faifilter['branch'];
- }
+ $base = $this->parent->fai_release;
$ldap = $this->config->get_ldap_link();
$ldap = $this->config->get_ldap_link();
-
- $res= get_list("(&(objectClass=organizationalUnit)(!(objectClass=FAIbranch)))", "fai", $base,
- array("cn","description","objectClass"), GL_SIZELIMIT );
+
+ $type_acl_mapping = array(
+ "FAIpartitionTable" => "faiPartitionTable",
+ "FAIpackageList" => "faiPackage",
+ "FAIscript" => "faiScript",
+ "FAIvariable" => "faiVariable",
+ "FAIhook" => "faiHook",
+ "FAIprofile" => "faiProfile",
+ "FAItemplate" => "faiTemplate");
+
+ $filter = "";
+ foreach($type_acl_mapping as $map){
+ $filter .= "(objectClass=".$map.")";
+ }
+
+ $res = FAI::get_all_objects_for_given_base($base,"(|".$filter.")",TRUE);
$delete = array();
$used = array();
$delete = array();
$used = array();
- foreach($res as $objecttypes){
- $res2= get_list("(objectClass=*)", "fai", $objecttypes['dn'],
- array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT | GL_CONVERT );
- foreach($res2 as $object){
-
- /* skip class names with this name */
- if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){
- if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){
- continue;
- }
- $delete[] = $object['cn'][0];
+ foreach($res as $object){
+
+ /* skip class names with this name */
+ if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){
+ if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){
+ continue;
}
}
-
- /* Skip profiles */
- if(!in_array("FAIprofile",$object['objectClass'])){
- if(isset($object['cn'])){
- $used[$object['cn'][0]]= $object['cn'][0];
- }
+ $delete[] = $object['cn'][0];
+ }
+
+ /* Skip profiles */
+ if(!in_array("FAIprofile",$object['objectClass'])){
+ if(isset($object['cn'])){
+ $used[$object['cn'][0]]= $object['cn'][0];
}
}
}
}
}
}
* Depending on the object type we want to create, a different headline will be shown
*/
switch($this->objectClass) {
* Depending on the object type we want to create, a different headline will be shown
*/
switch($this->objectClass) {
- case "FAIpartitionTable": $str =_("Create new FAI object - partition table.");break;
- case "FAIpackageList" : $str =_("Create new FAI object - package bundle.");break;
- case "FAIscript" : $str =_("Create new FAI object - script bundle.");break;
- case "FAIvariable" : $str =_("Create new FAI object - variable bundle.");break;
- case "FAIhook" : $str =_("Create new FAI object - hook bundle.");break;
- case "FAIprofile" : $str =_("Create new FAI object - profile.");break;
- case "FAItemplate" : $str =_("Create new FAI object - template.");break;
+ case "FAIpartitionTable": $str =_("Create new FAI object")." - "._("Partition table");break;
+ case "FAIpackageList" : $str =_("Create new FAI object")." - "._("Package bundle");break;
+ case "FAIscript" : $str =_("Create new FAI object")." - "._("Script bundle");break;
+ case "FAIvariable" : $str =_("Create new FAI object")." - "._("Variable bundle");break;
+ case "FAIhook" : $str =_("Create new FAI object")." - "._("Hook bundle");break;
+ case "FAIprofile" : $str =_("Create new FAI object")." - "._("Profile");break;
+ case "FAItemplate" : $str =_("Create new FAI object")." - "._("Template bundle");break;
default : $str =_("Create new FAI object");break;
}
$smarty->assign("headline",$str);
default : $str =_("Create new FAI object");break;
}
$smarty->assign("headline",$str);
{
/* Call common method to give check the hook */
$message= plugin::check();
{
/* Call common method to give check the hook */
$message= plugin::check();
-
+
+ if($this->objectClass == "FAIscript" && preg_match("/^-/", $this->ClassName)) {
+ $message[] = msgPool::invalid(_("Name"),preg_replace("/ /","_",$this->ClassName),"/[^_]/");
+ }
+
if($this->ClassName != preg_replace("/ /","",trim($this->ClassName))){
if($this->ClassName != preg_replace("/ /","",trim($this->ClassName))){
- $message[] = _("Spaces are not allowed within class names.");
+ $message[] = msgPool::invalid(_("Name"),preg_replace("/ /","_",$this->ClassName),"/[^_]/");
}
}
- if(empty($this->ClassName)){
- $message[]=_("The given class name is empty.");
+ if($this->ClassName == ""){
+ $message[]= msgPool::required(_("Name"));
}
if(in_array($this->ClassName,$this->forbidden)){
}
if(in_array($this->ClassName,$this->forbidden)){
- $message[]=_("The specified class name is already in use for this object type.");
+ $message[]= msgPool::duplicated(_("Name"));
}
return ($message);
}
return ($message);