[icinga-checkins] icinga.org: icinga-web/master: * Fixed Auth.Dispatch import group assign ( fixes #2284)

git at icinga.org git at icinga.org
Wed Jan 25 09:47:07 CET 2012


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Jan 25 09:46:20 2012 +0100

* Fixed Auth.Dispatch import group assign (fixes #2284)

---

 .../AppKit/models/Auth/DispatchModel.class.php     |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/modules/AppKit/models/Auth/DispatchModel.class.php b/app/modules/AppKit/models/Auth/DispatchModel.class.php
index 22184d0..be6236a 100644
--- a/app/modules/AppKit/models/Auth/DispatchModel.class.php
+++ b/app/modules/AppKit/models/Auth/DispatchModel.class.php
@@ -284,18 +284,25 @@ class AppKit_Auth_DispatchModel extends AppKitBaseModel implements AgaviISinglet
                         if (is_array($groups)) {
                             foreach($groups as $group_name) {
                                 $group = Doctrine::getTable('NsmRole')->findOneBy('role_name', $group_name);
-                                $user->NsmRole[] = $group;
+                                if ($group instanceof NsmRole) {
+                                    $user->NsmRole[] = $group;
+                                } else {
+                                    $this->log('Auth.Dispatch/import: Could not assign group %s', $group_name, AgaviLogger::WARN);
+                                }
                             }
                         }
-
-
+                        
+                        if (!$user->NsmRole->Count) {
+                            $this->log('Auth.Dispatch/import: No groups available for user, ABORT!', AgaviLogger::FATAL);
+                            return null;
+                        }
+                        
                         $padmin->updatePrincipalValueData(
                             $user->principal,
                             array(),
                             array()
                         );
 
-
                         $user->save();
 
                         $this->log(





More information about the icinga-checkins mailing list