Code

Updated user filter to include snapshot fuctionalites
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Oct 2009 12:02:23 +0000 (12:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Oct 2009 12:02:23 +0000 (12:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14637 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/admin/users/user-filter.xml
gosa-core/plugins/admin/users/user-list.xml

index 318919df7d78388621caf54594eddbe8fd487d9f..b2079be03973534b201a5bcc98bed86bfe67e096 100644 (file)
@@ -35,14 +35,20 @@ class userManagement extends management
 
   function __construct($config,$ui)
   {
+    $this->config = $config;
+    $this->ui = $ui;
+    
     // Build filter
     $filter = new filter(get_template_path("user-filter.xml", true));
     $filter->setObjectStorage("ou=people,");
 
     // Build headpage
     $headpage = new listing(get_template_path("user-list.xml", true));
+    $headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel");
+    $headpage->registerElementFilter("lockImage", "userManagement::filterLockImage");
     $headpage->setFilter($filter);
     $this->cpHandler = new CopyPasteHandler($this->config);
+    $this->snapHandler = new SnapshotHandler($this->config);
 
     parent::__construct($config, $ui, "users", $headpage);
 
@@ -66,6 +72,38 @@ class userManagement extends management
     $this->newEntry();
     $this->tabObject->set_template_mode ();
   }
+static function filterLockImage($userPassword)
+  {
+    $image= "images/empty.png";
+
+    if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
+      if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
+        $image= "images/lists/locked.png";
+      }else{
+        $image= "images/lists/unlocked.png";
+      }
+    }
+
+    return $image;
+  }
+
+
+  static function filterLockLabel($userPassword)
+  {
+    $label= "";
+
+    if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
+      if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
+        $label= _("Unlock account");
+      }else{
+        $label= _("Lock account");
+      }
+    }
+
+    return $label;
+  }
+
+
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 1042de9b688063a09fc5da7871a46e8d7ca8816c..71042d2fc39ee56d54e5c5bf893516ecf46db219 100644 (file)
@@ -18,6 +18,7 @@
       <attribute>customerNumber</attribute>
       <attribute>customerState</attribute>
       <attribute>dateOfBirth</attribute>
+      <attribute>userPassword</attribute>
     </query>
     <scope>one</scope>
   </search>
index c7d5423a640aa8cc4e858d1455ba3bb717f39b30..e906af6c68bc370bbfb8e85ac3e6abe186ad570c 100644 (file)
@@ -30,7 +30,7 @@
   </definition>
 
   <table>
-    <layout>|20px||260px|100px|120px|60px;c|140px;r|</layout>
+    <layout>|20px||260px|180px;r|</layout>
 
     <department>
       <value>%{filter:objectType(dn,objectClass)}</value>
@@ -38,7 +38,7 @@
 
     <department>
       <value>%{filter:departmentLink(row,dn,description)}</value>
-      <span>5</span>
+      <span>3</span>
     </department>
 
     <column>
       <type>separator</type>
     </action>
 
-    <action>
-      <name>cp</name>
-      <type>copypaste</type>
-    </action>
-
     <action>
       <type>separator</type>
     </action>
 
   <actiontriggers snapshot="true" copypaste="true">
 
+    <action>
+      <name>cp</name>
+      <objectclass>!gosaUserTemplate</objectclass>
+      <type>copypaste</type>
+    </action>
+
     <action>
       <name>edit</name>
       <type>entry</type>
       <objectclass>gosaAccount</objectclass>
       <image>images/lists/edit.png</image>
-      <label>Edit person</label>
+      <label>Edit user</label>
+    </action>
+
+    <action>
+      <name>lock</name>
+      <type>entry</type>
+      <objectclass>!gosaUserTemplate</objectclass>
+      <image>%{filter:lockImage(userPassword)}</image>
+      <acl>uniBonnAccount/password[w]</acl>
+      <label>%{filter:lockLabel(userPassword)}</label>
+    </action>
+
+    <action>
+      <name>password</name>
+      <type>entry</type>
+      <objectclass>!gosaUserTemplate</objectclass>
+      <image>plugins/users/images/list_password.png</image>
+      <label>Change password</label>
+    </action>
+
+    <action>
+      <name>snapshot</name>
+      <type>snapshot</type>
+      <objectclass>!gosaUserTemplate</objectclass>
     </action>
 
     <action>
       <image>images/lists/trash.png</image>
       <objectclass>gosaAccount</objectclass>
       <acl>users/user[d]</acl>
-      <label>Remove person</label>
-    </action>
-
-    <action>
-      <name>cp</name>
-      <type>copypaste</type>
-      <acl>users/user[w]</acl>
+      <label>Remove user</label>
     </action>
 
   </actiontriggers>