Compare commits

...

22 commits

Author SHA1 Message Date
Simon Vieille 79d549254f Merge branch 'develop'
All checks were successful
ci/woodpecker/push/woodpecker/2 Pipeline was successful
ci/woodpecker/push/woodpecker/1 Pipeline was successful
2024-03-25 16:00:53 +01:00
Simon Vieille c79e96e291
apply consensus as access decision manager strategy
All checks were successful
ci/woodpecker/push/woodpecker/2 Pipeline was successful
ci/woodpecker/push/woodpecker/1 Pipeline was successful
2024-03-25 16:00:51 +01:00
Simon Vieille 092b490ae2 Merge branch 'develop'
Some checks failed
ci/woodpecker/push/woodpecker/1 Pipeline failed
ci/woodpecker/push/woodpecker/2 Pipeline was successful
2024-03-25 15:46:57 +01:00
Simon Vieille fcecf74f90
add default voter
Some checks failed
ci/woodpecker/push/woodpecker/2 Pipeline failed
ci/woodpecker/push/woodpecker/1 Pipeline failed
2024-03-25 15:46:53 +01:00
Simon Vieille c00723a246 Merge branch 'develop'
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker/2 Pipeline was successful
ci/woodpecker/push/woodpecker/1 Pipeline was successful
2023-11-01 16:34:57 +01:00
Simon Vieille e81b11c5ec
release v1.23.0
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-11-01 16:34:54 +01:00
Simon Vieille af2212ac8c Merge branch 'develop'
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-11-01 16:33:49 +01:00
Simon Vieille b57b0e3770
update murph
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-11-01 16:33:44 +01:00
Simon Vieille ba76a83163 Merge branch 'develop' 2023-09-28 18:14:35 +02:00
Simon Vieille 2874f579dc
update changelog 2023-09-28 18:14:22 +02:00
Simon Vieille 287e1d66cb
fix #1: add UniqueEntity constraint in the User entity 2023-09-28 18:13:18 +02:00
Simon Vieille b23a4fe9c5
update changelog 2023-09-07 14:11:11 +02:00
Simon Vieille 59bbd24b76
update woodpecker ci base file 2023-09-07 14:10:26 +02:00
Simon Vieille 2dfe6ef1ca Merge branch 'develop' 2023-08-11 09:48:53 +02:00
Simon Vieille 66f82ecc13
release v1.21.0 2023-08-11 09:48:50 +02:00
Simon Vieille 8432fc123e Merge branch 'develop' 2023-07-27 18:17:48 +02:00
Simon Vieille 627927a11e
update murph 2023-07-27 18:17:15 +02:00
Simon Vieille 67871179a8
update murph 2023-07-27 18:16:36 +02:00
Simon Vieille dbec7a884e
update changelog 2023-07-20 09:47:12 +02:00
Simon Vieille 8c6ad05cbd
add chdir in the console entrypoint 2023-07-20 09:21:17 +02:00
Simon Vieille cc0296e6e2
fix user crud controllers 2023-07-19 21:29:52 +02:00
Simon Vieille 4f94bd5640
add user admin controller and simples views in default files 2023-07-19 21:24:15 +02:00
10 changed files with 171 additions and 6 deletions

View file

@ -9,7 +9,7 @@ services:
environment:
- MARIADB_ROOT_PASSWORD=root
pipeline:
steps:
db_wait:
image: gitnet.fr/deblan/timeout:latest
commands:
@ -21,7 +21,7 @@ pipeline:
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
config:
image: deblan/php:8.1
image: deblan/php:${PHP_VERSION}
commands:
- echo APP_ENV=prod >> .env.local
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local

View file

@ -1,10 +1,35 @@
## [Unreleased]
## [1.19.0] 2023-04-15
## [v1.23.0] - 2023-09-28
### Changed
* upgrade murph/murph-core
## [1.18.0] 2023-01-13
## [v1.22.0] - 2023-09-28
### Added
* update woodpecker ci base file
### Fixed
* fix #1: add UniqueEntity constraint in the User entity
### Changed
* upgrade murph/murph-core
## [1.21.0] - 2023-08-11
### Changed
* upgrade murph/murph-core
## [1.20.0] - 2023-07-27
### Fixed
* fix collection widget: allow_add/allow_delete and prototype
### Added
* add user admin controller and simples views in default files
* add chdir in the console entrypoint
### Changed
* upgrade murph/murph-core
## [1.19.0] - 2023-04-15
### Changed
* upgrade murph/murph-core
## [1.18.0] - 2023-01-13
### Added
* feat(dep): update dependencies
* feat(update): apply new recipe for phpunit
@ -32,7 +57,7 @@
* fix(config): fix firewall config
## [1.17.0] 2022-11-19
## [1.17.0] - 2022-11-19
### Changed
* upgrade murph/murph-core
* replace annotation with attributes

