title: BjyAuthorize configuration for resources
body: <p>I configured my BjyAuthorised using SamUser and other resources online. I thought the following configuration suppose to block all users but 'admin'. However, role of a user does not affect the result. Any user can access this resource. Please help.</p>
  
  <p><strong>My BjyAuthorise config file:</strong></p>
  
  <pre><code>    &lt;?php
      return array(
          'bjyauthorize' =&gt; array(
              'default_role' =&gt; 'guest',
              'resource_providers' =&gt; array(
                  'BjyAuthorize\Provider\Resource\Config' =&gt; array(
                      'OnlineFieldEvaluation\Controller\OnlineFieldEvaluation' =&gt; array(),
                  ),
              ),
              'rule_providers' =&gt; array(
                  'BjyAuthorize\Provider\Rule\Config' =&gt; array(
                      'allow' =&gt; array(
                          array(array('admin'), 'OnlineFieldEvaluation\Controller\OnlineFieldEvaluation', array('index')),
                      ),
                  ),
              ),
              'identity_provider' =&gt; 'BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider',
              'BjyAuthorize\Provider\Role\ObjectRepositoryProvider' =&gt; array(
                  'object_manager'    =&gt; 'doctrine.entity_manager.orm_default',
                  'role_entity_class' =&gt; 'Application\Entity\Role',
              ),
          ),
   //           'guards' =&gt; array(
   //               'BjyAuthorize\Guard\Controller' =&gt; array(
   //                   array('controller' =&gt; 'OnlineFieldEvaluation\Controller\OnlineFieldEvaluation',
   //                       'action' =&gt; array('index'),
   //                       'roles' =&gt; array('admin')),
   //               ),
   //           ),
      );
  </code></pre>
  
  <p><strong>Module config file</strong></p>
  
  <pre><code>&lt;?php
  namespace OnlineFieldEvaluation;
  return array(
      'controllers' =&gt; array(
          'invokables' =&gt; array(
              'OnlineFieldEvaluation\Controller\OnlineFieldEvaluation' =&gt; 'OnlineFieldEvaluation\Controller\OnlineFieldEvaluationController',
          ),
      ),
  
      // The following section is new and should be added to your file
      'router' =&gt; array(
              'routes' =&gt; array(
                      'OnlineFieldEvaluation' =&gt; array(
                              'type'    =&gt; 'segment',
                              'options' =&gt; array(
                                      'route'    =&gt; '/onlinefieldevaluation[/][:action][/:id]',
                                      'constraints' =&gt; array(
                                              'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*',
                                              'id'     =&gt; '[0-9]+',
                                      ),
                                      'defaults' =&gt; array(
                                              'controller' =&gt; 'OnlineFieldEvaluation\Controller\OnlineFieldEvaluation',
                                              'action'     =&gt; 'index',
                                      ),
                              ),
                      ),
              ),
      ),      
      'view_manager' =&gt; array(
          'template_path_stack' =&gt; array(
              'OnlineFieldEvaluation' =&gt; __DIR__ . '/../view',
          ),
      ),
  
      // Doctrine config
      'doctrine' =&gt; array(
          'driver' =&gt; array(
              __NAMESPACE__ . '_driver' =&gt; array(
                  'class' =&gt; 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                  'cache' =&gt; 'array',
                  'paths' =&gt; array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
              ),
              'orm_default' =&gt; array(
                  'drivers' =&gt; array(
                      __NAMESPACE__ . '\Entity' =&gt; __NAMESPACE__ . '_driver'
                  )
              ),
          ),
      ),
  );
  </code></pre>
  
  <p><strong>Systemuser class</strong></p>
  
  <pre><code>&lt;?php
  namespace Application\Entity;
  
  use BjyAuthorize\Provider\Role\ProviderInterface;
  use Doctrine\Common\Collections\ArrayCollection;
  use Doctrine\ORM\Mapping as ORM;
  use ZfcUser\Entity\UserInterface;
  
  /**
   * Systemuser
   *
   * @ORM\Table(name="systemuser",uniqueConstraints={@ORM\UniqueConstraint(name="email_idx", columns={"email"})})
   * @ORM\Entity
   * ORM\Entity(repositoryClass="Application\Entity\Repository\SystemuserRepository")
   */
  class Systemuser implements UserInterface, ProviderInterface {
  
      /**
       * @var int
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="email", type="string", length=100, nullable=false)
       */
      private $email;
  
      /**
       * @var string
       * @ORM\Column(name="displayname", type="string", length=50, nullable=true)
       */
      protected $displayName;
  
      /**
       * @var string
       *
       * @ORM\Column(name="username", type="string", length=100, nullable=true)
       */
      private $username;
  
      /**
       * @var string
       *
       * @ORM\Column(name="password", type="string", length=64, nullable=false)
       */
      private $password;
  
      /**
       * @var string $country
       *
       * @ORM\Column(type="string", length=255, nullable=true)
       */
      private $country;
  
      /**
       * var \Application\Entity\Role
       *
       * ORM\ManyToOne(targetEntity="Application\Entity\Role")
       * ORM\JoinColumns({
       * ORM\JoinColumn(name="role_id", referencedColumnName="id",nullable=true)
       * })
       */
  //private $role;
  
  
      /**
       * @var \Doctrine\Common\Collections\Collection
       * @ORM\ManyToMany(targetEntity="Application\Entity\Role")
       * @ORM\JoinTable(name="users_roles",
       *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
       *      inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")}
       * )
       */
      protected $roles;
  
      /**
       * Initialies the roles variable.
       */
      public function __construct()
      {
          $this-&gt;roles = new ArrayCollection();
      }
  
  
      /**
       * Get role.
       *
       * @return array
       */
      public function getRoles()
      {
          return $this-&gt;roles-&gt;getValues();
      }
  
      /**
       * Add a role to the user.
       *
       * @param Role $role
       *
       * @return void
       */
      public function addRole($role)
      {
          $this-&gt;roles[] = $role;
      }
  
      /**
       * Get id
       *
       * @return integer
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set id.
       *
       * @param int $id
       * @return UserInterface
       */
      public function setId($id) {
          $this-&gt;id = $id;
      }
  
  
      /**
       * Set email
       *
       * @param string $email
       * @return Systemuser
       */
      public function setEmail($email)
      {
          $this-&gt;email = $email;
  
          return $this;
      }
  
      /**
       * Get email
       *
       * @return string
       */
      public function getEmail()
      {
          return $this-&gt;email;
      }
  
      /**
       * Set username
       *
       * @param string $username
       * @return Systemuser
       */
      public function setUsername($username)
      {
          $this-&gt;username = $username;
  
          return $this;
      }
  
      /**
       * Get username
       *
       * @return string
       */
      public function getUsername()
      {
          return $this-&gt;username;
      }
  
      /**
       * Set password
       *
       * @param string $password
       * @return Systemuser
       */
      public function setPassword($password)
      {
          $this-&gt;password = $password;
  
          return $this;
      }
  
      /**
       * Get password
       *
       * @return string
       */
      public function getPassword()
      {
          return $this-&gt;password;
      }
  
      /**
       * Set displayname
       *
       * @param string $displayName
       * @return Systemuser
       */
      public function setDisplayname($displayname)
      {
          $this-&gt;displayName= $displayname;
  
          return $this;
      }
  
      /**
       * Get displayname
       *
       * @return string
       */
      public function getDisplayname()
      {
          return $this-&gt;displayName;
      }
  
      /**
       * Set country
       *
       * @param string $country
       * @return Conference
       */
      public function setCountry($country)
      {
          $this-&gt;country = $country;
  
          return $this;
      }
  
      /**
       * Get country
       *
       * @return string
       */
      public function getCountry()
      {
          return $this-&gt;country;
      }
  
      /**
       * Get state.
       *
       * @return int
       */
      public function getState() {
          return null;
      }
  
      /**
       * Set state.
       *
       * @param int $state
       * @return UserInterface
       */
      public function setState($state) {
          //does nothing
      }
  
      /**
       * Set role
       *
       * @param \Application\Entity\Role $role
       * @return Systemuser
  //     */
  //    public function setRole(\Application\Entity\Role $role = null)
  //    {
  //        $this-&gt;role = $role;
  //
  //        return $this;
  //    }
  
      /**
       * Get role
       *
       * @return \Application\Entity\Role
       */
  //    public function getRole()
  //    {
  //        return $this-&gt;role;
  //    }
  
  
  
  }
  </code></pre>
  
  <p><strong>Role class</strong></p>
  
  <pre><code>&lt;?php
  namespace Application\Entity;
  
  use BjyAuthorize\Acl\HierarchicalRoleInterface;
  use Doctrine\ORM\Mapping as ORM;
  //use Zend\Permissions\Acl\Role\RoleInterface;
  
  /**
   * Role
   *
   * @ORM\Table(name="role")
   * @ORM\Entity
   * ORM\Entity(repositoryClass="Application\Entity\Repository\RoleRepository")
   */
  class Role implements HierarchicalRoleInterface
  {
  
      /**
       * @var string
       *
       * @ORM\Column(name="id", type="string", length=20, nullable=false)
       * @ORM\Id
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="name", type="string", length=100, nullable=false)
       */
      private $name;
  
      /**
       * @var Role
       * @ORM\ManyToOne(targetEntity="Application\Entity\Role")
       */
      protected $parent;
  
  
  
      public function getRoleId() {
          return $this-&gt;getId();
      }
  
      /**
       * Get id
       *
       * @return integer
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       *
       * @param string $id
       */
      public function setId( $id ){
          $this-&gt;id = $id;
      }
  
      /**
       * Set name
       *
       * @param string $name
       * @return Role
       */
      public function setName($name)
      {
          $this-&gt;name = $name;
  
          return $this;
      }
  
      /**
       * Get name
       *
       * @return string
       */
      public function getName()
      {
          return $this-&gt;name;
      }
  
      /**
       * Get the parent role
       *
       * @return Role
       */
      public function getParent()
      {
          return $this-&gt;parent;
      }
  
      /**
       * Set the parent role.
       *
       * @param Role $parent
       *
       * @return void
       */
      public function setParent(Role $parent)
      {
          $this-&gt;parent = $parent;
      }
  
  }
  </code></pre>