first
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\Framework\Acl;
|
||||
|
||||
use Nextend\Framework\Pattern\MVCHelperTrait;
|
||||
|
||||
abstract class AbstractPlatformAcl {
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param MVCHelperTrait $MVCHelper
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function authorise($action, $MVCHelper);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\Framework\Acl;
|
||||
|
||||
use Nextend\Framework\Acl\Joomla\JoomlaAcl;
|
||||
use Nextend\Framework\Acl\WordPress\WordPressAcl;
|
||||
use Nextend\Framework\Pattern\MVCHelperTrait;
|
||||
|
||||
class Acl {
|
||||
|
||||
/**
|
||||
* @var AbstractPlatformAcl
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
public function __construct() {
|
||||
self::$instance = new WordPressAcl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param MVCHelperTrait $MVCHelper
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function canDo($action, $MVCHelper) {
|
||||
return self::$instance->authorise($action, $MVCHelper);
|
||||
}
|
||||
}
|
||||
|
||||
new Acl();
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\Framework\Acl\WordPress;
|
||||
|
||||
use Nextend\Framework\Acl\AbstractPlatformAcl;
|
||||
use function current_user_can;
|
||||
|
||||
class WordPressAcl extends AbstractPlatformAcl {
|
||||
|
||||
public function authorise($action, $MVCHelper) {
|
||||
return current_user_can($action) && current_user_can('unfiltered_html');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user