[icinga-checkins] icinga.org: icinga-web/master: * Old behaviour for group provider per default for addon compatibility

git at icinga.org git at icinga.org
Wed Dec 21 17:28:52 CET 2011


Module: icinga-web
Branch: master
Commit: f33bb3558cc300c5ba3d41f1a1828ceae4cb0816
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=f33bb3558cc300c5ba3d41f1a1828ceae4cb0816

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Dec 21 17:26:38 2011 +0100

* Old behaviour for group provider per default for addon compatibility

---

 .../DataProvider/GroupProviderAction.class.php     |   24 +++++++++++++++-----
 app/modules/AppKit/lib/js/admin/RoleEditForm.js    |    4 +-
 app/modules/AppKit/lib/js/admin/RoleManager.js     |    3 +-
 .../AppKit/validate/DataProvider/GroupProvider.xml |    6 ++++-
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/app/modules/AppKit/actions/DataProvider/GroupProviderAction.class.php b/app/modules/AppKit/actions/DataProvider/GroupProviderAction.class.php
index 9658882..2537211 100644
--- a/app/modules/AppKit/actions/DataProvider/GroupProviderAction.class.php
+++ b/app/modules/AppKit/actions/DataProvider/GroupProviderAction.class.php
@@ -25,7 +25,19 @@ class AppKit_DataProvider_GroupProviderAction extends AppKitBaseAction {
         return null;
     }
     
-    private function getGroupAsArray(NsmRole $r) {
+    private function getGroupAsArray(NsmRole $r, $oldBehaviour=false) {
+        if ($oldBehaviour == true) {
+            return array(
+                'role_id' => $r->role_id,
+		'role_name' => $r->role_name,
+		'role_description' => $r->role_description,
+		'role_created' => $r->role_created,
+		'role_modified' => $r->role_modified,
+		'role_parent' => $r->role_parent,
+		'role_disabled' => $r->role_disabled
+            );
+        }
+
         return array(
             "id" => $r->role_id,
             "name" => $r->role_name,
@@ -37,8 +49,8 @@ class AppKit_DataProvider_GroupProviderAction extends AppKitBaseAction {
         );
     }
     
-    private function formatRole(NsmRole $r,$simple = false) {
-        $roleObject = $this->getGroupAsArray($r);
+    private function formatRole(NsmRole $r,$simple = false, $oldBehaviour = false) {
+        $roleObject = $this->getGroupAsArray($r, $oldBehaviour);
         if($simple)
             return $roleObject;
 
@@ -76,7 +88,7 @@ class AppKit_DataProvider_GroupProviderAction extends AppKitBaseAction {
         $limit = $rd->getParameter('limit',false);
         $sort = $rd->getParameter('sort',false);
         $asc = ($rd->getParameter('dir','ASC') == 'ASC');
-        
+	$oldBehaviour = (bool)$rd->getParameter('oldBehaviour', true) ? true : false;
         $user = $this->getContext()->getUser();
         $groups = null;
         
@@ -97,7 +109,7 @@ class AppKit_DataProvider_GroupProviderAction extends AppKitBaseAction {
 
                 
 
-                $result = $this->formatRole($group);
+                $result = $this->formatRole($group, false, $oldBehaviour);
 
                 $this->setAttribute("role",$result);
                 
@@ -117,7 +129,7 @@ class AppKit_DataProvider_GroupProviderAction extends AppKitBaseAction {
         if ($groups && $groups instanceof Doctrine_Collection) {
             $result = array();
             foreach($groups as $group) {
-                $result[] = $this->formatRole($group,true);
+                $result[] = $this->formatRole($group,true,$oldBehaviour);
             }
             $this->setAttribute("roles",$result);
         }
diff --git a/app/modules/AppKit/lib/js/admin/RoleEditForm.js b/app/modules/AppKit/lib/js/admin/RoleEditForm.js
index 13a02d9..0114ad4 100644
--- a/app/modules/AppKit/lib/js/admin/RoleEditForm.js
+++ b/app/modules/AppKit/lib/js/admin/RoleEditForm.js
@@ -145,7 +145,7 @@ AppKit.Admin.RoleEditForm = function(cfg) {
      */
     AppKit.Admin.RoleEditForm.bindRole = function(id,url) {
         if(id !== 'new') {
-            roleStore.proxy.setUrl(url+"/id="+id);
+            roleStore.proxy.setUrl(url+"/id="+id+'?oldBehaviour=0');
             roleStore.load();
         } else {
             roleStore.newRole();
@@ -315,4 +315,4 @@ AppKit.Admin.RoleEditForm = function(cfg) {
         }
     ];
 
-};
\ No newline at end of file
+};
diff --git a/app/modules/AppKit/lib/js/admin/RoleManager.js b/app/modules/AppKit/lib/js/admin/RoleManager.js
index fde8e16..b77e8dc 100644
--- a/app/modules/AppKit/lib/js/admin/RoleManager.js
+++ b/app/modules/AppKit/lib/js/admin/RoleManager.js
@@ -13,7 +13,8 @@ AppKit.Admin.RoleManager = Ext.extend(Ext.Container, {
             remoteSort: true,
 
             baseParams: {
-                hideDisabled: false
+                hideDisabled: false,
+		oldBehaviour : 0
             },
             proxy: new Ext.data.HttpProxy({
                 api: {
diff --git a/app/modules/AppKit/validate/DataProvider/GroupProvider.xml b/app/modules/AppKit/validate/DataProvider/GroupProvider.xml
index 5dea9f5..b1fc6cf 100644
--- a/app/modules/AppKit/validate/DataProvider/GroupProvider.xml
+++ b/app/modules/AppKit/validate/DataProvider/GroupProvider.xml
@@ -10,7 +10,7 @@
 			<validator class="number" name="groupId" required="false">
 				<argument>groupId</argument>
 				<errors>
-					<error>Validation of 'userId' failed</error>
+					<error>Validation of 'groupId' failed</error>
 				</errors>
 			</validator>
 			
@@ -18,6 +18,10 @@
 				<argument>hideDisabled</argument>
 			</validator>
 			
+			<validator class="string" name="oldBehaviour" required="false">
+				<argument>oldBehaviour</argument>
+			</validator>
+
 			<validator class="number" name="addMeta" required="false">
 				<argument>addMeta</argument>
 			</validator>





More information about the icinga-checkins mailing list