PHP code example of drago-ex / authorization

1. Go to this page and download the library: Download drago-ex/authorization 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/ */

    

drago-ex / authorization example snippets


use Drago\Authorization\Authorization

// Redirect to a specific login presenter or module
private string $loginLink = ':Module:Presenter:';

use Drago\Authorization\Control\AuthorizationControl

// Minimum configuration to create components.

protected function createComponentPermissionsControl(): PermissionsControl
{
	return $this->permissionsControl;
}

protected function createComponentRolesControl(): RolesControl
{
	return $this->rolesControl;
}

protected function createComponentResourcesControl(): ResourcesControl
{
	return $this->resourcesControl;
}

protected function createComponentPrivilegesControl(): PrivilegesControl
{
	return $this->privilegesControl;
}

protected function createComponentAccessControl(): AccessControl
{
	return $this->accessControl;
}

// Set custom templates for controls
$control->templateControl = __DIR__ . '/path/to/file.latte';
$control->templateGrid = __DIR__ . '/path/to/file.latte';

// Insert a translator for multi-language support
$control->translator = $this->getTranslator();