diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc
index 15432a67467fc6245a471dfe3cb852973f896706..266c0edc37472da54f253df2ceb103ffe0daacf5 100644 (file)
var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
var $goExportEntry = array();
var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
var $goExportEntry = array();
+ var $goExportEntryList= array();
var $goTimeSource = array();
var $goLdapBase = "";
var $goXdmcpIsEnabled = "";
var $goTimeSource = array();
var $goLdapBase = "";
var $goXdmcpIsEnabled = "";
var $mounts_to_remove = array();
var $oldone = NULL; //temp dave for old mount entry
var $mounts_to_remove = array();
var $oldone = NULL; //temp dave for old mount entry
- function servservice ($config, $dn= NULL)
+ function servservice ($config, $dn= NULL, $parent= NULL)
{
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
$ldap = $this->config->get_ldap_link();
$avl_objectclasses = $ldap->get_objectclasses();
$ldap = $this->config->get_ldap_link();
$avl_objectclasses = $ldap->get_objectclasses();
$this->$name= $tmp;
}
$this->$name= $tmp;
}
-
$tmp =array();
$tmp2=array();
if(isset($this->attrs['goExportEntry'])){
$tmp =array();
$tmp2=array();
if(isset($this->attrs['goExportEntry'])){
- unset($this->attrs['goExportEntry']['count']);
- if((isset($this->attrs['goExportEntry']))&&(isset($this->attrs['goExportEntry']))){
- foreach($this->attrs['goExportEntry'] as $entry){
- $tmp2= split("\|",$entry);
- $tmp[$tmp2[0]]= $entry;
+ if(isset($this->attrs['goExportEntry']['count'])){
+ for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
+ $entry= $this->attrs['goExportEntry'][$i];
+ $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
}
}
}
}
}
}
- $this->goExportEntry = $tmp;
+ $this->goExportEntryList = $tmp;
/* Always is account... */
$this->is_account= TRUE;
/* Always is account... */
$this->is_account= TRUE;
function addToList($entry){
$key = key($entry);
function addToList($entry){
$key = key($entry);
- $this->goExportEntry[$key]=$entry[$key];
+ $this->goExportEntryList[$key]=$entry[$key];
}
function deleteFromList($id){
}
function deleteFromList($id){
- unset($this->goExportEntry[$id]);
+ /* Check if the share is used by someone */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*))", array("cn"));
+ $cnt= $ldap->count();
+ if ($cnt){
+ $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
+ $msg.= "<br><br><ul>";
+ while ($attrs= $ldap->fetch()){
+ $msg.= "<li>".$attrs["cn"][0]."</li>";
+ }
+ $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
+ print_red($msg);
+
+ } else {
+ /* Finally remove it */
+ unset($this->goExportEntryList[$id]);
+ }
}
function addToMountList($entry) {
}
function addToMountList($entry) {
function execute()
{
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* Fill templating stuff */
$smarty= get_smarty();
/* Fill templating stuff */
$smarty= get_smarty();
-
$smarty->assign("staticAddress", "");
$smarty->assign("staticAddress", "");
-
- if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntry']))){
+
+ if((isset($_POST['DelNfsEnt'])) && (isset($_POST['goExportEntryList'])) && chkacl($this->acl,"goExportEntry") == ""){
if($this->allow_mounts){
if($this->allow_mounts){
- $this->deleteFromMountList($this->goExportEntry[$_POST['goExportEntry']]);
+ foreach($_POST['goExportEntryList'] as $entry){
+ $this->deleteFromMountList($this->goExportEntryList[$entry]);
+ }
+ }
+ foreach($_POST['goExportEntryList'] as $entry){
+ $this->deleteFromList($entry);
}
}
- $this->deleteFromList($_POST['goExportEntry']);
}
}
- if(isset($_POST['NewNfsAdd'])){
+ if(isset($_POST['NewNfsAdd']) && chkacl($this->acl,"goExportEntry") == ""){
$this->oldone = NULL;
$this->o_subWindow = new servnfs($this->config,$this->acl, $this->allow_mounts, $this->dn);
$this->dialog = true;
}
$this->oldone = NULL;
$this->o_subWindow = new servnfs($this->config,$this->acl, $this->allow_mounts, $this->dn);
$this->dialog = true;
}
- if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntry']))){
- $entry = $this->goExportEntry[$_POST['goExportEntry']];
+ if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList'])) && chkacl($this->acl,"goExportEntry") == ""){
+ $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
$add_mount=isset($this->mounts_to_add[$entry]);
$this->oldone=$entry;
$this->o_subWindow = new servnfs($this->config,$this->acl,$this->allow_mounts,$this->dn,$entry,$add_mount);
$add_mount=isset($this->mounts_to_add[$entry]);
$this->oldone=$entry;
$this->o_subWindow = new servnfs($this->config,$this->acl,$this->allow_mounts,$this->dn,$entry,$add_mount);
}
/* Here we add a new entry */
}
/* Here we add a new entry */
- if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "") {
+ if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && chkacl($this->acl,"goNtpServer") == "") {
$this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
asort($this->goTimeSource);
}
/* Deleting an Entry, is a bit more complicated than adding one*/
$this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
asort($this->goTimeSource);
}
/* Deleting an Entry, is a bit more complicated than adding one*/
- if(isset($_POST['DelNTPEnt'])) {
+ if(isset($_POST['DelNTPEnt']) && chkacl($this->acl,"goNtpServer") == "") {
foreach ($_POST['goTimeSource'] as $entry){
if (isset($this->goTimeSource[$entry])){
unset($this->goTimeSource[$entry]);
foreach ($_POST['goTimeSource'] as $entry){
if (isset($this->goTimeSource[$entry])){
unset($this->goTimeSource[$entry]);
}
$tellSmarty=array();
}
$tellSmarty=array();
- ksort($this->goExportEntry);
- foreach($this->goExportEntry as $name=>$values){
+ ksort($this->goExportEntryList);
+ foreach($this->goExportEntryList as $name=>$values){
$tmp = split("\|",$values);
$tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
}
$tmp = split("\|",$values);
$tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
}
$smarty->assign("goExportEntryACL", " disabled ");
}else{
$smarty->assign("goShareServerState", " ");
$smarty->assign("goExportEntryACL", " disabled ");
}else{
$smarty->assign("goShareServerState", " ");
- $smarty->assign("goExportEntryACL", " ");
+ $smarty->assign("goExportEntryACL", chkacl($this->acl, "goExportEntry"));
}
/* Different handling for checkbox */
}
/* Different handling for checkbox */
if (isset($_POST['servicetab'])){
$tmp = $this->goTimeSource;
if (isset($_POST['servicetab'])){
$tmp = $this->goTimeSource;
- if(isset($_POST['goLdapBase'])){
+ if(isset($_POST['goLdapBase']) && chkacl($this->acl,"goLdapBase") == ""){
$this->goLdapBase = $_POST['goLdapBase'];
$this->goLdapBase = $_POST['goLdapBase'];
- }
+ }
/* Save checkbox state */
foreach ($this->additionaloc as $oc => $dummy){
/* Save checkbox state */
foreach ($this->additionaloc as $oc => $dummy){
}
/* Save xdmcp is enabled flag */
}
/* Save xdmcp is enabled flag */
- if (isset($_POST['goXdmcpIsEnabled'])){
- $this->goXdmcpIsEnabled= "true";
- } else {
- $this->goXdmcpIsEnabled= "false";
+ if(chkacl($this->acl,"goXdmcpIsEnabled") == ""){
+ if (isset($_POST['goXdmcpIsEnabled'])){
+ $this->goXdmcpIsEnabled= "true";
+ } else {
+ $this->goXdmcpIsEnabled= "false";
+ }
}
/* Save xdmcp is enabled flag */
}
/* Save xdmcp is enabled flag */
- if (isset($_POST['goShareServer'])){
- $this->goShareServer = true;
- } else {
- $this->goShareServer = false;
+ if(chkacl($this->acl,"goExportEntry") == ""){
+ if (isset($_POST['goShareServer'])){
+ $this->goShareServer = true;
+ } else {
+ $this->goShareServer = false;
+ }
}
$this->goTimeSource = array();
$this->goTimeSource = $tmp;
}
$this->goTimeSource = array();
$this->goTimeSource = $tmp;
$this->attrs['objectClass']= $tmp;
/* Arrays */
$this->attrs['objectClass']= $tmp;
/* Arrays */
- foreach (array("goTimeSource", "goExportEntry") as $name){
- $this->attrs[$name]= array();
- foreach ($this->$name as $element){
- $this->attrs[$name][]= $element;
+ foreach (array("goTimeSource"=>"goTimeSource", "goExportEntryList"=>"goExportEntry") as $source => $destination){
+ $this->attrs[$destination]= array();
+ foreach ($this->$source as $element){
+ $this->attrs[$destination][]= $element;
}
}
}
}
$this->cleanup();
$ldap->modify ($this->attrs);
$this->cleanup();
$ldap->modify ($this->attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Saving server service object failed"));
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
- $this->handle_post_events("mofify");
+ $this->handle_post_events("modify");
}
} else {
$this->handle_post_events("add");
}
} else {
$this->handle_post_events("add");
if (count($attrs) == 0) {
$ldap->cd($mountsdn);
$ldap->add($mounts);
if (count($attrs) == 0) {
$ldap->cd($mountsdn);
$ldap->add($mounts);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Creating mount container failed"));
gosa_log("Mount container '$mountsdn' has been created");
}
gosa_log("Mount container '$mountsdn' has been created");
}
if (count($attrs) != 0) {
$ldap->rmdir($mountdn);
if (count($attrs) != 0) {
$ldap->rmdir($mountdn);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Removing mount container failed"));
gosa_log("Mount object '".$mountdn."' has been removed");
}
}
gosa_log("Mount object '".$mountdn."' has been removed");
}
}
$mountdn = "cn=".$mount["cn"].","."$mountsdn";
$ldap->cd($mountdn);
$ldap->add($mount);
$mountdn = "cn=".$mount["cn"].","."$mountsdn";
$ldap->cd($mountdn);
$ldap->add($mount);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Saving mount container failed"));
gosa_log("Mount object '".$mountdn."' has been added");
}
}
gosa_log("Mount object '".$mountdn."' has been added");
}
}