From: hickert Date: Mon, 4 Jul 2011 06:31:09 +0000 (+0000) Subject: Updated group handling. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=856c8a9b737e6f4b92f6cdae2d8b4667f55a6e02;p=gosa.git Updated group handling. -Avoid saving group members while the dyngroup extension is enabled. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20928 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/groups/class_group.inc b/gosa-core/plugins/admin/groups/class_group.inc index bf21e508e..7412166ec 100644 --- a/gosa-core/plugins/admin/groups/class_group.inc +++ b/gosa-core/plugins/admin/groups/class_group.inc @@ -203,7 +203,7 @@ class group extends plugin // Prepare lists $this->memberList = new sortableListing(); $this->memberList->setDeleteable(true); - $this->memberList->setInstantDelete(true); + $this->memberList->setInstantDelete(false); $this->memberList->setEditable(false); $this->memberList->setWidth("100%"); $this->memberList->setHeight("300px"); @@ -327,8 +327,8 @@ class group extends plugin foreach($this->members as $uid => $member){ $data[$uid] = $member; $givenName = $sn = _("Unknown"); - if(isset($member['sn'][0])) $sn = $member['sn'][0]; - if(isset($member['givenName'][0])) $givenName = $member['givenName'][0]; + if(isset($member['sn']) && isset($member['sn'][0])) $sn = $member['sn'][0]; + if(isset($member['givenName']) && isset($member['givenName'][0])) $givenName = $member['givenName'][0]; $image = image('images/false.png'); if(isset($member['sn'])){ $image = image('plugins/users/images/select_user.png'); @@ -336,6 +336,8 @@ class group extends plugin $lData[$uid] = array('data' => array($image,$sn, $givenName, $uid)); } $this->memberList->setListData($data,$lData); + $bool = $this->isRestrictedByDynGroup(); + $this->memberList->setDeleteable(!$bool); $this->memberList->update(); $smarty->assign("memberList", $this->memberList->render()); }else{ @@ -362,11 +364,11 @@ class group extends plugin $data = $lData = array(); foreach($this->memberUid_used_by_some as $uid => $member){ - $member = $this->members[$member]; + $member = (isset($this->members[$member])) ? $this->members[$member] : NULL; $data[$uid] = $member; $givenName = $sn = _("Unknown"); - if(isset($member['sn'][0])) $sn = $member['sn'][0]; - if(isset($member['givenName'][0])) $givenName = $member['givenName'][0]; + if(isset($member['sn']) && isset($member['sn'][0])) $sn = $member['sn'][0]; + if(isset($member['givenName'][0]) && isset($member['givenName'][0])) $givenName = $member['givenName'][0]; $image = image('images/false.png'); if(isset($member['sn'])){ $image = image('plugins/users/images/select_user.png'); @@ -437,9 +439,26 @@ class group extends plugin } } + $bool = $this->isRestrictedByDynGroup(); + $smarty->assign("restrictedByDynGroup", $bool); + if($bool){ + $smarty->assign("memberUidACL", preg_replace("/[^r]/","",$this->getacl('memberUid'))); + + } return($smarty->fetch (get_template_path('generic.tpl', TRUE))); } + + function isRestrictedByDynGroup() + { + $bool = FALSE; + if(isset($this->parent->by_object['DynamicLdapGroup'])){ + $bool = $this->parent->by_object['DynamicLdapGroup']->isAttributeDynamic('memberUid') || + $this->parent->by_object['DynamicLdapGroup']->isAttributeDynamic('member'); + } + return($bool); + } + function addUser($uid) { /* In mutliple edit we have to handle two arrays. @@ -794,7 +813,8 @@ class group extends plugin } /* Take members array */ - if (count ($this->memberUid)){ + + if (!$this->isRestrictedByDynGroup() && count ($this->memberUid)){ $this->attrs['memberUid']= array_values(array_unique($this->memberUid)); } @@ -808,7 +828,6 @@ class group extends plugin $this->attrs['member'] = array(); if (count($this->memberUid)){ foreach($this->attrs['memberUid'] as $uid) { - if(isset($this->dnMapping[$uid])){ $this->attrs['member'][]= $this->dnMapping[$uid]; } @@ -1183,7 +1202,7 @@ class group extends plugin // - ond one which represents those users which are only part of SOME groups. $this->commonList = new sortableListing(); $this->commonList->setDeleteable(true); - $this->commonList->setInstantDelete(true); + $this->commonList->setInstantDelete(false); $this->commonList->setEditable(false); $this->commonList->setWidth("100%"); $this->commonList->setHeight("120px"); @@ -1193,7 +1212,7 @@ class group extends plugin $this->partialList = new sortableListing(); $this->partialList->setDeleteable(true); - $this->partialList->setInstantDelete(true); + $this->partialList->setInstantDelete(false); $this->partialList->setEditable(false); $this->partialList->setWidth("100%"); $this->partialList->setHeight("120px"); diff --git a/gosa-core/plugins/admin/groups/generic.tpl b/gosa-core/plugins/admin/groups/generic.tpl index 5a591fd79..c2015f6f0 100644 --- a/gosa-core/plugins/admin/groups/generic.tpl +++ b/gosa-core/plugins/admin/groups/generic.tpl @@ -170,29 +170,44 @@
- {if $multiple_support} -

{t}Common group members{/t}

- {render acl=$memberUidACL} - {$commonList} - {/render} - {render acl=$memberUidACL} - - {/render} - -
-

{t}Partial group members{/t}

- {render acl=$memberUidACL} - {$partialList} - {/render} - {else} -

{t}Group members{/t}

- {render acl=$memberUidACL} - {$memberList} - {/render} - {render acl=$memberUidACL} - - {/render} - {/if} + + {if $restrictedByDynGroup} + {t}The group members are part of a dyn-group and cannot be managed!{/t} + {if $multiple_support} + {render acl=$memberUidACL} + {$commonList} + {/render} + {else} + {render acl=$memberUidACL} + {$memberList} + {/render} + {/if} + {else} + + {if $multiple_support} +

{t}Common group members{/t}

+ {render acl=$memberUidACL} + {$commonList} + {/render} + {render acl=$memberUidACL} + + {/render} + +
+

{t}Partial group members{/t}

+ {render acl=$memberUidACL} + {$partialList} + {/render} + {else} +

{t}Group members{/t}

+ {render acl=$memberUidACL} + {$memberList} + {/render} + {render acl=$memberUidACL} + + {/render} + {/if} + {/if}