PHP code example of dereuromark / cakephp-tinyauth-backend

1. Go to this page and download the library: Download dereuromark/cakephp-tinyauth-backend 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/ */

    

dereuromark / cakephp-tinyauth-backend example snippets


use Cake\Core\Configure;
use Psr\Http\Message\ServerRequestInterface;

Configure::write(
    'TinyAuthBackend.editorCheck',
    function (mixed $identity, ServerRequestInterface $request): bool {
        if ($identity === null) {
            return false;
        }

        $roleId = is_object($identity) && method_exists($identity, 'get')
            ? $identity->get('role_id')
            : ($identity['role_id'] ?? null);

        return (int)$roleId === 3;
    },
);

   public function initialize(): void
   {
       $this->loadHelper('Form', [
           'templates' => [
               'hiddenBlock' => '<div hidden>{{content}}</div>',
           ],
       ]);
   }