X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fpersonal%2Fposix%2Fclass_posixAccount.inc;h=6a66a4f6cc7e9f39e6c7904906a8460a25759fa1;hb=31f5c6913649a183107e45126b93e3c953ec0efc;hp=f6616018b166e8a0a47c114025dcd24cc7c69019;hpb=e299f0ca47a924516f2afbe4e922f2418b75315c;p=gosa.git
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
index f6616018b..6a66a4f6c 100644
--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -38,6 +38,7 @@ class posixAccount extends plugin
var $accessTo= array();
var $trustModel= "";
+ var $glist=array();
var $status= "";
var $loginShellList= array();
var $groupMembership= array();
@@ -214,7 +215,7 @@ class posixAccount extends plugin
/* Do we represent a valid posixAccount? */
if (!$this->is_account && $this->parent == NULL ){
- $display= "
".
+ $display= "
".
_("This account has no unix extensions.")."";
$display.= back_to_main();
return ($display);
@@ -229,14 +230,15 @@ class posixAccount extends plugin
$obj= $this->parent->by_object['sambaAccount'];
}
if (isset($obj) && $obj->is_account == TRUE &&
- isset($this->parent->by_object['sambaAccount'])){
+ ((isset($this->parent->by_object['sambaAccount']))&&($this->parent->by_object['sambaAccount']->is_account))
+ ||(isset($this->parent->by_object['environment'] ))&&($this->parent->by_object['environment'] ->is_account)){
/* Samba3 dependency on posix accounts are enabled
in the moment, because I need to rely on unique
uidNumbers. There'll be a better solution later
on. */
$display= $this->show_header(_("Remove posix account"),
- _("This account has unix features enabled. To disable them, you'll need to remove the samba account first."), TRUE);
+ _("This account has unix features enabled. To disable them, you'll need to remove the samba / environment account first."), TRUE);
} else {
$display= $this->show_header(_("Remove posix account"),
_("This account has posix features enabled. You can disable them by clicking below."));
@@ -358,6 +360,7 @@ class posixAccount extends plugin
}
$smarty->assign("hint", print_sizelimit_warning());
$smarty->assign("wslist", $wslist);
+ $smarty->assign("apply", apply_filter());
$display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
return ($display);
}
@@ -394,7 +397,7 @@ class posixAccount extends plugin
register_global("groupfilter", $groupfilter);
/* Calculate actual groups */
- $gd->reload();
+ $gd->reload2();
$glist= array();
foreach ($gd->grouplist as $key => $value){
if (!isset($this->groupMembership[$key])){
@@ -402,7 +405,6 @@ class posixAccount extends plugin
}
}
- /* Show dialog */
$smarty->assign("groups", $glist);
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("launchimage", get_template_path('images/small_filter.png'));
@@ -415,6 +417,7 @@ class posixAccount extends plugin
}
$smarty->assign("hint", print_sizelimit_warning());
+ $smarty->assign("apply", apply_filter());
$display.= $smarty->fetch (get_template_path('posix_groups.tpl', TRUE, dirname(__FILE__)));
return ($display);
}
@@ -438,8 +441,10 @@ class posixAccount extends plugin
"use_shadowWarning") as $val){
if ($this->$val == 1){
$smarty->assign("$val", "checked");
- $smarty->assign("$val"."ACL", chkacl($this->acl, $val));
+ } else {
+ $smarty->assign("$val", "");
}
+ $smarty->assign("$val"."ACL", chkacl($this->acl, $val));
}
}
@@ -468,9 +473,15 @@ class posixAccount extends plugin
$smarty->assign("shells", $this->loginShellList);
$smarty->assign("secondaryGroups", $this->secondaryGroups);
$smarty->assign("primaryGroup", $this->primaryGroup);
- $smarty->assign("groupMembership", $this->groupMembership);
+ if (!count($this->groupMembership)){
+ $smarty->assign("groupMembership", array(" "));
+ } else {
+ $smarty->assign("groupMembership", $this->groupMembership);
+ }
if (count($this->groupMembership) > 16){
$smarty->assign("groups", "too_many_for_nfs");
+ } else {
+ $smarty->assign("groups", "");
}
$smarty->assign("printerList", $this->printerList);
$smarty->assign("languages", $this->config->data['MAIN']['LANGUAGES']);
@@ -478,38 +489,71 @@ class posixAccount extends plugin
/* Checkboxes */
if ($this->force_ids == 1){
$smarty->assign("force_ids", "checked");
+ if ($_SESSION['js']){
+ $smarty->assign("forceMode", "");
+ }
} else {
- if ($_SESSION["js"]){
+ if ($_SESSION['js']){
$smarty->assign("forceMode", "disabled");
}
+ $smarty->assign("force_ids", "");
}
$smarty->assign("force_idsACL", chkacl($this->acl, "force_ids"));
/* Load attributes and acl's */
foreach($this->attributes as $val){
+ if(($_SESSION["js"])&&(($val=="uidNumber")||($val=="gidNumber")))
+ {
+ $smarty->assign("$val"."ACL","");
+ $smarty->assign("$val", $this->$val);
+ continue;
+ }
$smarty->assign("$val", $this->$val);
$smarty->assign("$val"."ACL", chkacl($this->acl,$val));
}
$smarty->assign("groupMembershipACL", chkacl($this->acl, "groupMembership"));
- $smarty->assign("must_change_password", chkacl($this->acl, "must_change_password"));
+ $smarty->assign("status", $this->status);
/* Work on trust modes */
$smarty->assign("trustmodeACL", chkacl($this->acl, "trustmode"));
if ($this->trustModel == "fullaccess"){
$trustmode= 1;
- $smarty->assign("trusthide", "disabled");
+ // pervent double disable tag in html code, this will disturb our clean w3c html
+
+ if(chkacl($this->acl, "trustmode")==""){
+ $smarty->assign("trusthide", "disabled");
+ }else{
+ $smarty->assign("trusthide", "");
+ }
+
} elseif ($this->trustModel == "byhost"){
$trustmode= 2;
$smarty->assign("trusthide", "");
} else {
- $smarty->assign("trusthide", "disabled");
+ // pervent double disable tag in html code, this will disturb our clean w3c html
+ if(chkacl($this->acl, "trustmode")==""){
+ $smarty->assign("trusthide", "disabled");
+ }else{
+ $smarty->assign("trusthide", "");
+ }
$trustmode= 0;
}
$smarty->assign("trustmode", $trustmode);
$smarty->assign("trustmodes", array( 0 => _("disabled"), 1 => _("full access"),
2 => _("allow access to these hosts")));
+
+
+
+ if((count($this->accessTo))==0)
+ $smarty->assign("emptyArrAccess",true);
+ else
+ $smarty->assign("emptyArrAccess",false);
+
+
+
$smarty->assign("workstations", $this->accessTo);
+ $smarty->assign("apply", apply_filter());
$display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
return($display);
}
@@ -625,6 +669,7 @@ class posixAccount extends plugin
/* Save data to LDAP, depending on is_account we save or delete */
function save()
{
+
/* include global link_info */
$ldap= $this->config->get_ldap_link();
@@ -703,14 +748,17 @@ class posixAccount extends plugin
$this->shadowExpire = "";
}
- /* Call parents save to prepare $this->attrs */
- plugin::save();
-
/* Fill gecos */
if (isset($this->parent) && $this->parent != NULL){
- $this->gecos= $this->parent->by_object['user']->cn;
+ $this->gecos= rewrite($this->parent->by_object['user']->cn);
+ if (!preg_match('/[a-z0-9 -]/i', $this->gecos)){
+ $this->gecos= "";
+ }
}
+ /* Call parents save to prepare $this->attrs */
+ plugin::save();
+
/* Trust accounts */
$objectclasses= array();
foreach ($this->attrs['objectClass'] as $key => $class){
@@ -736,6 +784,14 @@ class posixAccount extends plugin
}
}
+ if(empty($this->attrs['gosaDefaultPrinter'])){
+ $thid->attrs['gosaDefaultPrinter']=array();
+ }
+
+ foreach(array("shadowMin","shadowMax","shadowWarning","shadowInactive") as $attr){
+ $this->attrs[$attr] = (int) $this->attrs[$attr];
+ }
+
/* Save data to LDAP */
$ldap->cd($this->dn);
$ldap->modify($this->attrs);
@@ -751,7 +807,7 @@ class posixAccount extends plugin
$ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
/* Create group if it doesn't exist */
- if (!$ldap->count()){
+ if ($ldap->count() == 0){
$groupdn= preg_replace ('/^'.$this->config->current['DNMODE'].'=[^,]+,'.get_people_ou().'/i', 'cn='.$this->uid.','.get_groups_ou(), $this->dn);
$g= new group($this->config, $groupdn);
@@ -836,7 +892,6 @@ class posixAccount extends plugin
$message[]= _("Value specified as 'GID' is too small.");
}
}
-
}
/* Check shadow settings, well I like spaghetties... */
@@ -878,11 +933,13 @@ class posixAccount extends plugin
}
}
+ // if(empty($this->gosaDefaultPrinter)){
+ // $message[]= _("You need to specify a valid default printer.");
+ // }
+
return ($message);
}
-
- /* Add posix user to some groups */
function addGroup ($groups)
{
/* include global link_info */
@@ -982,7 +1039,14 @@ class posixAccount extends plugin
}
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+
+
+
+
+
?>