diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc
index 596ab556bf5138d9343200ab65daac59c7c4a3e9..669b818b966f2144bdb017e07631531f412658f0 100644 (file)
var $FTPuid = "";
var $FTPgid = "";
+ var $uid = "";
+
/* attribute list for save action */
var $attributes= array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio",
"FTPUploadBandwidth","FTPDownloadBandwidth","FTPStatus","FTPuid","FTPgid");
var $objectclasses= array("PureFTPdUser");
+ var $ReadOnly;
+ var $view_logged = FALSE;
- function pureftpdAccount ($config, $dn= NULL)
+ function pureftpdAccount (&$config, $dn= NULL, $parent= NULL)
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
+
+ /* Setting uid to default */
+ if(isset($this->attrs['uid'][0])){
+ $this->uid = $this->attrs['uid'][0];
+ }
}
function execute()
{
+ /* Log view */
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","users/".get_class($this),$this->dn);
+ }
+
/* Show tab dialog headers */
$display= "";
$tmp = $this->plInfo();
$changeState = "";
foreach($tmp['plProvidedAcls'] as $key => $desc){
- $smarty->assign($key."ACL", $this->getacl($key));
- $smarty->assign($key."_W", $this->acl_is_writeable($key));
+ $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly));
+ $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly));
if($this->acl_is_writeable($key)){
$changeState.= " changeState('".$key."'); \n";
}
$smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : "");
- if(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) {
+ if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
$smarty->assign('pureftpdACL', "");
}else{
$smarty->assign('pureftpdACL', " disabled ");
$this->cleanup();
$ldap->modify ($this->attrs);
+ /* Log last action */
+ new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/pureftpd account with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
- $this->handle_post_events('remove');
+ $this->handle_post_events('remove',array("uid" => $this->uid));
}
} else {
$this->is_account= FALSE;
}
- }
- plugin::save_object();
+ plugin::save_object();
+
+ $old= $this->FTPStatus;
+ if (isset($_POST["FTPStatus"])){
+ $this->FTPStatus = "disabled";
+ } else {
+ $this->FTPStatus = "enabled";
+ }
+ $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified;
+
+ /* Ensure that these vars are numeric. Values starting with 0 like '0123' cause ldap errors */
+ foreach(array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio","FTPUploadBandwidth","FTPDownloadBandwidth") as $testVar){
+ $this->$testVar = (int) ($this->$testVar);
+ }
+
- $old= $this->FTPStatus;
- if (isset($_POST["FTPStatus"])){
- $this->FTPStatus = "disabled";
- } else {
- $this->FTPStatus = "enabled";
}
- $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified;
}
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);
+
+ /* Log last action */
+ if($this->initially_was_account){
+ new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account with dn '%s' failed."),$this->dn));
/* 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",array("uid" => $this->uid));
}
} else {
- $this->handle_post_events("add");
+ $this->handle_post_events("add",array("uid" => $this->uid));
}
}
{
return (array(
"plShortName" => _("Ftp"),
- "plDescription" => _("Pure ftp account"),
+ "plDescription" => _("Pure ftp account")." : <u>"._("Connectivity addon")."</u>",
"plSelfModify" => TRUE,
"plDepends" => array("user"),
- "plPriority" => 8, // Position in tabs
- "plSection" => "personal", // This belongs to personal
- "plCategory" => array("users"),
+ "plPriority" => 22, // Position in tabs
+ "plSection" => array("personal" => _("My account")),
+ "plCategory" => array("users"),
"plOptions" => array(),
"plProvidedAcls" => array(
- "FTPQuotaFiles" => "!!! FIXME "._("Quota files"),
+ "FTPQuotaFiles" => _("Quota files"),
"FTPUploadRatio" => _("Upload ratio"),
"FTPQuotaMBytes" => _("Quota MBytes"),
"FTPDownloadRatio" => _("Download ratio"),