diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc
index c2aae12409660d498cdccca056818142c71bf675..1bedf3462140673bc870a602b09ef57021fad9a8 100644 (file)
var $attributes= array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio",
"FTPUploadBandwidth","FTPDownloadBandwidth","FTPStatus","FTPuid","FTPgid");
var $objectclasses= array("PureFTPdUser");
+ var $ReadOnly;
function pureftpdAccount ($config, $dn= NULL)
{
function execute()
{
- /* Call parent execute */
-// plugin::execute();
-
/* Show tab dialog headers */
$display= "";
/* Load attributes */
foreach($this->attributes as $val){
$smarty->assign("$val", $this->$val);
- $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
}
+
+
+ $tmp = $this->plInfo();
+ $changeState = "";
+ foreach($tmp['plProvidedAcls'] as $key => $desc){
+ $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("changeState",$changeState);
+
+
$smarty->assign("fstate", "");
if ($this->is_account){
$smarty->assign("pureftpdState", "checked");
}
}
$smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : "");
-
- $smarty->assign("pureftpdACL", chkacl($this->acl, 'pureftpd'));
-
- $changeState = "";
- foreach($this->attributes as $attr){
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
- if(chkacl($this->acl,$attr)==""){
- $changeState .= "changeState('".$attr."');\n";
- }
+
+ 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 ");
}
- $smarty->assign("changeState",$changeState);
+
$display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__)));
return ($display);
}
function remove_from_parent()
{
/* Cancel if there's nothing to do here */
- if (!$this->initially_was_account){
+ if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
return;
}
/* Check for positive integer values */
if ($this->is_account){
- if ((!is_id($this->FTPUploadBandwidth))&&(chkacl($this->acl,"FTPUploadBandwidth")=="")){
+
+ if($this->acl_is_writeable("FTPUploadBandwidth") && !is_id($this->FTPUploadBandwidth)){
$message[]= _("Value specified as 'Upload bandwidth' is not valid.");
}
- if ((!is_id($this->FTPDownloadBandwidth))&&(chkacl($this->acl,"FTPDownloadBandwidth")=="")){
+ if($this->acl_is_writeable("FTPDownloadBandwidth") && !is_id($this->FTPDownloadBandwidth)){
$message[]= _("Value specified as 'Download bandwidth' is not valid.");
}
- if ((!is_id($this->FTPQuotaFiles))&&(chkacl($this->acl,"FTPQuotaFiles")=="")){
- $message[]= _("Value specified as 'Files' is not valid.");
+
+ if($this->acl_is_writeable("FTPQuotaFiles") && !is_id($this->FTPQuotaFiles)){
+ $message[]= _("Value specified as 'Quota files' is not valid.");
+ }
+ if($this->acl_is_writeable("FTPQuotaMBytes") && !is_id($this->FTPQuotaMBytes)){
+ $message[]= _("Value specified as 'Quota size' is not valid.");
}
- if ((!is_id($this->FTPQuotaMBytes))&&(chkacl($this->acl,"FTPQuotaMBytes")=="")){
- $message[]= _("Value specified as 'Size' is not valid.");
+ if($this->acl_is_writeable("FTPUploadRatio") && !is_id($this->FTPUploadRatio)){
+ $message[]= _("Value specified as 'Upload ratio' is not valid.");
}
- if ((!is_id($this->FTPUploadRatio) || !is_id($this->FTPDownloadRatio))&&(chkacl($this->acl,"FTPUploadRatio")=="")&&(chkacl($this->acl,"FTPDownloadRatio")=="")){
- $message[]= _("Value specified as 'Ratio' is not valid.");
+ if($this->acl_is_writeable("FTPDownloadRatio") && !is_id($this->FTPDownloadRatio)){
+ $message[]= _("Value specified as 'Download ratio' is not valid.");
}
}
{
plugin::save();
- foreach($this->attributes as $attr){
- if(chkacl($this->acl,$attr)!=""){
- unset($this->attrs[$attr]);
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $key => $desc){
+ if(!$this->acl_is_writeable($key)){
+ unset($this->attrs[$key]);
}
}
}
- /* Return pluign informations for acl handling
+ /* Return plugin informations for acl handling
#FIME There possibly some attributes that can be combined to one acl. */
function plInfo()
{
- return (array(
- "plDescription" => _("Intranet account settings"),
+ return (array(
+ "plShortName" => _("Ftp"),
+ "plDescription" => _("Pure ftp account"),
"plSelfModify" => TRUE,
- "plDepends" => array("objectClass" => "gosaAccount"),
-
- "FTPQuotaFiles" => "!!! FIXME "._("Quota files"),
- "FTPUploadRatio" => _("Upload ratio"),
- "FTPQuotaMBytes" => _("Quota MBytes"),
- "FTPDownloadRatio" => _("Download ratio"),
- "FTPUploadBandwidth" => _("Upload bandwith"),
- "FTPDownloadBandwidth" => _("Download bandwith"),
- "FTPStatus" => _("Status")));
+ "plDepends" => array("user"),
+ "plPriority" => 8, // Position in tabs
+ "plSection" => "personal", // This belongs to personal
+ "plCategory" => array("users"),
+ "plOptions" => array(),
+
+ "plProvidedAcls" => array(
+ "FTPQuotaFiles" => "!!! FIXME "._("Quota files"),
+ "FTPUploadRatio" => _("Upload ratio"),
+ "FTPQuotaMBytes" => _("Quota MBytes"),
+ "FTPDownloadRatio" => _("Download ratio"),
+ "FTPUploadBandwidth" => _("Upload bandwith"),
+ "FTPDownloadBandwidth" => _("Download bandwith"),
+ "FTPStatus" => _("Status"))
+ ));
}
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: