X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_CopyPasteHandler.inc;h=1d6a1f04ac07b87f3308f9074ec63a0eea69e489;hb=7c4b2a414b0cb8f1cfd04713969d7e9b8c78d2f0;hp=613f05f17355fda07aee1106296d480cc882d69d;hpb=c97773cf4577283e1c024ccf0493d3a742c074e1;p=gosa.git diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 613f05f17..1d6a1f04a 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -18,9 +18,9 @@ class CopyPasteHandler { /* Create CP handler */ - function CopyPasteHandler($config) + function CopyPasteHandler(&$config) { - $this->config = $config; + $this->config = &$config; $this->current= NULL; $this->queue = array(); $this->setvar_array = array(); @@ -80,6 +80,19 @@ class CopyPasteHandler { unset($this->queue[$key]); } + /* Create patch if it doesn't exists */ + if(!is_dir(LDAP_DUMP_PATH)){ + @mkdir(LDAP_DUMP_PATH); + } + + /* 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)); + return(FALSE); + } + /* Remove entries from hdd that are older than24 hours */ $fp = opendir(LDAP_DUMP_PATH); while($file = readdir($fp)){ @@ -228,6 +241,7 @@ class CopyPasteHandler { Create unique names, ids, or what ever */ function execute() { + $ui = get_userinfo(); $type = $this->current['method']; if($type == "cut"){ if(isset($_POST['PerformCopyPaste'])){ @@ -236,7 +250,12 @@ class CopyPasteHandler { $this->_update_vars(); $msgs = $this->check(); - if(count ($msgs) ){ + $acl = $ui->get_category_permissions($this->current['dn'], $this->current['tab_acl_category']); + + /* 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'])); + }elseif(count ($msgs) ){ foreach( $msgs as $msg){ print_red($msg); } @@ -271,7 +290,13 @@ class CopyPasteHandler { if(isset($_POST['PerformCopyPaste'])){ $this->_update_vars(); $msgs = $this->check(); - if(count ($msgs) ){ + + $acl = $ui->get_category_permissions($this->current['dn'], $this->current['tab_acl_category']); + + /* 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'])); + }elseif(count ($msgs) ){ foreach( $msgs as $msg){ print_red($msg); }