diff --git a/gosa-core/include/class_CopyPasteHandler.inc b/gosa-core/include/class_CopyPasteHandler.inc
index 5c021bfbcc4a31696193c48dcfbc6edfdfdac239..a7fdee4589b49899b9d8cb8fc268caf8d0c430bd 100644 (file)
if(!is_dir(LDAP_DUMP_PATH)){
@mkdir(LDAP_DUMP_PATH);
}
+
+ /* Update folder permissions */
+ if(!@chmod(LDAP_DUMP_PATH,0700)){
+ $msg= sprintf(_("Cannot cleanup copy & paste queue: setting permissions for '%s' failed!"),LDAP_DUMP_PATH);
+ msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all","copy & paste, event queue.",array(), $msg);
+ return(FALSE);
+ }
/* check if we are able to create a new file the given directory */
if(!is_writeable(LDAP_DUMP_PATH)){
- print_red(sprintf(_("Could not cleanup copy & paste queue. We are not allowed to save ldap dump to '%s', please check permissions."),LDAP_DUMP_PATH));
- new log("copy","all/all","copy & paste, event queue.",array(),
- sprintf("Could not cleanup copy & paste queue. We are not allowed to save ldap dump to '%s', please check permissions.",LDAP_DUMP_PATH));
+ $msg= sprintf(_("Cannot cleanup copy & paste queue: no write permission inside '%s'!"),LDAP_DUMP_PATH);
+ msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all","copy & paste, event queue.",array(), $msg);
return(FALSE);
}
/* Check if given dn is valid and ldap search was succesfull */
if(!$res){
- print_red(sprintf(_("Specified object '%s' is not a valid ldap object, please check copy & paste methods.")));
- new log("copy","all/all",$dn,array(),"Could not create dump of ldap object, given object is not present in the ldap database.");
+ $msg= sprintf(_("Copy and paste failed: object '%s' is not a valid ldap object!"), LDAP::fix($dn));
+ msg_dialog::display(_("Internal error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all",$dn,array(), $msg);
return(FALSE);
}
/* check if we are able to create a new file the given directory */
if(!is_writeable($path)){
- print_red(sprintf(_("We are not allowed to save ldap dump to '%s', please check permissions."),$path));
- new log("copy","all/all",$dn,array(),
- sprintf("We are not allowed to save ldap dump to '%s', please check permissions.",$path));
+ $msg= sprintf(_("Cannot save LDAP dump: no write permission inside '%s'!"),LDAP_DUMP_PATH);
+ msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all",$dn,array(), $msg);
return(FALSE);
}
+ /* Update folder permissions */
+ if(!@chmod(LDAP_DUMP_PATH,0700)){
+ $msg= sprintf(_("Cannot save LDAP dump: setting permissions for '%s' failed!"),LDAP_DUMP_PATH);
+ msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all","copy & paste, event queue.",array(), $msg);
+ return(FALSE);
+ }
+
/* Create file handle */
$fp = @fopen($path."/".$filename,"w+");
if(!$fp){
- print_red(sprintf(_("We are not allowed to save ldap dump to '%s/%s', please check permissions."),$path,$filename));
- new log("copy","all/all",$dn,array(),
- sprintf("We are not allowed to save ldap dump to '%s/%s', please check permissions.",$path,$filename));
+ $msg= sprintf(_("Cannot save LDAP dump: no write permission to '%s/%s'!"),$path,$filename);
+ msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all",$dn,array(), $msg);
return(FALSE);
}
}
return(unserialize($data));
}else{
- print_red(sprintf(_("Could not load dumped file '%s', from hard disk drive."),$filename));
- new log("copy","all/all",$dn,array(),
- sprintf(sprintf("Could not load dumped file '%s', from hard disk drive.",$filename)));
+ $msg= sprintf(_("Cannot load dumped file '%s'!"),$filename);
+ msg_dialog::display(_("Internal error"), $msg, ERROR_DIALOG);
+ new log("copy","all/all",$dn,array(), $msg);
return(FALSE);
}
}
/* Check permissions */
if(!preg_match("/((c|w)|(w|c))/",$acl)){
- print_red(sprintf(_("You are not allowed to cut and paste the following object '%s'."),$this->current['dn']));
+ msg_dialog::display(_("Error"), sprintf(_("You have no permission to save object '%s'."), $this->current['dn']), ERROR_DIALOG);
}elseif(count ($msgs) ){
foreach( $msgs as $msg){
- print_red($msg);
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
}
}else{
/* Check permissions */
if(!preg_match("/((c|w)|(w|c))/",$acl)){
- print_red(sprintf(_("You are not allowed to copy and paste the following object '%s'."),$this->current['dn']));
+ msg_dialog::display(_("Error"), sprintf(_("You have no permission to copy and paste object '%s'!"),$this->current['dn']), ERROR_DIALOG);
}elseif(count ($msgs) ){
foreach( $msgs as $msg){
- print_red($msg);
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
}
}else{
$this->current['object']->save();