2017 © Pedro PelĂĄez
 

library armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

image

armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

  • Tuesday, June 21, 2016
  • by armenio
  • Repository
  • 1 Watchers
  • 2 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

armenio-zf2-restrictaccess-module

The Restrict Access Module for Zend Framework 2, (*1)

How to install

  1. Install via composer. Don't know how? Look here, (*2)

  2. cd my/project/directory, (*3)

  3. Edit composer.json :, (*4)

    {
        "require": {
            "armenio/armenio-zf2-restrictaccess-module": "1.*"
        }
    }
    
  4. Edit config/application.config.php :, (*5)

    'modules' => array(
         'Application',
         'RestrictAccess', //<==============================
    )
    
  5. Edit module/config/module.config.php, (*6)

        'service_manager' => array(
            'factories' => array(
                'AuthenticationService' => function(\Zend\ServiceManager\ServiceManager $serviceManager) {
                    $service = new \RestrictAccess\Service\Authentication\DbTableService();
                    // $service = new \RestrictAccess\Service\Authentication\LdapService();
    
                    $service->setServiceManager($serviceManager);
    
                    return $service;
                }
            ),
        ),
    
  6. Usage inside Controllers, (*7)

    6.1 Use with Zend\Db, (*8)

    $username = $data['username'];
    $password = $data['password'];
    
    $authService = $this->getServiceLocator()->get('AuthenticationService');
    
    $authService->setNamespace('Default');
    $authService->setTableName('users');
    $authService->setIdentityColumn('username');
    $authService->setCredentialColumn('password');
    
    $authenticationResult = $authService->authenticate($username, $password);
    
    if( ! $authenticationResult->isValid() ){
        var_dump($authenticationResult->getMessages());
    }
    // else var_dump($authService->getIdentity());
    

    6.2 Use with Zend\Ldap, (*9)

    $username = $post['username'];
    $password = $post['password'];
    
    $ldapOptions = array(
        'server1' => array(
            'host' => 'dc1.w.net',
            'useStartTls' => 'false',
            'useSsl' => 'false',
            'baseDn' => 'CN=Users,DC=w,DC=net',
            'accountCanonicalForm' => 3,
            'accountDomainName' => 'w.net',
            'accountDomainNameShort' => 'W',
        ),
    );
    
    $authService = $this->getServiceLocator()->get('AuthenticationService');
    
    $authService->setNamespace('Default');
    $authService->setOptions($ldapOptions);
    
    $authenticationResult = $authService->authenticate($username, $password);
    
    if( ! $authenticationResult->isValid() ){
        var_dump($authenticationResult->getMessages());
    }
    // else var_dump($authService->getIdentity());
    
  7. Getting user identity, (*10)

    if( $authService->hasIdentity() ){
        var_dump($authService->getIdentity());
    }
    

The Versions

21/06 2016

dev-master

9999999-dev https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

21/06 2016

1.0.17

1.0.17.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

31/05 2016

1.0.16

1.0.16.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

30/05 2016

1.0.15

1.0.15.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) Module for Zend Framework 2

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

26/05 2016

1.0.14

1.0.14.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

23/05 2016

1.0.13

1.0.13.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

17/05 2016

1.0.12

1.0.12.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

16/05 2016

1.0.11

1.0.11.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

14/05 2016

1.0.10

1.0.10.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

13/05 2016

1.0.9

1.0.9.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

13/05 2016

1.0.8

1.0.8.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

12/05 2016

1.0.7

1.0.7.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

12/05 2016

1.0.6

1.0.6.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

12/05 2016

1.0.5

1.0.5.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

10/05 2016

1.0.4

1.0.4.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

07/05 2016

1.0.3

1.0.3.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

07/05 2016

1.0.2

1.0.2.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

07/05 2016

1.0.1

1.0.1.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

The Requires

 

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess

07/05 2016

1.0

1.0.0.0 https://github.com/armenio/armenio-zf2-restrictaccess-module

Restrict Access (Database|Ldap) library

  Sources   Download

MIT

by Rafael ArmĂȘnio

acl helper zf2 ldap armenio restrictaccess