mirror of
https://github.com/resources-manager/resources-manager-webui.git
synced 2024-11-21 15:39:20 +01:00
wip
This commit is contained in:
parent
115c7c256e
commit
4e4ae007c4
|
@ -8,11 +8,14 @@ use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use App\Entity\User;
|
||||
use App\Service\Menus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
|
||||
class SecurityController extends AbstractController
|
||||
|
@ -92,10 +95,34 @@ class SecurityController extends AbstractController
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private function getformCreateUser()
|
||||
{
|
||||
return $this->createFormBuilder()
|
||||
->add('email', EmailType::class,[])
|
||||
->add('password', PasswordType::class, [])
|
||||
->add('display_name', TextType::class,[])
|
||||
->add('roles', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'USER' => false,
|
||||
'RESOURCE_MANAGER' => 'RESOURCE_MANAGER',
|
||||
'SUPER ADMIN' => 'SUPER_ADMIN',
|
||||
],
|
||||
'multiple' => false
|
||||
])
|
||||
->add('save', SubmitType::class,[])
|
||||
->getForm();
|
||||
}
|
||||
public function showUserManagePage()
|
||||
{
|
||||
|
||||
$users = $this->getDoctrine()
|
||||
->getRepository(User::class)
|
||||
->findAll();
|
||||
$menus = new Menus();
|
||||
return $this->render('security/listUsers.html.twig', [
|
||||
"menus" => $menus->getMenus( $this->getUser() ),
|
||||
"users" => $users,
|
||||
"formCreateUser" => $this->getformCreateUser()->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
36
templates/security/listUsers.html.twig
Normal file
36
templates/security/listUsers.html.twig
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
{% block title %}Manage users{% endblock %}
|
||||
{% block header %}<h1>Manage users</h1>{% endblock %}
|
||||
{% block nav %}{% include 'menus.html.twig' %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<article id="FormCreateUser">
|
||||
<h2>Create a new user</h2>
|
||||
{{ form(formCreateUser) }}
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<h2>Users list</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Displayed Name</th>
|
||||
<th>Login (email)</th>
|
||||
<th>Roles</th>
|
||||
<th>Active</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for u in users %}
|
||||
<tr>
|
||||
<td>{{ u.displayName }} </td>
|
||||
<td>{{ u.email }}</td>
|
||||
<td>{{ u.roles|join(',') }}</td>
|
||||
<td>{{ u.active? 'Yes':'No' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</article>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user