Archived
1
0

Changes of the last few months including restructuring system from using only ranks to permissions

This commit is contained in:
Marcel
2018-12-26 18:19:28 +01:00
parent 72f3434803
commit 1a1ac17ecf
38 changed files with 845 additions and 361 deletions

View File

@@ -10,7 +10,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<div class="clearfix"></div>
</div>
<div class="x_content">
<iframe src="/piwik/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today"
<iframe src="https://stats.kingofdog.eu/"
style="height:100vh;width:100%" frameborder="0" async></iframe>
</div>
</div>

View File

@@ -33,7 +33,7 @@
?>
<link href="<?= $styleName ?>" rel="stylesheet">
<link rel="stylesheet" href="<?= base_url('assets/css/lib/fontawesome-all.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('assets/css/lib/fontawesome-all-5.2.0.min.css') ?>">
<link href="/assets/images/ico/favicon.ico" rel="icon">
</head>
@@ -91,64 +91,78 @@
<?php endif; ?>
</ul>
</div>
<div class="menu_section">
<h3>Blog</h3>
<ul class="nav side-menu">
<li>
<a href="/admin/blog">
<i class="fa fa-comments"></i>
Blog-Posts
</a>
</li>
<li>
<a href="/admin/blog/trashbin">
<i class="fa fa-trash"></i>
Gelöschte Blog-Posts
</a>
</li>
<li>
<a href="/admin/blog/edit">
<i class="fa fa-edit"></i>
Blog-Post erstellen
</a>
</li>
</ul>
</div>
<?php if ($_SESSION['user']['rank'] >= 9): ?>
<?php if (get_instance()->hasPermission('blog.view')): ?>
<div class="menu_section">
<h3>Verwaltung</h3>
<h3>Blog</h3>
<ul class="nav side-menu">
<?php if (get_instance()->hasPermission('blog.view')): ?>
<li>
<a href="/admin/blog">
<i class="fa fa-comments"></i>
Blog-Posts
</a>
</li>
<?php endif; ?>
<?php if (get_instance()->hasPermission('blog.view')): ?>
<li>
<a href="/admin/blog/trashbin">
<i class="fa fa-trash"></i>
Gelöschte Blog-Posts
</a>
</li>
<?php endif; ?>
<?php if (get_instance()->hasPermission('blog.create')): ?>
<li>
<a href="/admin/blog/edit">
<i class="fa fa-edit"></i>
Blog-Post erstellen
</a>
</li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<div class="menu_section">
<h3>Verwaltung</h3>
<ul class="nav side-menu">
<?php if (get_instance()->hasPermission('projects.view')): ?>
<li>
<a href="/admin/projects">
<i class="fa fa-camera"></i>
Projekte
</a>
</li>
<?php endif; ?>
<?php if (get_instance()->hasPermission('projects.create')): ?>
<li>
<a href="/admin/projects/edit">
<i class="fa fa-plus"></i>
Projekt erstellen
</a>
</li>
<?php endif; ?>
<?php if (get_instance()->hasPermission('file.view')): ?>
<li>
<a href="/admin/files">
<i class="fa fa-folder-open"></i>
Dateien
</a>
</li>
<?php endif; ?>
<?php if (get_instance()->hasPermission('redirect.view')): ?>
<li>
<a href="/admin/redirects">
<i class="fa fa-arrow-right"></i>
Weiterleitungen
</a>
</li>
</ul>
</div>
<?php endif; ?>
<?php endif; ?>
</ul>
</div>
<div class="menu_section">
<h3>Nutzer</h3>
<ul class="nav side-menu">
<?php if ($_SESSION['user']['rank'] >= 9): ?>
<?php if (get_instance()->hasPermission('user.view')): ?>
<li>
<a href="/admin/users">
<i class="fa fa-users"></i>
@@ -156,7 +170,7 @@
</a>
</li>
<?php endif; ?>
<?php if ($_SESSION['user']['rank'] >= 9): ?>
<?php if (get_instance()->hasPermission('feedback.receive')): ?>
<li>
<a href="/admin/feedback">
<i class="fa fa-comments"></i>
@@ -164,7 +178,7 @@
</a>
</li>
<?php endif; ?>
<?php if ($_SESSION['user']['rank'] >= 8): ?>
<?php if (get_instance()->hasPermission('contact.view')): ?>
<li>
<a href="/admin/contact">
<i class="fa fa-envelope"></i>

