Bluz\Controller\Controller::checkPrivilege PHP Method

checkPrivilege() public method

Check Privilege
public checkPrivilege ( )
    public function checkPrivilege()
    {
        if ($privilege = $this->getReflection()->getPrivilege()) {
            if (!Acl::isAllowed($this->module, $privilege)) {
                throw new ForbiddenException();
            }
        }
    }

Usage Example

Ejemplo n.º 1
0
 * @param  string $module
 * @param  string $controller
 * @param  array  $params
 * @param  bool   $checkAccess
 * @return null|string
 * @throws ViewException
 */
return function ($module, $controller, $params = [], $checkAccess = false) {
    /**
     * @var View $this
     */
    try {
        if ($checkAccess) {
            try {
                $controllerInstance = new Controller($module, $controller);
                $controllerInstance->checkPrivilege();
            } catch (ForbiddenException $e) {
                return null;
            }
        }
    } catch (\Exception $e) {
        throw new ViewException('Url View Helper: ' . $e->getMessage());
    }
    if (null === $module) {
        $module = Request::getModule();
    }
    if (null === $controller) {
        $controller = Request::getController();
    }
    if (null === $params) {
        $params = Request::getParams();
All Usage Examples Of Bluz\Controller\Controller::checkPrivilege