Code

Prepared group Generic & Template for new acls .... not tested & not complete
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Aug 2006 11:38:16 +0000 (11:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Aug 2006 11:38:16 +0000 (11:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4526 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupGeneric.inc
plugins/admin/groups/generic.tpl

index 3159f234b025d42bfdc872b452cea2b8e89807b3..8ca3e3ded245c6bc8f7439827066fd9e84f393cb 100644 (file)
@@ -168,9 +168,6 @@ class group extends plugin
        /* Call parent execute */
        plugin::execute();
 
-  $ui= get_userinfo();
-  $acla= get_permissions ($ui->dn, $ui->subtreeACL);
-  $this->acl= get_module_permission($acla, "group", $ui->dn);
   /* Do we represent a valid group? */
     if (!$this->is_account && $this->parent == NULL){
       $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
@@ -343,31 +340,32 @@ class group extends plugin
     }else{
       $smarty->assign("forceMode", "");
     }
-    $smarty->assign("force_gidACL", chkacl($this->acl, "gidNumber"));
-    $smarty->assign("sambaDomainNameACL", chkacl($this->acl, "sambaDomainName"));
     if ($this->fon_group){
       $smarty->assign("fon_group", "checked");
     } else {
       $smarty->assign("fon_group", "");
     }
-    $smarty->assign("fon_groupACL", chkacl($this->acl, "fon_group"));
 
     if ($this->nagios_group){
       $smarty->assign("nagios_group", "checked");
     } else {
       $smarty->assign("nagios_group", "");
     }
-    $smarty->assign("nagios_groupACL", chkacl($this->acl, "nagios_group"));
 
     /* Fields */
     foreach (array("cn", "description", "gidNumber") as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
-    /* Missing ACL's */
-    foreach (array("base", "smbgroup", "members") as $val){
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    
+    if($this->acl_is_writeable("base")){
+      $smarty->assign("baseSelect",true);
+    }else{
+      $smarty->assign("baseSelect",false);
     }
 
     /* Show main page */
@@ -520,28 +518,26 @@ class group extends plugin
       $this->force_gid= 0;
       $this->smbgroup= 0;
       foreach (array("force_gid", "department", "base", "smbgroup") as $val) {
-        if (chkacl ($this->acl, "$val") == "" && isset($_POST["$val"])){
+        if ($this->acl_is_writeable("$val")  && isset($_POST["$val"])){
           $this->$val= $_POST["$val"];
         }
       }
 
       /* Save sambaDomain attribute */
-      if (chkacl ($this->acl, "sambaDomainName") == "" && $this->samba3 &&
-          isset ($_POST['sambaDomainName'])){
-
+      if ($this->acl_is_writeable("sambaDomainName") && $this->samba3 && isset ($_POST['sambaDomainName'])){
         $this->sambaDomainName= $_POST['sambaDomainName'];
         $this->groupType= $_POST['groupType'];
       }
 
       /* Save fon attribute */
-      if (chkacl ($this->acl, "fon_group") == ""){
+      if ($this->acl_is_writeable("fon_group")){
         if (isset ($_POST['fon_group'])){
           $this->fon_group= TRUE;
         } else {
           $this->fon_group= FALSE;
         }
       }
-        if (chkacl ($this->acl, "nagios_group") == ""){
+        if ($this->acl_is_writeable("nagios_group")){
         if (isset ($_POST['nagios_group'])){
           $this->nagios_group= TRUE;
         } else {
@@ -715,15 +711,12 @@ class group extends plugin
       $new_dn= $this->dn;
     }
 
-    $ui= get_userinfo();
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $acl= get_module_permission($acl, "group", $ui->dn);
-    if (chkacl($this->acl, "create") != ""){
+    if (!$this->acl_is_createable()){
       $message[]= _("You have no permissions to create a group on this 'Base'.");
     }
 
     /* must: cn */
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == "" && $this->acl_is_writeable("cn")){
       $message[]= "The required field 'Name' is not set.";
     }
 
@@ -732,7 +725,6 @@ class group extends plugin
       $message[]= _("The field 'Name' contains invalid characters. Lowercase, numbers and dashes are allowed.");
     }
 
-
     if($this->allowGroupsWithSameNameInOtherSubtrees == true){
 
       /* Check for used 'cn' */
@@ -871,12 +863,13 @@ class group extends plugin
             "description"       => _("Description"),
             "base"              => _("Base"),
 
-            "fon_group"         => _("Phone pickup group"),
-            "nagios_group"      => _("Nagios group"),
+            "fonGroup"         => _("Phone pickup group"),
+            "nagiosGroup"      => _("Nagios group"),
 
             "gidNumber"         => _("GID"),
             "memberUid"         => _("Group member"),
             "sambaGroupType"    => _("Samba group type"),
+            "sambaDomainName"   => _("Samba domain name"),
             "sambaSID"          => _("Samba SID"))
         ));
   }
index addcdf47de13c7a96732413086d2bac734e3dbcc..e01a561670e4487177fdceae1c8360d13dbe768b 100644 (file)
@@ -1,33 +1,47 @@
 <table summary="" style="width:100%;">
  <tr>
   <td style="width:50%; vertical-align:top;">
-   <input type="hidden" name="groupedit" value="1">
    <table summary="" style="width:100%">
     <tr>
      <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
      <td>
+{render acl=$cnACL}
        <input id="cn" name="cn" size=25 maxlength=60 {$cnACL} value="{$cn}" title="{t}Posix name of the group{/t}">
+{/render}
      </td>
     </tr>
     <tr>
-     <td><LABEL for="description"> {t}Description{/t}</LABEL></td>
-     <td><input id="description" name="description" size=40 maxlength=80 {$descriptionACL} value="{$description}" title="{t}Descriptive text for this group{/t}">
+     <td>
+      <LABEL for="description">{t}Description{/t}</LABEL>
+     </td>
+     <td>
+{render acl=$descriptionACL}
+      <input id="description" name="description" size=40 maxlength=80 {$descriptionACL} 
+        value="{$description}" title="{t}Descriptive text for this group{/t}">
+{/render}
      </td>
     </tr>
     <tr>
-      <td colspan=2> <div style="height:15px;"></div> </td>
+     <td colspan=2> 
+      <div style="height:15px;"></div> 
+     </td>
     </tr>
     <tr>
-     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
      <td>
+      <LABEL for="base">{t}Base{/t}</LABEL>{$must}
+     </td>
+     <td>
+{render acl=$baseACL}
       <select id="base" size="1" name="base" {$baseACL} title="{t}Choose subtree to place group in{/t}">
        {html_options options=$bases selected=$base_select}
       </select>
-               {if $baseACL==""}
-                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-               {else}
-                       <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}">
-               {/if}
+{/render}
+
+{if $baseSelect}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{else}
+      <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}" alt='&nbsp;'>
+{/if}
      </td>
     </tr>
     <tr>
     </tr>
     <tr>
      <td colspan=2>
-      <input type=checkbox name="force_gid" value="1" title="{t}Normally IDs are autogenerated, select to specify manually{/t}" {$force_gid} {$force_gidACL} onclick="changeState('gidNumber')"><LABEL for="gidNumber">{t}Force GID{/t}</LABEL>
+{render acl=$gidNumberACL}
+      <input type=checkbox name="force_gid" value="1" title="{t}Normally IDs are autogenerated, select to specify manually{/t}" 
+       {$force_gid} {$gidNumberACL} onclick="changeState('gidNumber')">
+{/render}
+       <LABEL for="gidNumber">{t}Force GID{/t}</LABEL>
       &nbsp;
+{render acl=$gidNumberACL}
       <input name="gidNumber" size=5 maxlength=5 id="gidNumber" {$gidNumberACL} {$forceMode} value="{$gidNumber}" title="{t}Forced ID number{/t}">
+{/render}
      </td>
     </tr>
 
     {if $samba3 ne ""}
     <tr>
      <td colspan=2>
-      <input type=checkbox name="smbgroup" value="1" {$smbgroup} {$smbgroupACL} title="{t}Select to create a samba conform group{/t}">
-      <select size="1" name="groupType" {$sambaDomainNameACL}>
+{render acl=$sambaGroupTypeACL}
+      <input type=checkbox name="smbgroup" value="1" {$smbgroup}  title="{t}Select to create a samba conform group{/t}">
+{/render}
+{render acl=$sambaGroupTypeACL}
+      <select size="1" name="groupType" {$sambaGroupTypeACL}>
        {html_options options=$groupTypes selected=$groupType}
       </select>
+{/render}
       &nbsp;
       <LABEL for="">{t}in domain{/t}</LABEL>
       &nbsp;
+{render acl=$sambaDomainNameACL}
       <select id="sambaDomainName" size="1" name="sambaDomainName" {$sambaDomainNameACL}>
        {html_options values=$sambaDomains output=$sambaDomains selected=$sambaDomainName}
       </select>
+{/render}
      </td>
     </tr>
     {/if}
@@ -69,7 +95,9 @@
     </tr>
     <tr>
      <td colspan=2>
-      <input type=checkbox name="fon_group" value="1" {$fon_group} {$fon_groupACL}>{t}Members are in a phone pickup group{/t}
+{render acl=$fonGroupACL}
+      <input type=checkbox name="fon_group" value="1" {$fon_group} {$fonGroupACL}>{t}Members are in a phone pickup group{/t}
+{/render}
      </td>
     </tr>
        {/if}
     </tr>
     <tr>
      <td colspan=2>
-      <input type=checkbox name="nagios_group" value="1" {$nagios_group} {$nagios_groupACL}>{t}Members are in a nagios group{/t}
+{render acl=$nagiosGroupACL}
+      <input type=checkbox name="nagios_group" value="1" {$nagios_group} {$nagiosGroupACL}>{t}Members are in a nagios group{/t}
+{/render}
      </td>
     </tr>
        {/if}
      <td style="vertical-align:top; width:50%">
       <b><LABEL for="members">{t}Group members{/t}</LABEL></b>
       <br>
+{render acl=$memberUidACL}
       <select style="width:100%; height:380px;" id="members" name="members[]" size=15 multiple>
        {html_options options=$members}
                <option disabled>&nbsp;</option>
       </select>
+{/render}
       <br>
-      <input type=submit name="edit_membership" value="{t}Add{/t}" {$membersACL}>
+      <input type=submit name="edit_membership" value="{t}Add{/t}" {$memberUidACL}>
       &nbsp;
-      <input type=submit name="del_users" value="{t}Delete{/t}" {$membersACL}>
+      <input type=submit name="del_users" value="{t}Delete{/t}" {$memberUidACL}>
      </td>
     </tr> 
    </table>
  </tr>
 </table>
 
+<input type="hidden" name="groupedit" value="1">
+
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
   <!-- // First input field on page