Code

Updated sudo checks
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_sudoGeneric.inc
index f29b615551a5424e9993caaf65f330f0d9a9c702..1f5f1413e8022fd45003023d97708766cd716ff3 100644 (file)
@@ -46,6 +46,8 @@ class sudo extends plugin
 
   public $ignore_account = TRUE;
 
+  public $orig_dn;
+
   /*! \brief  Returns to the base department for sudo roles.
               This department is then used to store new roles.
       @param  Object  GOsa configuration object.
@@ -126,6 +128,8 @@ class sudo extends plugin
           "regex"           => "*");
       session::set("sysfilter", $sysfilter);
     }
+
+    $this->orig_dn = $this->dn;
   }
 
 
@@ -372,8 +376,8 @@ class sudo extends plugin
 
     /* Fill divlists
      */
-    $neg_img= "<img src='images/negate.png' alt='!' class='center'>"; 
-    $option = "<input type='image' src='images/negate.png'     name='neg_%ATTR%_%KEY%' class='center'>"; 
+    $neg_img= "<img src='plugins/sudo/images/negate.png' alt='!' class='center'>"; 
+    $option = "<input type='image' src='plugins/sudo/images/negate.png'     name='neg_%ATTR%_%KEY%' class='center'>"; 
     $option.= "<input type='image' src='images/lists/trash.png'  name='del_%ATTR%_%KEY%' class='center'>"; 
     foreach(array("sudoCommand","sudoHost","sudoRunAs") as $attr){
       if($this->acl_is_readable($attr)){
@@ -395,7 +399,7 @@ class sudo extends plugin
     }
 
     foreach(array("sudoUser") as $attr){
-      $img1 = "<img src='images/select_user.png'   alt='"._("User")."' class='center'>";
+      $img1 = "<img src='plugins/users/images/select_user.png'   alt='"._("User")."' class='center'>";
       $img2 = "<img src='plugins/groups/images/groups.png' alt='"._("Group")."' class='center'>";
       if($this->acl_is_readable($attr)){
         foreach($this->$attr as $key => $entry){
@@ -557,7 +561,7 @@ class sudo extends plugin
     $message = plugin::check();
 
     /* Is a name given? */
-    if(empty($this->cn)){
+    if($this->cn == ""){
       $message[] = msgPool::required(_("Name"));
     }
 
@@ -581,6 +585,12 @@ class sudo extends plugin
       }
     }
 
+    /* Check if we are allowed to create or move this object
+     */
+    if($this->orig_dn == "new" && !$this->acl_is_createable($this->get_sudoers_ou($this->config))){
+      $message[] = msgPool::permCreate();
+    }
+
     return ($message);
   }