PHP code example of symbio / sf-doctrine-guard-plugin

1. Go to this page and download the library: Download symbio/sf-doctrine-guard-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

symbio / sf-doctrine-guard-plugin example snippets


      class ProjectConfiguration extends sfProjectConfiguration
      {
        public function setup()
        {
          $this->enablePlugins(array(
            'sfDoctrinePlugin',
            'sfDoctrineGuardPlugin',
            '...'
          ));
        }
      }
      

      class myUser extends sfGuardSecurityUser
      {
      }
      

          class sfGuardAuthActions extends BasesfGuardAuthActions
        {
          public function executeNewAction()
          {
            return $this->renderText('This is a new sfGuardAuth action.');
          }
        }
      

    $this->getUser()->getGuardUser()->getUsername()

    // or via the proxy method
    $this->getUser()->getUsername()
  

    function checkLDAPPassword($username, $password)
    {
      $user = LDAP::getUser($username);
      if ($user->checkPassword($password))
      {
        return true;
      }
      else
      {
        return false;
      }
    }