summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b717f70)
raw | patch | inline | side by side (parent: b717f70)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Dec 2005 10:07:34 +0000 (10:07 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Dec 2005 10:07:34 +0000 (10:07 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2172 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/addons/ldapmanager/class_csvimport.inc b/plugins/addons/ldapmanager/class_csvimport.inc
index 32c06780404650dba6a030aa4ed0aede4595ad01..3e3d0fd5802b072ca3894cd5f3648f1f0f1ec306 100644 (file)
/* Include config object */
$this->config= $config;
+ /* set permissions */
$ui= get_userinfo();
- $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
- $acl= get_module_permission($acl, "all", $config->current['BASE']);
- $this->access= $acl;
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
+
+
}
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* initiate smarty */
$smarty= get_smarty();
$smarty->assign("attrs",$this->csvinfo['attr']);
/* Check permissions for import */
- if ($this->access != '#all#'){
+ if (chkacl($this->acl,"csvimport")!=""){
print_red(_("You've no permission to do CSV imports."));
return ($smarty->fetch (get_template_path('contentcsv.tpl', TRUE)));
}
/* If not all needed vars set .... */
if( ( empty($dat['sn']))||( empty($dat['givenName']))||( empty($dat['uid']))||
- (!isset($dat['sn']))||(!isset($dat['givenName']))||(!isset($dat['uid']))){
+ (!isset($dat['sn']))||(!isset($dat['givenName']))||(!isset($dat['uid']))){
/* Output Error */
-
+
print_red (_("Need 'sn','givenName' and 'uid' to create user."));
} else {
/* Set all submitted vars */
if(is_array($keys))
- foreach($keys as $key) {
- if($key != "status"){
- $this->usertab->$key = $dat[$key];
+ foreach($keys as $key) {
+ if($key != "status"){
+ $this->usertab->$key = $dat[$key];
+ }
}
- }
/* Initialize template */
if($this->csvinfo['tplid']!=0){
/* Reset vars */
if(is_array($keys))
- foreach($keys as $key) {
- if($key != "status"){
- $this->usertab->by_object['user']->$key = $dat[$key];
+ foreach($keys as $key) {
+ if($key != "status"){
+ $this->usertab->by_object['user']->$key = $dat[$key];
+ }
}
- }
}
// Setting user Password
$password = $dat['userPassword'];
else
{
- $rand_str="";
+ $rand_str="";
$feed = "0123456789abcdefghijklmnopqrstuvwxyz";
for ($i=0; $i < 8; $i++)
{
$smarty->assign("rows",$this->csvinfo['shownrowscount']);
- $cnt = 0 ;
- $tmp2 = $tmp3 = array();
- if(is_array($dataouts))
- foreach($dataouts as $tmp){
- $tmp2[] = $tmp;
- $cnt ++ ;
- if($cnt >= count($tmparr2)){
- $tmp3[] = $tmp2;
- $tmp2= array();
- $cnt = 0;
- }
- }
+ $cnt = 0 ;
+ $tmp2 = $tmp3 = array();
+ if(is_array($dataouts))
+ foreach($dataouts as $tmp){
+ $tmp2[] = $tmp;
+ $cnt ++ ;
+ if($cnt >= count($tmparr2)){
+ $tmp3[] = $tmp2;
+ $tmp2= array();
+ $cnt = 0;
+ }
+ }
$smarty->assign("head",$tmparr2);
$smarty->assign("data",$tmp3);
} else {
/* Check if theres a file uploaded */
if(!empty($_FILES['userfile']['name'])){
-
- $handle = NULL;
-
+
+ $handle = NULL;
+
if((!isset($_FILES['userfile']['name']))||(!isset($_POST['fileup'])))
{
print_red(_("There is no file uploaded."));
{
$smarty->assign("fileup",TRUE);
$str = "";
-
+
/* Reading content */
while(!feof($handle)) {
/* check colum count */
if(is_array($lines))
- foreach($lines as $line) {
- /* continue if theres a comment */
- if(substr(trim($line),0,1)=="#"){
- continue;
- }
+ foreach($lines as $line) {
+ /* continue if theres a comment */
+ if(substr(trim($line),0,1)=="#"){
+ continue;
+ }
- $line= str_replace ("\t","",$line);
- $cells = split(",",$line ) ;
+ $line= str_replace ("\t","",$line);
+ $cells = split(",",$line ) ;
- if(count($cells)> $anz ){
- $anz = count($cells);
+ if(count($cells)> $anz ){
+ $anz = count($cells);
+ }
}
- }
/* At least one entry */
if($anz >1) {
/* Generate array with outpu info */
- if(is_array($lines))
- foreach($lines as $line) {
- $rest = 0;
- $cnt = 0;
-
- /* dont use comments or empty lines */
- if((substr(trim($line),0,1)=="#")||(empty($line))){
- continue;
- }
-
- /* replace \t to , */
- $line= str_replace ("\t" ,"" ,$line);
-
- /* get all elements */
- $cells = split(",",$line ) ;
-
- /* attach all elements to data array */
- if(is_array($cells))
- foreach($cells as $cell) {
- if(!empty($cell)) {
- $cnt++;
- $data[]=trim($cell);
+ if(is_array($lines))
+ foreach($lines as $line) {
+ $rest = 0;
+ $cnt = 0;
+
+ /* dont use comments or empty lines */
+ if((substr(trim($line),0,1)=="#")||(empty($line))){
+ continue;
}
- }
- /* cell count less than anz, attach some empty fields */
- if(($cnt != $anz)&&(!empty($cnt))) {
- $rest = $anz - $cnt;
- for($i = 0 ; $i < $rest ; $i ++){
- $data[] = " ";
+ /* replace \t to , */
+ $line= str_replace ("\t" ,"" ,$line);
+
+ /* get all elements */
+ $cells = split(",",$line ) ;
+
+ /* attach all elements to data array */
+ if(is_array($cells))
+ foreach($cells as $cell) {
+ if(!empty($cell)) {
+ $cnt++;
+ $data[]=trim($cell);
+ }
+ }
+
+ /* cell count less than anz, attach some empty fields */
+ if(($cnt != $anz)&&(!empty($cnt))) {
+ $rest = $anz - $cnt;
+ for($i = 0 ; $i < $rest ; $i ++){
+ $data[] = " ";
+ }
}
- }
- }
+ }
unset($this->csvinfo['sorteddata']);
unset($this->csvinfo['colsstr']);
$i = 0;
$tmp = $tmp2= array();
if(is_array($this->csvinfo['dataout']))
- foreach($this->csvinfo['dataout'] as $dat){
- $tmp[]= $dat;
- $i++;
- if($i >=$this->csvinfo['cols']){
- $i = 0;
- $tmp2[] = $tmp;
- $tmp = array();
- }
+ foreach($this->csvinfo['dataout'] as $dat){
+ $tmp[]= $dat;
+ $i++;
+ if($i >=$this->csvinfo['cols']){
+ $i = 0;
+ $tmp2[] = $tmp;
+ $tmp = array();
+ }
- }
+ }
/* Set Templateid */
$smarty->assign("tplid",$this->csvinfo['tplid']);
for($i = 0 ; $i < $anz; $i ++)
$this->csvinfo['arr_selected'][]="0";
-
+
$smarty->assign("selectedattrs",$this->csvinfo['arr_selected']);
/* Entrie count5 */
diff --git a/plugins/addons/ldapmanager/class_export.inc b/plugins/addons/ldapmanager/class_export.inc
index 4ae91fadb04b570f48d76f2ad7d750e2d2b1530c..8f7dd4d394785ebdf6dec732dfe7a53b26b4cbab 100644 (file)
<?php
-
class ldifexport extends plugin
{
/* Definitions */
var $plHeadline= "CSV import";
var $plDescription= "This does something";
- var $access= "";
/* attribute list for save action */
var $attributes= array();
/* Include config object */
$this->config= $config;
+ /* set permissions */
$ui= get_userinfo();
- $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
- $acl= get_module_permission($acl, "ldifexport", $config->current['BASE']);
- $this->access= $acl;
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
+
}
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* Set government mode */
$smarty= get_smarty();
$smarty->assign("type",FALSE);
+ $smarty->assign("depselectivbb","");
/* Check permissions for export */
- if ($this->access != '#all#'){
+ if (chkacl($this->acl,"export")!=""){
print_red(_("You've no permission to do LDAP exports."));
} else {
// fill in old vars in the Export form
diff --git a/plugins/addons/ldapmanager/class_exportxls.inc b/plugins/addons/ldapmanager/class_exportxls.inc
index 7e6e409e128a6fa662af170a2c1be6dff0266409..47a7870643d90a042bb5f280c7a5e82533fb3eee 100644 (file)
/* Include config object */
$this->config= $config;
+ /* set permissions */
$ui= get_userinfo();
- $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
- $acl= get_module_permission($acl, "ldifexport", $config->current['BASE']);
- $this->access= $acl;
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
}
function execute()
$smarty= get_smarty();
$smarty->assign("type",FALSE);
+ $smarty->assign("depselectivbb","");
/* Check permissions for export */
- if ($this->access != '#all#'){
+ if (chkacl($this->acl,"xlsexport")!=""){
print_red(_("You've no permission to do LDAP exports."));
} else {
// fill in old vars in the Export form
diff --git a/plugins/addons/ldapmanager/class_import.inc b/plugins/addons/ldapmanager/class_import.inc
index 2f09c76e7b4d010e54d507ad4dbd38cb123fe29e..ec5662c8a2dfa7ccc56c6580d188225f74a87241 100644 (file)
/* Include config object */
$this->config= $config;
+ /* set permissions */
$ui= get_userinfo();
- $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
- $acl= get_module_permission($acl, "ldifimport", $config->current['BASE']);
- $this->access= $acl;
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
}
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* Set government mode */
$smarty= get_smarty();
$smarty->assign("type",FALSE);
/* Check permissions for export */
- if ($this->access != '#all#'){
+ if (chkacl($this->acl,"import")!=""){
print_red(_("You've no permission to do LDAP imports."));
} else {
if((isset($_FILES['userfile']['name']))&&(isset($_POST['fileup'])))
$smarty->assign("type","importfile");
-
- $handle = NULL;
+
+ $handle = NULL;
// Check if there is a file submitted
if(!empty($_POST['cleanup'])) $cleanup = true; else $cleanup = false;
//
- $ErrorStr="";
+ $ErrorStr="";
$check = $ldap->import_complete_ldif($str,$ErrorStr,$overwrite,$cleanup);
if($check == INSERT_OK )
}
}
return ($smarty->fetch (get_template_path('contentimport.tpl', TRUE)));
-
+
}
}
index 0e071e1f9a97b059c5d8b00ebde04a2d6cdd4b18..ac00e86fed87593f5950c47d1c7ed3b498a64c82 100644 (file)
#print_red(_("Warning: Please check the SIZELIMIT option set on your LDAP server. You may not get all entries, if this value is to low!"));
+ /* set permissions */
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $ldif->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
+
/* Execute formular */
$display.= $ldif->execute ();
- #$ldap= $config->get_ldap_link();
- #$display.= $ldap->gen_ldif("ou=People,ou=Technik,dc=gonicus,dc=de");
-
$display.= "<input type=\"hidden\" name=\"ignore\">\n";
/* Store changes in session */
index fa5b8d622953a5d799504c9fd7d74497897fa959..d8b6d4863f715756a76de6cee527a0cb39a6d986 100644 (file)
$ACLD['faxreport'] = array("faxreport");
$ACLD['logview'] = array("logview");
$ACLD['mailqueue'] = array("mailqueue");
-$ACLD['ldapmanager']= array("ldapmanager");
+$ACLD['ldapmanager']= array("ldapmanager","import","export","xlsexport","csvimport");
?>