summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f3e394d)
raw | patch | inline | side by side (parent: f3e394d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 17 Apr 2007 07:58:50 +0000 (07:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 17 Apr 2007 07:58:50 +0000 (07:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6062 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/addons/gotomasses/class_gotomasses.inc | patch | blob | history | |
plugins/addons/gotomasses/contents.tpl | patch | blob | history | |
plugins/addons/gotomasses/main.inc | patch | blob | history |
diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc
index f20ddb02e3081c9cfe6e79cb3fc13dd88bff466c..113cbcd738283b3b486c34191d725566a1ec43bd 100644 (file)
*/
var $contents_backup = array();
+ var $contents_initially_loaded = FALSE;
function gotomasses($config, $dn= NULL)
{
/* Include config object */
$this->config= $config;
- $this->load_csv_data();
}
function execute()
{
+ /* Load contents */
+ if(!$this->contents_initially_loaded){
+ $this->load_csv_data();
+ $this->contents_initially_loaded = TRUE;
+ }
+
if(isset($_POST['export_gotomass_csv'])){
$data = "";
foreach($this->contents as $val){
/* Import given file */
if(isset($_POST['import_gotomass_csv']) && isset($_FILES['mass_file'])){
- $str = @file_get_contents($_FILES['mass_file']['tmp_name']);
- if(empty($str)){
- print_red(_("The uploaded file seams to be empty, import aborted."));
+ if(!$this->acl_is_writeable("something")){
+ print_red(_("Your are not allowed to import csv data into this plugin."));
}else{
- $this->load_csv_data($str);
+ $str = @file_get_contents($_FILES['mass_file']['tmp_name']);
+ if(empty($str)){
+ print_red(_("The uploaded file seams to be empty, import aborted."));
+ }else{
+ $this->load_csv_data($str);
+ }
}
}
/* Call parent execute */
plugin::execute();
$smarty= get_smarty();
+ $smarty->assign("is_writeable",$this->acl_is_writeable("something"));
+ $smarty->assign("is_readable", $this->acl_is_readable("something"));
$smarty->assign("contents_modified",$this->contents_modified());
$smarty->assign("ogs", $this->get_object_groups());
$smarty->assign("contents", $this->contents);
function load_csv_data($data = NULL)
{
+ $ui = get_userinfo();
+
+ if(!$this->acl_is_readable("something")){
+ $this->contents =array();
+ print_red(_("Your are not allowed to view contents of this plugin."));
+ return(FALSE);
+ }
+
if($data == NULL){
if(!file_exists($this->file_to_read) || !is_readable($this->file_to_read)){
print_red(sprintf(_("Can't locate or read csv storage file '%s'."),$this->file_to_read));
}
}
fclose($fp);
+ $this->contents_backup = $this->contents;
}else{
$this->contents =array();
$rows = split("\n",$data);
}
}
}
- $this->contents_backup = $this->contents;
}
function save_csv_data()
{
+ if(!$this->acl_is_writeable("something")){
+ $this->contents =array();
+ print_red(_("Your are not allowed to write the content of this plugin."));
+ return(FALSE);
+ }
+
if(!file_exists($this->file_to_read) || !is_writeable($this->file_to_read)){
print_red(sprintf(_("Can't locate or write csv storage file '%s'."),$this->file_to_read));
}else{
index 3aa2c295b5bea6072db8d58e3b61dfde7e037308..e578eebf390f2224566d4c2887161ab88944537b 100644 (file)
</td>
<td>
{t}Import{/t}
-
- <input type='file' name='mass_file'>
-
- <input type='submit' name='import_gotomass_csv' value='{t}Import{/t}'>
+
+ {if $is_writeable}
+ <input type='file' name='mass_file'>
+ <input type='submit' name='import_gotomass_csv' value='{t}Import{/t}'>
+ {else}
+ <input type='file' name='mass_file' disabled>
+ <input type='submit' name='import_gotomass_csv' value='{t}Import{/t}' disabled>
+ {/if}
</td>
</tr>
</table>
</select>
</td>
<td style='text-align:right'>
+ {if $is_writeable}
<input type='image' name='remove_{$key}' src='images/edittrash.png'
title='{t}Remove this entry{/t}'>
+ {else}
+
+ {/if}
</td>
</tr>
{/foreach}
+ {if $is_writeable}
<tr>
<td>
-
<input type='submit' name='add_new_entry' value='{t}New entry{/t}'>
</td>
</tr>
+ {/if}
</table>
<div class="contentboxb" style="border-top: 1px solid #B0B0B0; padding:0px; margin-top:10px;">
<p class="contentboxb" style='text-align:right'>
{if $contents_modified}
- <input type='submit' name='save_gotomass_changes' value='{t}Apply{/t}'>
+ {if $is_writeable}
+ <input type='submit' name='save_gotomass_changes' value='{t}Apply{/t}'>
+ {else}
+ <input type='submit' name='save_gotomass_changes' value='{t}Apply{/t}' disabled>
+ {/if}
<input type='submit' name='reload_gotomass_data' value='{t}Cancel{/t}'>
{else}
<input type='submit' name='save_gotomass_changes' value='{t}Apply{/t}' disabled>
index 768476111e2724c0f1430e813e47b958b74aa274..3ce99f860836c05153576fe56817b7fd3335e193 100644 (file)
if (!isset($_SESSION['gotomasses']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
$_SESSION['gotomasses']= new gotomasses ($config);
$_SESSION['gotomasses']->set_acl_category("gotomasses");
+
+ /* Check root dn and user dn for acl informations */
+ $_SESSION['gotomasses']->set_acl_base($config->current['BASE']);
+ if($_SESSION['gotomasses']->getacl("") == ""){
+ $_SESSION['gotomasses']->set_acl_base($ui->dn);
+ }
+
+ /* Check if we have acl on our own base */
+ if($_SESSION['gotomasses']->getacl("") == ""){
+ $_SESSION['gotomasses']->set_acl_base(dn2base($ui->dn));
+ }
+
+
}
$gotomasses= $_SESSION['gotomasses'];