Zend_Auth and Zend_Acl have been integrated into the DotKernel, starting with version 1.5.0

With the integration of these two major components for user authorization and access we completely refactored the User and Admin models by using Dot_Auth and Dot_Acl classes.

The Dot_Auth class authenticates the user by checking the database – Zend_Auth_Adapter_DbTable.

private function _getAuthAdapter($who)
	{
		$dbAdapter = Zend_Registry::get('database');
		$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
		$authAdapter->setTableName($who)
			->setIdentityColumn('username')
			->setCredentialColumn('password');
		return $authAdapter;
	}

ACL roles (user types) and permissions are configured in the configs/acl/role.xml file.
In DotKernel there are 3 roles: guest, user and admin.
The resources for ACL are taken from configs/router.xml – see controllers tag.

The Dot_Acl class

  • controls the user access (ACL – Access Controller Layer),
  • is used for setting and checking the permissions of a user,
  • uses Zend_Acl,  for checking if a role (user) has access to a resource (controller)

Dot_Auth calls the isAllowed method from Dot_Acl which authenticates the user.

// instantiate Zend_Acl
$this->acl = new Zend_Acl();
public function isAllowed($role)
	{
		$resource = $this->requestControllerProcessed;
		$privillege = $this->requestAction;
		if(!$this->acl->has($resource))
		{
			return FALSE;	
		}
		else
		{
			return $this->acl->isAllowed($role, $resource, $privillege);
		}
	}

IndexController.php is calling Dot_Auth

$dotAuth = Dot_Auth::getInstance();
$dotAuth->checkIdentity('user');

Looking for PHP, Laminas or Mezzio Support?

As part of the Laminas Commercial Vendor Program, Apidemia offers expert technical support and services for:

  • Modernising Legacy Applications
  • Migration from any version of Zend Framework to Laminas
  • Migration from legacy Laminas API Tools (formerly Apigility) to Dotkernel API
  • Mezzio and Laminas Consulting and Technical Audit
  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>