Prado\Security\TUserManager::init PHP Method

init() public method

This method is required by IModule and is invoked by application. It loads user/role information from the module configuration.
public init ( $config )
    public function init($config)
    {
        $this->loadUserData($config);
        if ($this->_userFile !== null) {
            if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
                $userFile = (include $this->_userFile);
                $this->loadUserDataFromPhp($userFile);
            } else {
                $dom = new TXmlDocument();
                $dom->loadFromFile($this->_userFile);
                $this->loadUserDataFromXml($dom);
            }
        }
        $this->_initialized = true;
    }

Usage Example

Exemplo n.º 1
0
 public function testSwitchToGuest()
 {
     $userManager = new TUserManager();
     $userManager->init(self::$config);
     $user = $userManager->getUser('joe');
     $userManager->switchToGuest($user);
     self::assertTrue($user->getIsGuest());
 }