fix permissions

master
Jean-Christian Paul Denis 2022-11-30 23:43:02 +01:00
parent 3568ec0055
commit 76cc3b53bd
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 11 additions and 7 deletions

View File

@ -21,7 +21,7 @@ dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
cinecturlink2AdminUrl(), cinecturlink2AdminUrl(),
cinecturlink2AdminIcon(), cinecturlink2AdminIcon(),
preg_match('/' . preg_quote(cinecturlink2AdminUrl()) . '(&.*)?$/', $_SERVER['REQUEST_URI']), preg_match('/' . preg_quote(cinecturlink2AdminUrl()) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
cinecturlink2AdmiPerm(), dcCore::app()->auth->check(cinecturlink2AdminPerm(), dcCore::app()->blog->id)
); );
dcCore::app()->addBehavior('adminColumnsListsV2', function (ArrayObject $cols) { dcCore::app()->addBehavior('adminColumnsListsV2', function (ArrayObject $cols) {
@ -62,7 +62,7 @@ dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $f
'url' => cinecturlink2AdminUrl() . '#links', 'url' => cinecturlink2AdminUrl() . '#links',
'small-icon' => cinecturlink2AdminIcon(), 'small-icon' => cinecturlink2AdminIcon(),
'large-icon' => cinecturlink2AdminIcon(), 'large-icon' => cinecturlink2AdminIcon(),
'permissions' => cinecturlink2AdmiPerm(), 'permissions' => cinecturlink2AdminPerm(),
]); ]);
}); });
@ -76,7 +76,7 @@ function cinecturlink2AdminIcon(): string
return urldecode(dcPage::getPF('cinecturlink2/icon.svg')); return urldecode(dcPage::getPF('cinecturlink2/icon.svg'));
} }
function cinecturlink2AdmiPerm(): bool function cinecturlink2AdminPerm(): bool
{ {
return dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id); return dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_CONTENT_ADMIN]);
} }

View File

@ -15,7 +15,7 @@ if (!defined('DC_CONTEXT_MODULE')) {
} }
# Check user perms # Check user perms
dcPage::check(dcAuth::PERMISSION_ADMIN); dcPage::check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]));
$redir = empty($_REQUEST['redir']) ? $redir = empty($_REQUEST['redir']) ?
dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir']; dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];

View File

@ -27,7 +27,9 @@ $this->registerModule(
'1.1.0', '1.1.0',
[ [
'requires' => [['core', '2.24']], 'requires' => [['core', '2.24']],
'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN, 'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/cinecturlink2', 'support' => 'https://github.com/JcDenis/cinecturlink2',
'details' => 'https://plugins.dotaddict.org/dc2/details/cinecturlink2', 'details' => 'https://plugins.dotaddict.org/dc2/details/cinecturlink2',

View File

@ -14,7 +14,9 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
dcPage::check(dcAuth::PERMISSION_CONTENT_ADMIN); dcPage::check(dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN,
]));
$linkid = $_REQUEST['linkid'] ?? ''; $linkid = $_REQUEST['linkid'] ?? '';
$linktitle = $_POST['linktitle'] ?? ''; $linktitle = $_POST['linktitle'] ?? '';