index 2da0b7458477fcbb01946690073ccf6973f52351..729d9d5c15e4b348d9e1f87f87770dced9a624db 100644 (file)
/* Create user object on demand */
if (!isset($_SESSION['user']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
$_SESSION['user']= new user ($config, $ui->dn);
+ $_SESSION['user']->set_acl_base($ui->dn);
+ $_SESSION['user']->set_acl_category("users");
}
$user= $_SESSION['user'];
}
/* Enter edit mode? */
- if (isset($_POST['edit'])){
+ if ((isset($_POST['edit'])) && (!isset( $_SESSION['edit']))){
/* Check locking */
if (($username= get_lock($ui->dn)) != ""){
$_SESSION['edit']= TRUE;
}
- /* Adjust acl's to mode */
- if (isset($_SESSION['edit'])){
- $acl= get_permissions ($ui->dn, $ui->subtreeACL);
- $user->acl= get_module_permission($acl, "user", $ui->dn);
- } else {
- $acl= get_permissions ($ui->dn, $ui->subtreeACL);
- $editacl= get_module_permission($acl, "user", $ui->dn);
- $user->acl= "#none#";
- }
-
/* Perform password change */
if (isset($_POST['password_finish'])){
/* For security reasons, check if user is allowed to set password again */
- if (chkacl($user->acl, "password") == "" || chkacl($user->acl, "create")){
+ if ($user->acl_is_writable("userPassword") || $user->acl_is_createable()){
/* Check input and feed errors into 'message' */
$message= array();
print_red (_("You are not allowed to set your password!"));
}
- $user->acl= "#none#";
del_lock ($ui->dn);
}
if (count ($message) == 0){
$user->save ();
gosa_log ("User/generic object'".$ui->dn."' has been saved");
- $user->acl= "#none#";
del_lock ($ui->dn);
sess_del ('edit');
}
$info = "";
+
/* Show page footer depending on the mode */
if (!$user->cert_dialog && !$user->picture_dialog && $user->is_account){
$display.= "<p class=\"plugbottom\">";
/* Are we in edit mode? */
if (isset($_SESSION['edit'])){
- $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
$display.= " ";
$display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $display.="<script language='javascript'>";
- $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+ $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
"\"> ".$ui->dn." ";
} else {
/* 'viewid' may be set by i.e. the phonelist plugin. This
} else {
$str= _("Edit");
$fn = "edit";
- $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+ $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
"\"> ".$ui->dn." ";
}
- if ($fn == "edit" && isset($editacl) && $editacl != "#none#"){
- $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
- _("Click the 'Edit' button below to change informations in this dialog");
- $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
+
+ /* Only display edit button if there is at least one attribute editable */
+ if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
+ if ($fn == "edit"){
+ $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+ _("Click the 'Edit' button below to change informations in this dialog");
+ $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
+ }
}
+
$display.= "<input type=\"hidden\" name=\"ignore\">\n";
}
$display.= "</p>\n";