PHP code example of remp / crm-admin-module

1. Go to this page and download the library: Download remp/crm-admin-module 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/ */

    

remp / crm-admin-module example snippets


class UserSignInEventHandler extends AbstractListener
{
    private const SECURE_LOGIN_META = 'secure_logged_in';

    private $secureAdminAccess;

    public function __construct(SecuredAdminAccess $securedAdminAccess) {
        $this->secureAdminAccess = $securedAdminAccess;
    }

    public function handle(EventInterface $event)
    {
        if (!$event instanceof UserSignInEvent) {
            throw new \Exception("Invalid type of event received, UserSignInEvent expected, got: " . get_class($event));
        }

        $source = $event->getSource();

        if ($source === \Crm\UsersModule\Auth\Sso\GoogleSignIn::ACCESS_TOKEN_SOURCE_WEB_GOOGLE_SSO) {
            $this->secureAdminAccess->setSecure(true);
            return;
        }

        $this->secureAdminAccess->setSecure(false);
    }
}