Code

Updated roles
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 2 Jul 2009 06:24:17 +0000 (06:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 2 Jul 2009 06:24:17 +0000 (06:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13871 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc
gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc
gosa-plugins/roleManagement/admin/roleManagement/main.inc
gosa-plugins/roleManagement/admin/roleManagement/remove.tpl [new file with mode: 0644]
gosa-plugins/roleManagement/html/images/new.png
gosa-plugins/roleManagement/html/images/plugin.png
gosa-plugins/roleManagement/html/images/role.png

index 18058ceaac08a4883132849de316904033bd0fd4..8aafe8ecfc00fa8f5a2bb452b03932e9ad5f0367 100644 (file)
@@ -104,7 +104,7 @@ class divListRole extends MultiSelectWindow
     $add_sep = false;
   
     /* Get copy & paste icon */
-    $acls  = $ui->get_permissions($this->selectedBase,"roles/role");
+    $acls  = $ui->get_permissions($this->selectedBase,"roles/roleGeneric");
     $acl_all= $ui->has_complete_category_acls($this->selectedBase,"roles");
 
     /* Add default header */
@@ -163,7 +163,7 @@ class divListRole extends MultiSelectWindow
     foreach($list as $key => $val){
       
       // Get object permissions
-      $acl    = $ui->get_permissions($val['dn'],"roles/role");
+      $acl    = $ui->get_permissions($val['dn'],"roles/roleGeneric");
       $acl_all= $ui->has_complete_category_acls($val['dn'],"roles");
 
       // Create edit and remove icon buttons 
index dc914b0b5548cc64cfd8b3160ed4cdf530b852bc..37842a7ef4659a034b09cbf67f9332c6a4233f8e 100644 (file)
@@ -23,6 +23,7 @@
 
 class roleGeneric extends plugin {
 
+  // The variables this plugin takes care of.
   var $cn = "";
   var $description ="";
   var $telephoneNumber = "";
@@ -30,43 +31,59 @@ class roleGeneric extends plugin {
   var $x121Address = "";
   var $roleOccupant = array();
 
+  // The objects base 
   var $base = "";
+  // Keep track if possible ng aming modifications
   var $orig_dn = "";
   var $orig_cn = "";
   var $orig_base = "";
 
+  // The object classes written by this plugin
   var $objectclasses = array("top","organizationalRole");
+
+  // A list of attributes managed by this plugin
   var $attributes = array("cn","x121Address","description",
     "telephoneNumber","facsimileTelephoneNumber","roleOccupant");
-  
+
+  /* Initialize the class 
+   */
   function __construct($config,$dn){
     plugin::plugin($config,$dn);
     $this->is_account = TRUE;
-    $this->orig_dn = $dn;
-    $this->orig_cn = $this->cn;
 
-    /* Set base */
+    // Detect the objects base
     if ($this->dn == "new"){
       $this->base = session::get('CurrentMainBase');
     } else {
-      $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("roleRDN"), '/')."/","",$this->dn);
+      $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("roleRDN"), '/i')."/","",$this->dn);
     }
+
+    // Keep track of naming attribute modifications
     $this->orig_base = $this->base;
+    $this->orig_dn = $dn;
+    $this->orig_cn = $this->cn;
   }
 
 
+  /* Generate HTML output of this plugin.
+   */
   function execute()
   {
-    $smarty = get_smarty();
-
-    /* Create base acls */
+    // Get list of possible ldap bases, will be selectable in the ui.
     $tmp = $this->allowedBasesToMoveTo();
+
+    // Get smarty instance and assign required variables.
+    $smarty = get_smarty();
     $smarty->assign("bases", $tmp);
     $smarty->assign("base_select",$this->base);
     $smarty->assign("members",$this->convert_list());
     foreach($this->attributes as $attr){
       $smarty->assign($attr,$this->$attr);
     }
+
+    // Assign current permissions for each attribute. 
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $attr => $desc){
       $smarty->assign($attr."ACL",$this->getacl($attr));
@@ -75,17 +92,18 @@ class roleGeneric extends plugin {
   }
 
 
+  /* Check user input and return a list of 'invalid input' messages.
+   */
   function check()
   {
     $message = plugin::check();
 
-    /* Set the new acl base */
+    // Set the new acl base 
     if($this->dn == "new") {
       $this->set_acl_base($this->base);
     }
 
-    /* Check if we are allowed to create/move this user
-     */
+    // Check if we are allowed to create/move this user
     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
       $message[]= msgPool::permCreate();
     }elseif($this->orig_dn != "new" && 
@@ -94,7 +112,7 @@ class roleGeneric extends plugin {
       $message[]= msgPool::permMove();
     }
 
-    /* Name already used? */
+    // Check if this name is uniq for roles.
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $ldap->search("(&(objectClass=organizationalRole)(cn=$this->cn))", array("cn"));
@@ -102,12 +120,12 @@ class roleGeneric extends plugin {
     if ($ldap->count() != 0 && ( $this->dn == 'new' || $this->cn != $this->orig_cn)){
       $message[]= msgPool::duplicated(_("Name"));
     }
-
-
     return($message);
   }
   
 
+  /* Returns list of occupants as <html><option> statements.
+   */
   function convert_list()
   {
     $temp= "";
@@ -121,24 +139,30 @@ class roleGeneric extends plugin {
     return ($temp);
   }
 
-  
+  /* Removes the object from the ldap database
+   */ 
   function remove_from_parent()
   {
     plugin::remove_from_parent();
 
+    // Remove this object.
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir($this->dn);
     if (!$ldap->success()){
       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
     }
 
+    // Log action.
     new log("remove","roles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
 
-    /* Trigger remove signal */
+    // Trigger remove signal
     $this->handle_post_events("remove");
   }
 
 
+  /* Saves object modifications
+   */  
   function save(){
     plugin::save();
 
@@ -155,7 +179,7 @@ class roleGeneric extends plugin {
     }
     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save via $mode");
 
-    /* Finally write data with selected 'mode' */
+    // Finally write data with selected 'mode'
     $this->cleanup();
     $ldap->cd ($this->dn);
     $ldap->$mode ($this->attrs);
@@ -165,9 +189,10 @@ class roleGeneric extends plugin {
       return (1);
     }
 
+    // Send modify/add events
     $this->handle_post_events($mode);
 
-    /* Remove ACL dependencies too */
+    // Update ACL dependencies too 
     if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
       $tmp = new acl($this->config,$this->parent,$this->dn);
       $tmp->update_acl_membership($this->orig_dn,$this->dn);
index 72c5ae1fc454d6e849807accb268d74e75590c6e..34ff6f42d1824bf4bbf48fca71fd580b8f696321 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 
-/* Remove locks created by this plugin
-*/
+// Remove locks created by this plugin
 if ($remove_lock){
   if(session::is_set('roleManagement')){
     $macl = session::get('roleManagement');
@@ -33,13 +32,14 @@ if ($remove_lock){
 /* Remove this plugin from session
 */
 if ( $cleanup ){
+  $macl = session::get('roleManagement');
+  $macl->remove_lock();
   session::un_set('roleManagement');
 }else{
 
   /* Create object object on demand */
   if (!session::is_set('roleManagement')){
-    session::set('roleManagement',new roleManagement ($config));
-    
+    session::set('roleManagement',new roleManagement($config));
   }
   $roleManagement = session::get('roleManagement');
 
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/remove.tpl b/gosa-plugins/roleManagement/admin/roleManagement/remove.tpl
new file mode 100644 (file)
index 0000000..76cf288
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/warning.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+
+<p>
+  {$info}
+  {t}Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       <input type=submit name="delete_multiple_roles_confirm" value="{msgPool type=delButton}">
+               &nbsp;
+       <input type=submit name="delete_multiple_roles_cancel" value="{msgPool type=cancelButton}">
+</p>
+
index 318715a4d05d33b8ca0a378ec1e32e0c47ff9d7d..bb4ae51a31acd381cef2baca2f34e80b91acc9c9 100644 (file)
Binary files a/gosa-plugins/roleManagement/html/images/new.png and b/gosa-plugins/roleManagement/html/images/new.png differ
index eb720b7e5ad39e2f238dd0047ec0cd540394c830..66df34c71a39a1a36dbf00e52b8f20296ce48f0b 100644 (file)
Binary files a/gosa-plugins/roleManagement/html/images/plugin.png and b/gosa-plugins/roleManagement/html/images/plugin.png differ
index 3b82c19b683ca99f704e143a92d0f238eea5f4da..bb4ae51a31acd381cef2baca2f34e80b91acc9c9 100644 (file)
Binary files a/gosa-plugins/roleManagement/html/images/role.png and b/gosa-plugins/roleManagement/html/images/role.png differ