View File

@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div class="right_col" role="main">
<div class="row">
@@ -77,5 +77,36 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</div>
</div>
</div>
<div class="col-md-6 col-sm-4 col-xs-4">
<div class="x_panel">
<div class="x_title">
<h2>Individuelle Rechte</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<form method="POST" class="form">
<?php foreach ($availablePermissions as $group => $perms): ?>
<h4>
<?= $group ?>
<input type="checkbox" class="group-all">
</h4>
<ul>
<?php foreach ($perms as $perm):
$name = $group . '.' . $perm; ?>
<li>
<label data-toggle="tooltip" title="blablabla" for="<?= $group . $perm ?>"><?= $name ?></label>
<input type="checkbox" value="true" name="permissions[<?= $group . $perm ?>]" id="<?= $group . $perm ?>" <?= in_array($name, $permissions) ? 'checked' : '' ?>>
</li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
<input type="submit" class="btn btn-primary" value="Speichern">
</form>
</div>
</div>
</div>
</div>
</div>

View File

@@ -55,10 +55,11 @@
];
$loginMethod = $loginMethods[$user['login_method']];
$date_created = strtotime($user['date_created']);
$last_login = strtotime($user['lastLogin']);
$date_created_str = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$date_created"), "de_DE");
$last_login_str = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$last_login"), "de_DE");
$dateCreated = strtotime($user['date_created']);
$lastLogin = strtotime($user['lastLogin']);
$dateCreatedStr = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$dateCreated"), "de_DE");
if($lastLogin)
$lastLoginStr = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$lastLogin"), "de_DE");
?>
<tr>
<td>
@@ -76,9 +77,9 @@
<?= $user['rankName'] ?>
</td>
<td>
<?= $date_created_str ?>
<?= $dateCreatedStr ?>
<br>
(<?= date("d.m.Y H:i", $date_created) ?>)
(<?= date("d.m.Y H:i", $dateCreated) ?>)
</td>
<td>
<img src="<?= $user['profile_picture'] ?>?w=50" class="img-fluid rounded"
@@ -104,9 +105,9 @@
<?= $loginMethod ?>
</td>
<td>
<?= $last_login_str ?>
<?= $lastLoginStr ?>
<br>
(<?= date("d.m.Y H:i", $last_login) ?>)
(<?= date("d.m.Y H:i", $lastLogin) ?>)
</td>
<td>
<?= Locale::getDisplayLanguage($user['language'], "de") ?>
@@ -114,14 +115,23 @@
<?= Locale::getDisplayRegion("-" . $user['country'], 'de') ?>
</td>
<td>
<?php if (isset($_SESSION['user']) && $_SESSION['user']['rank'] >= 8 && ($_SESSION['user']['rank'] > $user['rank'] || $_SESSION['user']['rank'] == 10)): ?>
<?php if(get_instance()->hasPermission('user.viewDetails')): ?>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Details" href="<?= base_url('admin/users/details/' . $user['ID']) ?>" target="_blank" class="btn btn-xs btn-default">
<i class="fa fa-info-circle"></i>
</a>
<?php endif; ?>
<?php if(get_instance()->hasPermission('user.viewDetails')): ?>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Einstellungen" href="<?= base_url('admin/users/settings/' . $user['ID']) ?>" target="_blank" class="btn btn-xs btn-default">
<i class="fa fa-cog"></i>
</a>
<?php endif; ?>
<?php if(get_instance()->hasPermission('user.ban')): ?>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Account löschen" onclick="showDeleteModal(<?= $user['ID'] ?>. <?= $user['username'] ?>)" target="_blank" class="btn btn-xs btn-red">
<i class="fas fa-user-slash"></i>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>