summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7096354)
raw | patch | inline | side by side (parent: 7096354)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 26 Aug 2005 08:20:55 +0000 (08:20 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 26 Aug 2005 08:20:55 +0000 (08:20 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1222 594d385d-05f5-0310-b6e9-bd551577e9d8
index 580029e607a2e97c2744a5f8201cf8fced61157b..e4e27bea8c1370640944f92e71aa93ec4a1c158e 100644 (file)
"goFonConferenceOption_c",
"goFonConferenceOwner");
+$ACLD['gotoEnvironment']=array(
+ "gotoPrinter",
+ "gotoEnvironment",
+ "gotoShare",
+ "gotoProfileServer",
+ "gotoProfileFlags",
+ "gotoXResolution",
+ "gotoLogonScript",
+ "gotoKioskProfile",
+ "gotoProfileQuota",
+ "gotoHotplugDevice"
+ );
+
+
$ACLD['global-addressbook']= array("create", "delete");
?>
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index cc23c1d61d8c217de528eecceeebac260e80df32..0f812e6a4386b17b46d662bed563beae66d3b7da 100644 (file)
name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
$posiximg = "<input type='image' src='images/select_user.png' alt='"._("Posix")."'
name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
+ $eviroimg = "<input type='image' src='images/network.png' alt='"._("Environment")."'
+ name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
$mailimg = "<input type='image' src='images/mailto.png' alt='"._("Mail")."'
name='user_edit_%KEY%-mailAccount' title='"._("Edit mail properties")."'>";
$fonimg = "<input type='image' src='images/%image%' alt='"._("Phone")."'
}else{
$posix=$empty;
}
+
+ if(in_array("gotoEnvironment" ,$val['objectClass'])){
+ $enviro = preg_replace("/%KEY%/", "$key", $eviroimg);
+ }else{
+ $enviro =$empty;
+ }
if(in_array("gosaMailAccount" ,$val['objectClass'])){
$maila = preg_replace("/%KEY%/", "$key", $mailimg);
/* Create each field */
$field1 = array("string" => sprintf($tpl,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
$field2 = array("string" => sprintf($editlink,$key,$display).$ip_port,"attach"=>"title='".$val['dn']."'");
- $field3 = array("string" => $usrimg." ".$posix." ".$maila." ".$fonac." ".$faxac." ".$samba." ".$s_img_create_from_template, "attach" => "style='width:138px;'");
+ $field3 = array("string" => $usrimg." ".$posix." ".$enviro." ".$maila." ".$fonac." ".$faxac." ".$samba." ".$s_img_create_from_template, "attach" => "style='width:138px;'");
$field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:48px'");
$add = array($field1,$field2,$field3,$field4);
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
index d0b694cff2058e0a40eba29cb767bcafec344e70..44f2ae039e7606c585af5b8a34e0390d747237ab 100644 (file)
var $plHeadline = "Environment";
var $plDescription = "This does something";
var $dialog = false; // Indicates that we are currently editing in an seperate dialog
-
+
+ var $in_dialog = false;
+ var $uid = "";
/* Attribute definition
*/
}
}
+ /* prepare LogonScripts */
+ if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
+ unset($this->attrs['gotoLogonScript']['count']);
+ foreach($this->attrs['gotoLogonScript'] as $device){
+ $tmp = $tmp2 = array();
+ $tmp = split("\|",$device);
+ $tmp2['LogonName'] = $tmp[0];
+ $tmp2['LogonPriority'] = $tmp[2];
+ if(preg_match("/O/i",$tmp[1])){
+ $tmp2['LogonOverload'] = "O";
+ }else{
+ $tmp2['LogonOverload'] = "";
+ }
+ if(preg_match("/L/i",$tmp[1])){
+ $tmp2['LogonLast'] = "L";
+ }else{
+ $tmp2['LogonLast'] = "";
+ }
+ $tmp2['LogonData'] = base64_decode($tmp[3]);
+ $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+ }
+ }
+
/* Prepare Shares */
if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
unset($this->attrs['gotoShare']['count']);
// 1. Account disabled . Editing from usermenu
if((!isset($this->parent))&&(!$this->is_account)){
- /* We are currently editing this tab from usermenu, but htis account is not enabled */
+ /* We are currently editing this tab from usermenu, but this account is not enabled */
$smarty->assign("is_account",$this->is_account);
/* Load template */
$display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
$display= $this->show_header(_("Remove environment extension"),
_("This server has environment extension enabled. You can disable it by clicking below."));
} else {
- // 4. Account disabled . Editing from adminmenu
- $display= $this->show_header(_("Add environment extension"),
- _("This server has environment extension disabled. You can enable it by clicking below."));
- return $display;
+ if((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)){
+ // 4. There is a PosixAccount
+ $display= $this->show_header(_("Add environment extension"),
+ _("This server has environment extension disabled. You can enable it by clicking below."));
+ return $display;
+ }else{
+ // 4. There is a PosixAccount
+ $display= $this->show_header(_("Add environment extension"),
+ _("This server has environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
+ return $display;
+ }
}
}
}
* We only can delete if there is an entry selected.
*/
if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
- $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
- print "Deleting ".$is_entry;
+ unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
}
/* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
if(isset($_POST['iamposted'])){
plugin::save_object();
foreach($this->attributes as $s_attr){
- if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters","gotoLogonScripts"))) continue;
+ if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters","gotoLogonScripts","uid"))) continue;
if(isset($_POST[$s_attr])){
$this->$s_attr = $_POST[$s_attr];
}else{
$ldap= $this->config->get_ldap_link();
$realyUsedAttrs= array();
+
+
+
/* Save already used objectClasses */
$ocs = $this->attrs['objectClass'];
unset($ocs['count']);
/* Save usersettings to Printer */
+
+ if(chkacl($this->acl,"gotoPrinter")!=""){
+ $this->gotoPrinters = array();
+ }
+
+ if(count($this->gotoPrinters)==0){
+ $ldap->search("(&(objectClass=gotoPrinter)(|(gotoUserPrinter=".$this->uid.")(gotoAdminPrinter=".$this->uid.")))",array("*"));
+ while($attr = $ldap->fetch()){
+
+ foreach($attr['gotoUserPrinter'] as $key => $user){
+ if($this->uid==$user){
+ unset($attr['gotoUserPrinter'][$key]);
+ }
+ }
+
+ foreach($attr['gotoAdminPrinter'] as $key => $user){
+ if($this->uid==$user){
+ unset($attr['gotoAdminPrinter'][$key]);
+ }
+ }
+
+ $attrs_used = array();
+ foreach($attr as $key=>$val){
+ if((!is_numeric($key))&&($key!="count")){
+ if(is_array($val)&&isset($val['count'])){
+ unset($val['count']);
+ }
+ $attrs_used[$key]=$val;
+ }
+ }
+ $attr= $attrs_used;
+ $tmp =array();
+ foreach($attr['gotoAdminPrinter'] as $print){
+ $tmp[]=$print;
+ }
+ $attr['gotoAdminPrinter'] = $tmp;
+
+ $tmp =array();
+ foreach($attr['gotoUserPrinter'] as $print){
+ $tmp[]=$print;
+ }
+ $attr['gotoUserPrinter'] = $tmp;
+
+ $ldap->cd($attr['dn']);
+ unset($attr['dn']);
+ $ldap->modify($attr);
+ if($ldap->get_error()!="Success"){
+ print_red("Printer saving ".$ldap->get_error());
+ }
+ }
+ }
+
foreach($this->gotoPrinters as $printer) {
$ldap->cd($printer['dn']);
$ldap->cat($printer['dn']);
$attribute = "gotoAdminPrinter";
$attribute2 = "gotoUserPrinter";
}
-
+
/* If this user is already assigned to $attribute2
* delete user from $attribute2, to be albe to attach him to $attribute
* A user can't be admin and normal user for one printer
if(in_array($this->uid,$printer[$attribute2])){
$tmp = array_flip($attrs[$attribute2]);
unset($tmp[$this->uid]);
- $attrs[$attribute2]=$tmp;
+ $attrs[$attribute2]=array_flip($tmp);
}
/* If Last entry removed, clear attribute*/
if(empty($attrs[$attribute2])){
$attrs[$attribute2]=array();
}
}
-
+
/* Attach user to the $attribute, if he is'nt already attached
*/
if(!isset($attrs[$attribute])){
$attrs[$attribute][]=$this->uid;
}
}
+
+ $tmp =array();
+ if(isset($attrs['gotoAdminPrinter'])){
+ foreach($attrs['gotoAdminPrinter'] as $print){
+ $tmp[]=$print;
+ }
+ }
+ $attrs['gotoAdminPrinter'] = $tmp;
+
+ $tmp =array();
+ if(isset($attrs['gotoUserPrinter'])){
+ foreach($attrs['gotoUserPrinter'] as $print){
+ $tmp[]=$print;
+ }
+ }
+ $attrs['gotoUserPrinter'] = $tmp;
+
$ldap->cd($attrs['dn']);
unset($attrs['dn']);
$ldap->modify($attrs);
if($ldap->get_error()!="Success"){
- print_red($ldap->get_error());
+ print_red("Printer saving ".$ldap->get_error());
}
}
-
+
+ plugin::save();
+
+ if(isset($this->attrs['gotoPrinter'])){
+ unset($this->attrs['gotoPrinter']);
+ }
+
/* Prepare HotPlug devices */
$this->attrs['gotoHotplugDevice'] = array();
foreach($this->gotoHotplugDevices as $name => $device){
$this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'];
}
+ /* Prepare LogonScripts */
+ $this->attrs['gotoLogonScript'] = array();
+ foreach($this->gotoLogonScripts as $name => $script){
+ $this->attrs['gotoLogonScript'][] = $script['LogonName']."|".
+ $script['LogonOverload'].$script['LogonLast']."|".
+ $script['LogonPriority']."|".
+ base64_encode($script['LogonData']);
+ }
+
/* Prepare Shares */
$this->attrs['gotoShare']=array();
foreach($this->gotoShares as $name => $share){
$this->attrs['gotoProfileServer']= array();
}
+ foreach($this->attributes as $s_attr){
+ if(chkacl($this->acl,$s_attr)!="") {
+ if(isset($this->attrs[$s_attr])){
+ unset($this->attrs[$s_attr]);
+ }
+ }
+ }
+
+
$ldap->cat ($this->dn);
if ($ldap->fetch()){
$mode= "modify";
$this->handle_post_events($mode);
}
-
-
-
/* This function returns all available Shares defined in this ldap
* There are two ways to call this function, if listboxEntry is true
* only name and path are attached to the array, in it is false, the whole
*/
function printOutLogonScripts()
{
- print_a($this->gotoLogonScripts);
$a_return = array();
if(is_array($this->gotoLogonScripts)){
foreach($this->gotoLogonScripts as $script){
diff --git a/plugins/personal/environment/class_kioskManagementDialog.inc b/plugins/personal/environment/class_kioskManagementDialog.inc
index ef006783117490cd4bb65fd6a4a3760ee0d3245e..4b26117810407e6cc854220158f7cb75086f41dc 100644 (file)
$file = $_FILES['newProfile'];
if(!file_exists($this->baseDir.$file['name'])){
$name = preg_replace("/\..*$/","",$file['name']).$this->filePrefix;
- $str = file_get_contents($file['tmp_name']);
- $fp = fopen($this->baseDir.$name,"w+");
- fwrite($fp,$str,strlen($str));
- fclose($fp);
+ $str = file_get_contents($file['tmp_name']);
+ $fp = @fopen($this->baseDir.$name,"w+");
+ if($fp){
+ fwrite($fp,$str,strlen($str));
+ fclose($fp);
+ }else{
+ print_red(_("Can't save kioskProfile. Permission denied.")." ".$this->baseDir);
+ }
+ unlink($file['tmp_name']);;
}
}
function getKioskProfiles()
{
$dir = opendir($this->baseDir);
+ if(!file_exists($this->baseDir)){
+ mkdir($this->baseDir);
+ }
$a_return = array();
while($file = readdir($dir)){
if(preg_match("/".$this->filePrefix."$/i",$file)){
diff --git a/plugins/personal/environment/class_logonManagementDialog.inc b/plugins/personal/environment/class_logonManagementDialog.inc
index 55b16c7df4ed6135bc32ec4a0db1c6bedec8783d..0587f834bb15c3284afd29f5a55076e9a0160a72 100644 (file)
var $LogonLast =""; // Is this script marked as the last, all following scripts will be skipped
var $LogonOverload =""; // If Overload is activated this script is overlaodable by a group script with same prio
var $LogonData =""; // The script itself
+ var $nameIsEditable = true;
- function logonManagementDialog ($config, $dn= NULL,$use_existing=false )
+ var $real_LogonName = "";
+
+ function logonManagementDialog ($config, $dn= NULL,$data=false)
{
- $this->use_existing = $use_existing;
plugin::plugin ($config, $dn);
+
+ if($data){
+ $this->LogonName = $data['LogonName'];
+ $this->LogonPriority = $data['LogonPriority'];
+ $this->LogonOverload = $data['LogonOverload'];
+ $this->LogonLast = $data['LogonLast'];
+ $this->LogonData = $data['LogonData'];
+ $this->nameIsEditable = false;
+ $this->real_LogonName = $data['LogonName'];
+ }
}
function execute()
$prios=array(1,2,3,4,5,6,7,8,9,10);
$smarty->assign("LogonPrioritys",$prios);
$smarty->assign("LogonPriorityKeys",$prios);
+
+ if(!$this->nameIsEditable){
+ $smarty->assign("LogonNameACL"," disabled ");
+ }else{
+ $smarty->assign("LogonNameACL","");
+ }
+
$display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
return($display);
}
foreach($this->attributes as $attr){
$a_return[$attr]=$this->$attr;
}
+
+ if(!$this->nameIsEditable){
+ $a_return['LogonName']=$this->real_LogonName;
+ }
+
return($a_return);
}
diff --git a/plugins/personal/environment/environment.tpl b/plugins/personal/environment/environment.tpl
index ee4acbce0b2232962ae321e175bcae73a64a2e72..e182f88d13e6299990c477b70091c4ca8f0dba34 100644 (file)
<table summary="">
<tr>
<td>
- <input type="checkbox" value="1" {$useProfileCHK} name="useProfile">
+ <input type="checkbox" value="1" {$useProfileCHK} name="useProfile" {$useProfileACL}>
</td>
<td valign="top">
{t}Use profile managment{/t}
<td>{t}Quota{/t}
</td>
<td>
- <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}">
+ <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" {$gotoProfileQuotaACL}>
</td>
</tr>
<tr>
</td>
<td>
- <input type="submit" name="KioskManagementDialog" value="{t}Profile management{/t}">
+ <input type="submit" name="KioskManagementDialog" value="{t}Profile management{/t}" {$gotoKioskProfileACL}>
</td>
</tr>
</table>
</select>
<br>
- <input type="submit" {gotoLogonScriptACL} name="gotoLogonScriptNew" value="{t}Add{/t}">
- <input type="submit" {gotoLogonScriptACL} name="gotoLogonScriptDel" value="{t}Delete{/t}">
- <input type="submit" {gotoLogonScriptACL} name="gotoLogonScriptEdit" value="{t}Edit{/t}">
+ <input type="submit" {$gotoLogonScriptACL} name="gotoLogonScriptNew" value="{t}Add{/t}">
+ <input type="submit" {$gotoLogonScriptACL} name="gotoLogonScriptDel" value="{t}Delete{/t}">
+ <input type="submit" {$gotoLogonScriptACL} name="gotoLogonScriptEdit" value="{t}Edit{/t}">
</td>
</tr>
</table>
diff --git a/plugins/personal/environment/logonManagement.tpl b/plugins/personal/environment/logonManagement.tpl
index d5abcbd682d0b6d28becd15c4fdcbc035b068021..acae9af5dfe93cf1349de070dc34726e48e9930a 100644 (file)
<td>{t}Name{/t}
</td>
<td>
- <input type="text" value="{$LogonName}" name="LogonName">
+ <input type="text" value="{$LogonName}" name="LogonName" {$LogonNameACL}>
</td>
</tr>
<tr>
index 91883ab78c87743d22741d2ef36392524e95fa8e..22f06d12bd5696333de36faf50de385731164a5d 100644 (file)
/* Adjust acl's to mode */
if (isset($_SESSION['edit'])){
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
- $environment->acl= get_module_permission($acl, "environment", $ui->dn);
+ $environment->acl= get_module_permission($acl, "gotoEnvironment", $ui->dn);
} else {
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
- $editacl= get_module_permission($acl, "environment",$ui->dn);
+ $editacl= get_module_permission($acl, "gotoEnvironment",$ui->dn);
$environment->acl= "#none#";
}
$display.= "<p class=\"plugbottom\">";
/* Are we in edit mode? */
- if (isset($_SESSION['edit'])){
+ if ((isset($_SESSION['edit']))&&($environment->dialog==NULL)){
$display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
$display.= " ";
$display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";