summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 01deeb8)
raw | patch | inline | side by side (parent: 01deeb8)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Aug 2006 07:47:54 +0000 (07:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Aug 2006 07:47:54 +0000 (07:47 +0000) |
Its no longer nescessary to call execute
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4462 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4462 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/netatalk/class_netatalk.inc | patch | blob | history |
diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc
index 7e673fe71efdd458915505eed4b0b2f47d0b5607..e68bc4b6e84119bf3d0389d097e2e6e85302d46b 100644 (file)
var $is_chk_box = array ();
+ function get_shares()
+ {
+ /* Get netatalk shares */
+ $this->shares = array();
+ $ldap = $this->config->get_ldap_link();
+
+ if($this->dn === "new" || $this->dn == NULL) {
+ $ldap->cd($this->parent->by_object['user']->base);
+ } else {
+ $ldap->cd ($this->dn);
+ $ldap->cd ('..'); $ldap->cd ('..');
+ }
+ $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))");
+
+ while ($attrs = $ldap->fetch()){
+ $tmp = split(":", $attrs["cn"][0]);
+ $host = trim($tmp[0]);
+ $dir = trim($tmp[1]);
+ $mountType = trim($attrs["mountType"][0]);
+ if ($mountType == "url") {
+ $mountTypeReal = "netatalk";
+ } else {
+ $mountTypeReal = $mountType;
+ }
+ $share = $attrs["cn"][0]. " (" . $mountTypeReal . ")";
+ $this->shares[$share] = $share;
+ $this->shares_settings[$share]["mountType"]=$mountType;
+ $this->shares_settings[$share]["dir"]=$dir;
+ $this->shares_settings[$share]["host"]=$host;
+
+ $test = $host.$dir;
+ if(preg_match("#".$test."#",$this->apple_user_homeDirectory)){
+ $this->apple_user_share = $this->selectedshare = $share;
+ }
+ }
+ asort($this->shares);
+ }
+
/* The constructor just saves a copy of the config. You may add what ever you need. */
function netatalk($config, $dn = NULL) {
if (strlen($this->apple_user_homeDirectory) >0) {
$this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 );
}
-
+
+ $this->get_shares();
+
/* Save initial account state */
$this->initially_was_account = $this->is_account;
}
return ($display);
}
-
- /* Get netatalk shares */
- $this->shares = array();
- $ldap = $this->config->get_ldap_link();
-
- if($this->dn === "new" || $this->dn == NULL) {
- $ldap->cd($this->parent->by_object['user']->base);
- } else {
- $ldap->cd ($this->dn);
- $ldap->cd ('..'); $ldap->cd ('..');
- }
- $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))");
-
-
/* Show tab dialog headers */
if ($this->parent != NULL) {
if ($this->is_account) {
if (!($obj->is_account) ) {
$errmsg.="Posix features are needed for netatalk accounts, enable them first. ";
}
- if ($ldap->count() == 0) {
+ if (count($this->shares)== 0) {
$errmsg.="At least one share with netatalk or NFS mount entry needed.";
}
if($errmsg==""){
return ($display);
}
}
-
-
- while ($attrs = $ldap->fetch()){
- $tmp = split(":", $attrs["cn"][0]);
- $host = trim($tmp[0]);
- $dir = trim($tmp[1]);
- $mountType = trim($attrs["mountType"][0]);
- if ($mountType == "url") {
- $mountTypeReal = "netatalk";
- } else {
- $mountTypeReal = $mountType;
- }
- $share = $attrs["cn"][0]. " (" . $mountTypeReal . ")";
- $this->shares[$share] = $share;
- $this->shares_settings[$share]["mountType"]=$mountType;
- $this->shares_settings[$share]["dir"]=$dir;
- $this->shares_settings[$share]["host"]=$host;
-
- $oldShare=substr($this->apple_user_homeDirectory, 0, strrpos($this->apple_user_homeDirectory, '/'));
- $newShare=($this->mountDirectory . "/". $host . $dir );
- if (strcmp($oldShare, $newShare)==0) {
- $this->selectedshare = $share;
- }
- }
- asort($this->shares);
+
/* Assign attributes and ACL to smarty */
$SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
$smarty->assign("netatalkShareACL", $this->getacl("netatalkShare",$SkipWrite));