Locker

The PHP interface

Locker comes with an interface you can implement your own requirements.

To do so, just create a modX service implementing iLocker :

<?php
/**
 * @var modX $this
 *
 * @see xPDO::getService
 */
$iPath = $this->getOption('locker.core_path', null, $this->getOption('core_path') . 'components/locker/');
require_once $iPath . 'vendor/autoload.php';

class MyCustomLocker implements iLocker
{

    public function lock()
    {
        // Your locking logic
    }

    public function unlock()
    {
        // Your un-locking logic
    }

    public function isLocked()
    {
        // Your logic to define if the manager is currently locked
    }

    public function isUserAllowed()
    {
        // Your logic to define if the current user is allowed to use the manager while being locked
    }

    public function displayDenied()
    {
        // Your way to send the not allowed user to somewhere, when she tries to log into the manager
    }

}

Once your service is done, set/define the following system settings :

  • locker.class_name : MyCustomLocker
  • locker.class_path : /path/to/FOLDER/to/mycustomlocker.class.php