Created
May 6, 2015 15:19
-
-
Save vgrish/e8bfcdccbc3f6b4ba3d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch ($modx->event->name) { | |
case 'OnLoadWebDocument': | |
$id = 1; // id ресурса куда послать в случае чего | |
$res = array(1,2,3); // id ресурсов | |
if($modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) { | |
//разрешаем показать | |
} | |
elseif(!$modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) { | |
// заперщаем | |
$modx->sendRedirect($modx->makeUrl((!empty($id)) ? $id : $modx->getOption('site_start'), '', '', 'full')); | |
} | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment