index b33e609e29fa9432d76d589c2661ca09ed6c9f7f..8eec579c440ece59c05ab39906138cf558687d76 100644 (file)
var $acl_base= "";
var $acl_category= "";
- /* Plugin identifier */
- var $plHeadline= "";
- var $plDescription= "";
-
/* This can be set to render the tabulators in another stylesheet */
var $pl_notify= FALSE;
}
}
+ /* Handle tagging */
+ $this->tag_attrs(&$this->attrs);
}
exec($command);
} else {
$message= sprintf(_("Command '%s', specified as POSTCREATE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
- print_red ($message);
+ msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
}
exec($command);
} else {
$message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, get_class($this));
- print_red ($message);
+ msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
}
exec($command);
} else {
$message= sprintf(_("Command '%s', specified as POSTREMOVE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
- print_red ($message);
+ msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
}
{
/* Rename dn in possible object groups */
$ldap= $this->config->get_ldap_link();
- $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($src_dn).'))',
+ $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::preapre4filter($src_dn).'))',
array('cn'));
while ($attrs= $ldap->fetch()){
$og= new ogroup($this->config, $ldap->getDN());
}
}
-
- function handle_object_tagging($dn= "", $tag= "", $show= false)
+ function tag_attrs($at, $dn= "", $tag= "", $show= false)
{
- //FIXME: How to optimize this? We have at least two
- // LDAP accesses per object. It would be a good
- // idea to have it integrated.
-
/* No dn? Self-operation... */
if ($dn == ""){
$dn= $this->dn;
}
}
+ /* Remove tags that may already be here... */
+ remove_objectClass("gosaAdministrativeUnitTag", &$at);
+ if (isset($at['gosaUnitTag'])){
+ unset($at['gosaUnitTag']);
+ }
/* Set tag? */
if ($tag != ""){
- /* Set objectclass and attribute */
- $ldap= $this->config->get_ldap_link();
- $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
- $attrs= $ldap->fetch();
- if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
- if ($show) {
- echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
- flush();
- }
- return;
- }
- if (count($attrs)){
- if ($show){
- echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
- flush();
- }
- $nattrs= array("gosaUnitTag" => $tag);
- $nattrs['objectClass']= array();
- for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
- $oc= $attrs['objectClass'][$i];
- if ($oc != "gosaAdministrativeUnitTag"){
- $nattrs['objectClass'][]= $oc;
- }
- }
- $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
- $ldap->cd($dn);
- $ldap->modify($nattrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
- } else {
- @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
- }
-
- } else {
- /* Remove objectclass and attribute */
- $ldap= $this->config->get_ldap_link();
- $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
- $attrs= $ldap->fetch();
- if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
- @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
- return;
- }
- if (count($attrs)){
- if ($show){
- echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
- flush();
- }
- $nattrs= array("gosaUnitTag" => array());
- $nattrs['objectClass']= array();
- for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
- $oc= $attrs['objectClass'][$i];
- if ($oc != "gosaAdministrativeUnitTag"){
- $nattrs['objectClass'][]= $oc;
- }
- }
- $ldap->cd($dn);
- $ldap->modify($nattrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
- } else {
- @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
- }
+ add_objectClass("gosaAdministrativeUnitTag", &$at);
+ $at['gosaUnitTag']= $tag;
}
-
}
/* Check if the snapshot_base is defined */
if(!isset($tmp['SNAPSHOT_BASE'])){
- print_red(sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not configured in your gosa.conf."),"SNAPSHOT_BASE"));
+ msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."),"SNAPSHOT_BASE"), ERROR_DIALOG);
return(FALSE);
}
foreach(array("SNAPSHOT_SERVER","SNAPSHOT_USER","SNAPSHOT_PASSWORD","SNAPSHOT_BASE") as $var){
if(!isset($tmp[$var])){
$missing .= $var." ";
- print_red(sprintf(_("The snapshot functionality is enabled, but the required variable(s) '%s' is not configured in your gosa.conf."),$missing));
+ msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), $missing), ERROR_DIALOG);
return(FALSE);
}
}
$msgs = $this->snapDialog->check();
if(count($msgs)){
foreach($msgs as $msg){
- print_red($msg);
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
}
}else{
$this->dn = $this->snapDialog->dn;
}
/* Update userinfo if necessary */
- if($_SESSION['ui']->dn == $old_dn){
- $_SESSION['ui']->dn = $new_dn;
+ $ui = session::get('ui');
+ if($ui->dn == $old_dn){
+ $ui->dn = $new_dn;
+ session::set('ui',$ui);
new log("view","acl/".get_class($this),$this->dn,array(),"Updated current user dn from '".$old_dn."' to '".$new_dn."'");
}