index a2b380e16594071213bce628309e3d13536e339b..c45d9996d9942dbc4e6437164ab87df35e361605 100644 (file)
class askClassName extends plugin
{
/* CLI vars */
- var $cli_summary= "Manage server basic objects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+ var $cli_summary = "Manage server basic objects";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
/* attribute list for save action */
- var $ignore_account = TRUE;
- var $attributes = array();
- var $objectclasses = array("whatever");
+ var $ignore_account = TRUE;
+ var $attributes = array();
+ var $objectclasses = array("whatever");
- var $objectClass = false;
- var $forbidden =array();
+ var $objectClass = false;
+ var $forbidden = array();
var $ClassName = "";
var $ClassAlreadyExists = false;
$this->ui = $ui;
$this->objectClass = $objectClass;
plugin::plugin ($config, $dn);
+ if(!isset($_SESSION['CurrentMainBase'])){
+ $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+ }
}
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty = get_smarty();
$display= "";
/* The faifilter contais
- The base for all fai objects
+ * The base for all fai objects
*/
$faifilter = $_SESSION['faifilter'];
/* First search for every ou, in given fai base
* With a second search detect all object that belong to the different ous.
*/
+
+ $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+ if($faifilter['branch'] != "main"){
+ $base = $faifilter['branch'];
+ }
$ldap = $this->config->get_ldap_link();
- $res = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE);
- $used = array();
+
+ $res= get_list("(&(objectClass=organizationalUnit)(!(objectClass=FAIbranch)))", $this->ui->subtreeACL, $base,
+ array("cn","description","objectClass"), GL_SIZELIMIT );
$delete = array();
+ $used = array();
foreach($res as $objecttypes){
- $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)",
- FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
-
+ $res2= get_list("(objectClass=*)", $this->ui->subtreeACL, $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'])){
+ if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){
+ continue;
+ }
$delete[] = $object['cn'][0];
}
/* Skip profiles */
if(!in_array("FAIprofile",$object['objectClass'])){
- $used[$object['cn'][0]]= $object['cn'][0];
+ if(isset($object['cn'])){
+ $used[$object['cn'][0]]= $object['cn'][0];
+ }
}
}
}
-
+
/* Create headline
* Depending on the object type we want to create, a different headline will be shown
*/
*/
if(count ($used)==0){
$smarty->assign("ClassNamesAvailable", " disabled ");
+ $smarty->assign("grey", 'style="color:#C0C0C0"');
}else{
$smarty->assign("ClassNamesAvailable", "");
+ $smarty->assign("grey", "");
}
$smarty->assign("ClassNames", $used);
- $smarty->assign("ClassNameKeys", $used);
$display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
return($display);
}
*/
function save_object()
{
- if(isset($_POST['UseNewClass'])){
+ if(isset($_POST['classSelector']) && $_POST['classSelector'] == 1
+ && isset($_POST['edit_continue'])){
$this->ClassName = $_POST['UseTextInputName'];
$this->ClassAlreadyExists = true;
}
- if(isset($_POST['UseSelectedClass'])){
+ if(isset($_POST['classSelector']) && $_POST['classSelector'] == 2
+ && isset($_POST['edit_continue'])){
$this->ClassAlreadyExists = false;
$this->ClassName = $_POST['SelectedClass'];
}
}
-
/* Check given class name
*/
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
if(empty($this->ClassName)){
$message[]=_("The given class name is empty.");
}
$message[]=_("The specified class name is already in use for this object type.");
}
- if(preg_match("/[^a-z0-9]/i",$this->ClassName)){
- $message[]=_("Please enter a valid class name. Only 0-9 a-z is allowed here.");
- }
-
return ($message);
}