Skip to content

Commit

Permalink
2.63.0 Preparations for CLE Panner mode
Browse files Browse the repository at this point in the history
  • Loading branch information
classaxe committed Mar 3, 2024
1 parent b4e1d51 commit aa30a0c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
3 changes: 2 additions & 1 deletion src/Controller/Web/Admin/Info.php
Expand Up @@ -2,6 +2,7 @@
namespace App\Controller\Web\Admin;

use App\Controller\Web\Base;
use App\Entity\User as UserEntity;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

Expand All @@ -28,7 +29,7 @@ public function controller(
$_locale,
$system
) {
if (!$this->parameters['isAdmin']) {
if (!((int)$this->parameters['access'] & UserEntity::MASTER)) {
$this->session->set('route', 'admin/info');
return $this->redirectToRoute('logon', ['system' => $system]);
}
Expand Down
7 changes: 2 additions & 5 deletions src/Controller/Web/Users/Collection.php
Expand Up @@ -41,11 +41,8 @@ public function users(
Form $form
) {
if (!((int)$this->parameters['access'] & UserEntity::MASTER)) {
if ((int)$this->parameters['access'] === 0) {
$this->session->set('route', 'admin/users');
return $this->redirectToRoute('logon', ['system' => $system]);
}
throw $this->createAccessDeniedException('You do not have access to this page');
$this->session->set('route', 'admin/info');
return $this->redirectToRoute('logon', ['system' => $system]);
}
$this->session->set('route', '');
$options = [
Expand Down
11 changes: 4 additions & 7 deletions src/Controller/Web/Users/User.php
Expand Up @@ -43,12 +43,9 @@ public function user(
Request $request,
UserViewForm $userViewForm
) {
if (!((int)$this->parameters['access'])) {
if ((int)$this->parameters['access'] === 0) {
$this->session->set('route', 'user?id=' . $id);
return $this->redirectToRoute('logon', ['system' => $system]);
}
throw $this->createAccessDeniedException('You do not have access to this page');
if (!((int)$this->parameters['access'] & UserEntity::MASTER)) {
$this->session->set('route', 'admin/info');
return $this->redirectToRoute('logon', ['system' => $system]);
}
$this->session->set('route', '');
$operation = $id;
Expand Down Expand Up @@ -109,7 +106,7 @@ public function user(
return new Response("<script>$js</script>", Response::HTTP_OK, [ 'content-type' => 'text/html' ]);
}
$this->session->set('reloadOpener', 1);
return $this->redirectToRoute('admin/user', ['system' => $system, 'id' => $id]);
return $this->redirectToRoute('user', ['system' => $system, 'id' => $id]);
}

$parameters = [
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Web/Users/UserLogsessions.php
Expand Up @@ -47,7 +47,7 @@ public function logSessions(
return $this->redirectToRoute('logon', ['system' => $system]);
}
if (!$user = $this->getValidUser($id)) {
return $this->redirectToRoute('admin/users', ['system' => $system]);
return $this->redirectToRoute('users', ['system' => $system]);
}

$isAdmin = $this->parameters['isAdmin'];
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Web/Users/YourProfile.php
Expand Up @@ -41,7 +41,7 @@ public function profile(
UserProfileForm $userProfileForm
) {
if ((int)$this->parameters['access'] === 0) {
$this->session->set('route', 'admin/profile');
$this->session->set('route', 'profile');
return $this->redirectToRoute('logon', ['system' => $system]);
}

Expand Down
28 changes: 19 additions & 9 deletions src/Repository/ModeRepository.php
Expand Up @@ -130,6 +130,14 @@ class ModeRepository
'title' => 'Logon',
'url'=> false
],
'logoff' => [
'access' => User::USER | User::CLE | User::AWARDS | User::ADMIN | User::MASTER,
'admin' => true,
'guest' => false,
'menu' => 'Logoff',
'title' => 'Log Off',
'url'=> false
],
'help' => [
'access' => User::ALL,
'admin' => true,
Expand All @@ -149,7 +157,7 @@ class ModeRepository
'url'=> false
],
'admin/info' => [
'access' => User::ADMIN | User::MASTER,
'access' => User::MASTER,
'admin' => true,
'guest' => false,
'menu' => 'Info',
Expand All @@ -176,7 +184,7 @@ class ModeRepository
'access' => User::MASTER,
'admin' => true,
'guest' => false,
'menu' => 'Donations',
'menu' => 'Gift',
'title' => 'Gifts received',
'url'=> false
],
Expand All @@ -188,20 +196,22 @@ class ModeRepository
'title' => 'Admin Help',
'url'=> false
],
'profile' => [
'access' => User::USER | User::CLE | User::AWARDS | User::ADMIN | User::MASTER,
/*
'clePlanner' => [
'access' => User::CLE | User::MASTER,
'admin' => true,
'guest' => false,
'menu' => 'Your Profile',
'title' => 'Edit your profile',
'menu' => 'CLE Planner',
'title' => 'View loggings for various ranges',
'url'=> false
],
'logoff' => [
*/
'profile' => [
'access' => User::USER | User::CLE | User::AWARDS | User::ADMIN | User::MASTER,
'admin' => true,
'guest' => false,
'menu' => 'Logoff',
'title' => 'Log Off',
'menu' => 'Your Profile',
'title' => 'Edit your profile',
'url'=> false
],
]
Expand Down

0 comments on commit aa30a0c

Please sign in to comment.