[icinga-checkins] icinga.org: icinga-web/mhein/default: * Fixed cronk data model (fixes #2095 )

git at icinga.org git at icinga.org
Tue Nov 22 14:16:54 CET 2011


Module: icinga-web
Branch: mhein/default
Commit: 819ab0f149bdbbf5f62e7f34c7b9e43dd98c221a
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=819ab0f149bdbbf5f62e7f34c7b9e43dd98c221a

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Nov 22 14:14:53 2011 +0100

* Fixed cronk data model (fixes #2095)

---

 .../lib/database/models/generated/BaseNsmUser.php  |    4 ++--
 app/modules/Cronks/lib/js/CronkBuilder.js          |   18 +++++++++++-------
 .../models/Provider/CronksDataModel.class.php      |   12 ++++++++++--
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/app/modules/AppKit/lib/database/models/generated/BaseNsmUser.php b/app/modules/AppKit/lib/database/models/generated/BaseNsmUser.php
index b9ca3fd..915e638 100644
--- a/app/modules/AppKit/lib/database/models/generated/BaseNsmUser.php
+++ b/app/modules/AppKit/lib/database/models/generated/BaseNsmUser.php
@@ -164,11 +164,11 @@ abstract class BaseNsmUser extends Doctrine_Record {
     public function setUp() {
         parent::setUp();
 
-        $this->hasOne('NsmPrincipal as principals', array(
+        $this->hasOne('NsmPrincipal as principal', array(
                           'local' => 'user_id',
                           'foreign' => 'principal_user_id'
                       ));
-
+        
         $this->hasMany('NsmUserPreference as preferences', array(
                            'local' => 'user_id',
                            'foreign' => 'upref_user_id'));
diff --git a/app/modules/Cronks/lib/js/CronkBuilder.js b/app/modules/Cronks/lib/js/CronkBuilder.js
index 680e034..e7cfb2b 100644
--- a/app/modules/Cronks/lib/js/CronkBuilder.js
+++ b/app/modules/Cronks/lib/js/CronkBuilder.js
@@ -243,11 +243,15 @@ Ext.extend(Cronk.util.CronkBuilder, Ext.Window, {
 		this.groups = new Ext.data.JsonStore({
 			autoDestroy: true,
 			url: AppKit.c.path + '/modules/appkit/provider/groups',
-			baseParams: { addMeta : 1 },
-			writer: new Ext.data.JsonWriter({
-			    encode: true,
-			    writeAllFields: false
-			})
+			fields : [{
+				name : 'id'
+			}, {
+				name : 'name'
+			}],
+			idProperty : 'id',
+			root : 'roles',
+			totalProperty : 'totalCount',
+			successProperty : 'success'
 		});
 		
 		this.groups.load();
@@ -387,8 +391,8 @@ Ext.extend(Cronk.util.CronkBuilder, Ext.Window, {
 		        		height: 100,
 		        		fieldLabel: _('Principals'),
 		        		store: this.groups,
-		        		valueField: 'role_id',
-		        		displayField: 'role_name',
+		        		valueField: 'id',
+		        		displayField: 'name',
 		        		disabled: true,
 		        		msgTarget: 'side'
 		        	}]
diff --git a/app/modules/Cronks/models/Provider/CronksDataModel.class.php b/app/modules/Cronks/models/Provider/CronksDataModel.class.php
index 3b331eb..b77e63d 100644
--- a/app/modules/Cronks/models/Provider/CronksDataModel.class.php
+++ b/app/modules/Cronks/models/Provider/CronksDataModel.class.php
@@ -484,7 +484,7 @@ class Cronks_Provider_CronksDataModel extends CronksBaseModel implements AgaviIS
 
     private function cronkBuildRoleDepencies(Cronk $cronk, $roles) {
 
-        $parr = array($this->user->NsmPrincipal->principal_id);
+        $parr = array($this->user->principal->principal_id);
 
         $rarr = AppKitArrayUtil::trimSplit($roles, ',');
 
@@ -575,7 +575,15 @@ class Cronks_Provider_CronksDataModel extends CronksBaseModel implements AgaviIS
             $cronk->CronkPrincipalCronk->delete();
             $cronk->save();
             Doctrine_Manager::getInstance()->getCurrentConnection()->commit();
-
+            
+            // bad but helps doctrine to work
+            // with oracle ;-)
+            try {
+                $cronk->CronkPrincipalCronk->delete();
+            } catch (Exception $e) {
+                // BYPASS
+            }
+            
             $cronk->delete();
 
             return true;





More information about the icinga-checkins mailing list