New role Author

This commit is contained in:
Diego Najar 2019-05-13 18:26:35 +02:00
parent 3d87b6597d
commit fc2387bcb9
9 changed files with 22 additions and 24 deletions

View File

@ -4,7 +4,7 @@
// Check role // Check role
// ============================================================================ // ============================================================================
checkRole(array('admin', 'editor')); checkRole(array('admin', 'editor', 'author'));
// ============================================================================ // ============================================================================
// Functions // Functions
@ -41,8 +41,8 @@ $scheduled = $pages->getScheduledDB(true);
$static = $pages->getStaticDB(true); $static = $pages->getStaticDB(true);
$sticky = $pages->getStickyDB(true); $sticky = $pages->getStickyDB(true);
// If the user is an Editor filter the content he/she can edit // If the user is an Author filter the content he/she can edit
if (checkRole(array('editor'), false)) { if (checkRole(array('author'), false)) {
$published = filterContentOwner($published); $published = filterContentOwner($published);
$drafts = filterContentOwner($drafts); $drafts = filterContentOwner($drafts);
$scheduled = filterContentOwner($scheduled); $scheduled = filterContentOwner($scheduled);

View File

@ -4,7 +4,7 @@
// Check role // Check role
// ============================================================================ // ============================================================================
if (checkRole(array('editor'), false)) { if (checkRole(array('author'), false)) {
try { try {
$pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters']; $pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters'];
$page = new Page($pageKey); $page = new Page($pageKey);

View File

@ -4,7 +4,7 @@
// Check role // Check role
// ============================================================================ // ============================================================================
checkRole(array('admin', 'editor')); checkRole(array('admin', 'editor', 'author'));
// ============================================================================ // ============================================================================
// Functions // Functions

View File

@ -6,25 +6,23 @@
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="oi oi-dashboard"></span><?php $L->p('Dashboard') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="fa fa-dashboard"></span><?php $L->p('Dashboard') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="oi oi-external-link"></span><?php $L->p('Website') ?></a> <a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="fa fa-external-link"></span><?php $L->p('Website') ?></a>
</li> </li>
<li class="nav-item mt-3"> <li class="nav-item mt-3">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span style="color: #0078D4;" class="oi oi-plus"></span><?php $L->p('New content') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span style="color: #0078D4;" class="fa fa-plus"></span><?php $L->p('New content') ?></a>
</li>
<?php if (checkRole(array('editor'),false)): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="oi oi-layers"></span><?php $L->p('Content') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>"><span class="oi oi-person"></span><?php $L->p('Profile') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-layers"></span><?php $L->p('Content') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>"><span class="fa fa-person"></span><?php $L->p('Profile') ?></a>
</li> </li>
<?php endif; ?>
<?php if (checkRole(array('admin'),false)): ?> <?php if (checkRole(array('admin'),false)): ?>
@ -76,6 +74,6 @@
<?php endif; ?> <?php endif; ?>
<li class="nav-item mt-5"> <li class="nav-item mt-5">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="oi oi-account-logout"></span><?php $L->p('Logout') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="fa fa-account-logout"></span><?php $L->p('Logout') ?></a>
</li> </li>
</ul> </ul>

View File

@ -195,7 +195,7 @@ function table($type) {
<!-- First button --> <!-- First button -->
<li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>"> <li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::firstPageUrl() ?>"><span class="align-middle oi oi-media-skip-backward"></span> <?php echo $L->get('First'); ?></a> <a class="page-link" href="<?php echo Paginator::firstPageUrl() ?>"><span class="align-middle fa fa-media-skip-backward"></span> <?php echo $L->get('First'); ?></a>
</li> </li>
<!-- Previous button --> <!-- Previous button -->
@ -210,7 +210,7 @@ function table($type) {
<!-- Last button --> <!-- Last button -->
<li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>"> <li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::lastPageUrl() ?>"><?php echo $L->get('Last'); ?> <span class="align-middle oi oi-media-skip-forward"></span></a> <a class="page-link" href="<?php echo Paginator::lastPageUrl() ?>"><?php echo $L->get('Last'); ?> <span class="align-middle fa fa-media-skip-forward"></span></a>
</li> </li>
</ul> </ul>

View File

@ -55,8 +55,8 @@ echo Bootstrap::formOpen(array(
<!-- TOOLBAR --> <!-- TOOLBAR -->
<div id="jseditorToolbar"> <div id="jseditorToolbar">
<div id="jseditorToolbarRight" class="btn-group btn-group-sm float-right" role="group" aria-label="Toolbar right"> <div id="jseditorToolbarRight" class="btn-group btn-group-sm float-right" role="group" aria-label="Toolbar right">
<button type="button" class="btn btn-light" id="jsmediaManagerOpenModal" data-toggle="modal" data-target="#jsmediaManagerModal"><span class="oi oi-image"></span> <?php $L->p('Images') ?></button> <button type="button" class="btn btn-light" id="jsmediaManagerOpenModal" data-toggle="modal" data-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
<button type="button" class="btn btn-light" id="jsoptionsSidebar" style="z-index:30"><span class="oi oi-cog"></span> <?php $L->p('Options') ?></button> <button type="button" class="btn btn-light" id="jsoptionsSidebar" style="z-index:30"><span class="fa fa-cog"></span> <?php $L->p('Options') ?></button>
</div> </div>
<div id="jseditorToolbarLeft"> <div id="jseditorToolbarLeft">

View File

@ -53,7 +53,7 @@
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'role', 'name'=>'role',
'label'=>$L->g('Role'), 'label'=>$L->g('Role'),
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')), 'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>$user->role(), 'selected'=>$user->role(),
'class'=>'', 'class'=>'',
'tip'=>'' 'tip'=>''

View File

@ -48,8 +48,8 @@
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'role', 'name'=>'role',
'label'=>$L->g('Role'), 'label'=>$L->g('Role'),
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')), 'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>'Editor', 'selected'=>'Author',
'class'=>'', 'class'=>'',
'tip'=>'' 'tip'=>''
)); ));

View File

@ -7,7 +7,7 @@ class Users extends dbJSON {
'lastName'=>'', 'lastName'=>'',
'nickname'=>'', 'nickname'=>'',
'description'=>'', 'description'=>'',
'role'=>'editor', // admin, editor 'role'=>'author', // admin, editor, author
'password'=>'', 'password'=>'',
'salt'=>'!Pink Floyd!Welcome to the machine!', 'salt'=>'!Pink Floyd!Welcome to the machine!',
'email'=>'', 'email'=>'',