]> git.andy128k.dev Git - ipf.git/commitdiff
preload permission model
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 14 Jan 2012 21:16:35 +0000 (23:16 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 14 Jan 2012 21:16:35 +0000 (23:16 +0200)
ipf/auth/app.php

index 001b1418567065a61f397b01228e10f5755c31ce..0209f201f5b4668ec033e8f0aa6a31d234832219 100644 (file)
@@ -1,11 +1,15 @@
 <?php
 
+// preload permission model
+require_once(dirname(__FILE__) . '/models/_generated/BasePermission.php');
+require_once(dirname(__FILE__) . '/models/Permission.php');
+
 class IPF_Auth_App extends IPF_Application
 {
     public function __construct()
     {
         parent::__construct(array(
-            'models'=>self::ArePermissionsEnabled(true) ? array('User', 'Role',) : array('User'),
+            'models' => self::ArePermissionsEnabled() ? array('User', 'Role') : array('User'),
         ));
     }
     
@@ -116,15 +120,8 @@ class IPF_Auth_App extends IPF_Application
         }
     }
     
-    static function ArePermissionsEnabled($use_hack=false)
+    static function ArePermissionsEnabled()
     {
-        if ($use_hack)
-        {
-            $path = str_replace('app.php','',__FILE__);
-            require_once($path.'models/_generated/BasePermission.php');
-            require_once($path.'models/Permission.php');
-        }
-        
         return IPF_ORM_Query::create()->from('Permission')->count() ? true : false;
     }