]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php
More renamed
[shipsimu.git] / application / ship-simu / main / login / helper / class_ShipSimuLoginHelper.php
index 169f18fbdd5242973893e947282bd412eef26170..b5c125e0eba87acc4fcd848f97816029df6d555f 100644 (file)
  * The user shall be able to choose "Default login method" or similar to use his
  * own login method.
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,13 +35,8 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
         */
        private $authMethod = "";
 
-       /**
-        * Instance for a request class
-        */
-       private $requestInstance = null;
-
        // Exception constants
-       const EXCEPTION_INVALID_USER_INSTANCE = 0x080;
+       const EXCEPTION_INVALID_USER_INSTANCE = 0x190;
 
        /**
         * Protected constructor
@@ -51,12 +46,6 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("Login helper for Ship-Simu");
-
-               // Create unique ID number
-               $this->generateUniqueId();
        }
 
        /**
@@ -67,7 +56,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
         * @throws      UserInstanceMissingException    If the user instance in registry
         *                                                                                      is missing or invalid
         */
-       public final static function createShipSimuLoginHelper (Requestable $requestInstance) {
+       public static final function createShipSimuLoginHelper (Requestable $requestInstance) {
                // Get a new instance first
                $helperInstance = new ShipSimuLoginHelper();
 
@@ -75,7 +64,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
                $userInstance = Registry::getRegistry()->getInstance('user');
 
                // Is this instance valid?
-               if (!$userInstance instanceof ManageableUser) {
+               if (!$userInstance instanceof ManageableAccount) {
                        // Thrown an exception here
                        throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE);
                } // END - if
@@ -96,27 +85,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
         * @return      void
         */
        protected function setDefaultAuthMethod () {
-               $this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class');
-       }
-
-       /**
-        * Setter for request instance
-        *
-        * @param       $requestInstance        A Requestable class instance
-        * @return      void
-        */
-       public final function setRequestInstance (Requestable $requestInstance) {
-               $this->requestInstance = $requestInstance;
-       }
-
-       /**
-        * Getter for request instance
-        *
-        * @param       
-        * @return      $requestInstance        A Requestable class instance
-        */
-       public final function getRequestInstance () {
-               return $this->requestInstance;
+               $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class');
        }
 
        /**
@@ -131,10 +100,10 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
                $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
 
                // Set user cookie
-               $loginInstance->setUserAuth($this->requestInstance->getRequestElement('username'));
+               $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username'));
 
                // Set password cookie
-               $loginInstance->setPasswordAuth($this->requestInstance->getRequestElement('pass_hash'));
+               $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash'));
 
                // Remember this login instance for later usage
                Registry::getRegistry()->addInstance('login', $loginInstance);