View file

@ -10,6 +10,8 @@ if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
chdir(__DIR__.'/../');
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

View file

@ -7,7 +7,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.0.0",
"murph/murph-core": "^1.19"
"murph/murph-core": "^1.23"
},
"require-dev": {
"symfony/browser-kit": "^5.4",

View file

@ -3,6 +3,10 @@ security:
App\Entity\User:
algorithm: auto
access_decision_manager:
strategy: consensus
allow_if_all_abstain: false
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords

View file

@ -0,0 +1,79 @@
<?php
namespace App\Controller;
use App\Core\Controller\User\UserAdminController as BaseUserAdminController;
use App\Core\Crud\CrudConfiguration;
use App\Core\Factory\UserFactory as Factory;
use App\Core\Manager\EntityManager;
use App\Core\Security\TokenGenerator;
use App\Entity\User as Entity;
use App\Repository\UserRepositoryQuery as RepositoryQuery;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\Annotation\Route;
class UserAdminController extends BaseUserAdminController
{
#[Route(path: '/admin/user/{page}', name: 'admin_user_index', methods: ['GET'], requirements: ['page' => '\d+'])]
public function index(RepositoryQuery $query, Request $request, Session $session, int $page = 1): Response
{
return parent::index($query, $request, $session, $page);
}
#[Route(path: '/admin/user/new', name: 'admin_user_new', methods: ['GET', 'POST'])]
public function new(Factory $factory, EntityManager $entityManager, Request $request, TokenGenerator $tokenGenerator): Response
{
return parent::new($factory, $entityManager, $request, $tokenGenerator);
}
#[Route(path: '/admin/user/show/{entity}', name: 'admin_user_show', methods: ['GET'])]
public function show(Entity $entity): Response
{
return parent::show($entity);
}
#[Route(path: '/admin/user/filter', name: 'admin_user_filter', methods: ['GET'])]
public function filter(Session $session): Response
{
return parent::filter($session);
}
#[Route(path: '/admin/user/edit/{entity}', name: 'admin_user_edit', methods: ['GET', 'POST'])]
public function edit(Entity $entity, EntityManager $entityManager, Request $request): Response
{
return parent::edit($entity, $entityManager, $request);
}
#[Route(path: '/admin/user/inline_edit/{entity}/{context}/{label}', name: 'admin_user_inline_edit', methods: ['GET', 'POST'])]
public function inlineEdit(string $context, string $label, Entity $entity, EntityManager $entityManager, Request $request): Response
{
return parent::inlineEdit($context, $label, $entity, $entityManager, $request);
}
#[Route(path: '/admin/user/delete/{entity}', name: 'admin_user_delete', methods: ['DELETE', 'POST'])]
public function delete(Entity $entity, EntityManager $entityManager, Request $request): Response
{
return parent::delete($entity, $entityManager, $request);
}
#[Route(path: '/admin/user/resetting_request/{entity}', name: 'admin_user_resetting_request', methods: ['POST'])]
public function requestResetting(Entity $entity, EventDispatcherInterface $eventDispatcher, Request $request): Response
{
return parent::requestResetting($entity, $eventDispatcher, $request);
}
protected function getConfiguration(): CrudConfiguration
{
if ($this->configuration) {
return $this->configuration;
}
return parent::getConfiguration()
->setView('form', 'admin/user_admin/_form.html.twig')
->setView('show_entity', 'admin/user_admin/_show.html.twig')
;
}
}

View file

@ -9,9 +9,11 @@ use Doctrine\ORM\Mapping as ORM;
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[UniqueEntity('email')]
class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFactorInterface, EntityInterface
{
use Timestampable;

View file

@ -0,0 +1,51 @@
<?php
namespace App\Security\Voter;
use App\Core\Entity\EntityInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\User\UserInterface;
class EntityVoter extends Voter
{
public const EDIT = 'edit';
public const VIEW = 'show';
public const DELETE = 'delete';
protected function supports(string $attribute, mixed $subject): bool
{
// replace with your own logic
// https://symfony.com/doc/current/security/voters.html
return in_array($attribute, [self::EDIT, self::VIEW, self::DELETE])
&& $subject instanceof EntityInterface;
}
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
{
$user = $token->getUser();
if (!$user instanceof UserInterface) {
return false;
}
switch ($attribute) {
case self::EDIT:
return true;
break;
case self::VIEW:
return true;
break;
case self::DELETE:
return true;
break;
}
return false;
}
}

View file

@ -0,0 +1 @@
{{ include('@Core/user/user_admin/_form.html.twig') }}

View file

@ -0,0 +1 @@
{{ include('@Core/user/user_admin/_show.html.twig') }}