X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_goShareServer.inc;h=5f580dde93e6d69bc6555e0bbb4f843506252a28;hb=ea192ab4f2ec780c4e2f21820ba653c67da84bb3;hp=7c35e429ca0f3431a7b1d5051c45ba8f8951cad2;hpb=5eb03e4557b691447f6b6af572582e43f62443d7;p=gosa.git
diff --git a/plugins/admin/systems/class_goShareServer.inc b/plugins/admin/systems/class_goShareServer.inc
index 7c35e429c..5f580dde9 100644
--- a/plugins/admin/systems/class_goShareServer.inc
+++ b/plugins/admin/systems/class_goShareServer.inc
@@ -1,6 +1,8 @@
DisplayName = _("Shares");
+ $this->DisplayName = _("File service");
$tmp =array();
if(isset($this->attrs['goExportEntry'])){
@@ -54,7 +55,7 @@ class goShareServer extends plugin{
$smarty = get_smarty();
- if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList']))){
+ if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){
if($this->allow_mounts){
foreach($_POST['goExportEntryList'] as $entry){
$this->deleteFromMountList($this->goExportEntryList[$entry]);
@@ -65,9 +66,11 @@ class goShareServer extends plugin{
}
}
- if(isset($_POST['NewNfsAdd'])){
+ if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){
$this->oldone = NULL;
- $this->o_subWindow = new servnfs($this->config,$this->acl, $this->allow_mounts, $this->dn);
+ $this->o_subWindow = new servnfs($this->config, $this);
+ $this->o_subWindow->set_acl_category("server");
+ $this->o_subWindow->set_acl_base($this->dn);
$this->dialog = true;
}
@@ -75,7 +78,9 @@ class goShareServer extends plugin{
$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);
+ $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount);
+ $this->o_subWindow->set_acl_base($this->dn);
+ $this->o_subWindow->set_acl_category("server");
$this->dialog = true;
}
if(isset($this->o_subWindow)){
@@ -91,6 +96,7 @@ class goShareServer extends plugin{
}else{
$this->o_subWindow->save_object();
$newone = $this->o_subWindow->save();
+
$this->addToList($newone);
if($this->allow_mounts){
if($this->oldone) {
@@ -117,14 +123,18 @@ class goShareServer extends plugin{
return $this->o_subWindow->execute();
}
-
-
-
-
foreach($this->attributes as $attr){
$smarty->assign($attr,$this->$attr);
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
}
+
+ /* Set acls */
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+ $smarty->assign("createable",$this->acl_is_createable());
+ $smarty->assign("removeable",$this->acl_is_removeable());
+
$tellSmarty= array();
ksort($this->goExportEntryList);
foreach($this->goExportEntryList as $name=>$values){
@@ -133,44 +143,19 @@ class goShareServer extends plugin{
}
$smarty->assign("goExportEntry",array_keys($tellSmarty));
$smarty->assign("goExportEntryKeys",($tellSmarty));
- $smarty->assign("goExportEntryACL", chkacl($this->acl, "goExportEntry"));
-
-
return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__))));
}
function getListEntry()
{
- $flag = $this->StatusFlag;
- $fields['Status'] = $this->$flag;
- $fields['Message'] = _("Shares");
- $fields['AllowStart'] = true;
- $fields['AllowStop'] = true;
- $fields['AllowReset'] = true;
- $fields['AllowRemove']= true;
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("File service (Shares)");
$fields['AllowEdit'] = true;
return($fields);
}
- function remove_from_parent()
- {
- plugin::remove_from_parent();
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error());
- }
-
-
function save()
{
plugin::save();
@@ -189,7 +174,6 @@ class goShareServer extends plugin{
$this->process_mounts();
}
-
/* Check if this is a new entry ... add/modify */
$ldap = $this->config->get_ldap_link();
$ldap->cat($this->dn,array("objectClass"));
@@ -200,45 +184,12 @@ class goShareServer extends plugin{
$ldap->cd($this->dn);
$ldap->add($this->attrs);
}
- show_ldap_error($ldap->get_error());
- }
-
-
- /* Directly save new status flag */
- function setStatus($value)
- {
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $ldap->cat($this->dn,array("objectClass"));
-
- if($ldap->count()){
- $attrs =array();
- foreach(array() as $req) {
- if(!isset($attrs[$req])){
- if(empty($this->$req)){
- print_red(sprintf(_("The required attribute '%s' is not set."),$req));
- }else{
- $attrs[$req] = $this->$req;
- }
- }else{
- $attrs[$req] = $attrs[$req][0];
- }
- }
-
- $tmp = $ldap->fetch();
- for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
- $attrs['objectClass'][] = $tmp['objectClass'][$i];
- }
- if(!in_array("goShareServer",$attrs['objectClass'])){
- $attrs['objectClass'][] = "goShareServer";
- }
-
- $flag = $this->StatusFlag;
- $attrs[$flag] = $value;
- $this->$flag = $value;
- $ldap->modify($attrs);
- show_ldap_error($ldap->get_error());
- }
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
+ if($this->initially_was_account){
+ $this->handle_post_events("modify");
+ }else{
+ $this->handle_post_events("add");
+ }
}
@@ -261,8 +212,26 @@ class goShareServer extends plugin{
$this->goExportEntryList[$key]=$entry[$key];
}
- function deleteFromList($id){
- unset($this->goExportEntryList[$id]);
+ function deleteFromList($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.= "