diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc
index cb54b7b233945b07caea5a097b12212c08fca4a7..c1701053bf4f01be2880dc2de6c0550649db166d 100644 (file)
class blocklistGeneric extends plugin
{
/* Definitions */
- var $plHeadline= "FAX Blocklists";
+ var $plHeadline= "Fax blocklists";
var $plDescription= "This does something";
var $cn ="";
var $goFaxBlocklist = array();
var $readonly = FALSE;
var $view_logged = FALSE;
- var $attributes = array("cn","description");
+ var $attributes = array("cn","description","goFaxSBlocklist","goFaxRBlocklist");
var $ignore_account = TRUE;
+
+ var $orig_base = "";
+ var $orig_dn = "";
+
+ var $goFaxSBlocklist = array();
+ var $goFaxRBlocklist = array();
+
function __construct($config,$dn = "new")
{
$this->base= dn2base($ui->dn);
}
} else {
- $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
+ $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("faxBlocklistRDN"), '/')."/i", "", $this->dn);
}
+
+ $this->orig_base = $this->base;
+ $this->orig_dn = $this->dn;
}
public function execute()
$smarty->assign("bases", $this->get_allowed_bases());
$smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
$smarty->assign("type", $this->type);
+ $smarty->assign("dn", $this->dn);
+ $smarty->assign("read_only",$this->read_only);
return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
}
}
if ($this->dn == 'new'){
$ldap= $this->config->get_ldap_link();
- $ldap->cd (get_ou('blocklistou').$this->config->current["BASE"]);
+ $ldap->cd (get_ou('faxBlocklistRDN').$this->config->current["BASE"]);
$ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
if ($ldap->count() != 0){
$message[]= msgPool::duplicated(_("Name"));
}
}
}
+
+ /* Check if we are allowed to create or move this object
+ */
+ if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
+ $message[] = msgPool::permCreate();
+ }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+ $message[] = msgPool::permMove();
+ }
+
return $message;
}
/* Save to LDAP */
function save()
{
- plugin::save();
-
/* Type selection */
if ($this->type == BLOCK_LIST_SEND){
$type= "goFaxSBlocklist";
- $this->attrs['objectClass']= "goFaxSBlock";
+ $this->objectclasses = array("goFaxSBlock");
} else {
$type= "goFaxRBlocklist";
- $this->attrs['objectClass']= "goFaxRBlock";
+ $this->objectclasses = array("goFaxRBlock");
}
- /* Add list */
- if (count($this->goFaxBlocklist)){
- $this->attrs[$type]= $this->goFaxBlocklist;
- }
+ plugin::save();
+
+ /* Let clenaup() know what attributes to handle
+ */
+ $this->attrs[$type] = $this->goFaxBlocklist;
+ $this->attributes [] = $type;
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->base);
$ldap->cat($this->dn, array('dn'));
if ($ldap->count()){
- if (!isset($this->attrs[$type])){
- $this->attrs[$type]= array();
- }
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify($this->attrs);
$ldap->cd($this->config->current['BASE']);
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
$ldap->cd($this->dn);
+ $this->cleanup();
$ldap->add($this->attrs);
new log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->handle_post_events("add");
}
+
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
}
"plDepends" => array(),
"plPriority" => 0,
- "plSection" => array("administration" => _("FAX Blocklists")),
+ "plSection" => array("administration" => _("Fax blocklists")),
"plCategory" => array("gofaxlist" => array("description" => _("Fax blocklists"),
"objectClass" => array("goFaxRBlock","goFaxSBlock"))),
"plProvidedAcls" => array(