1 | <?php |
||
19 | class UserController extends Admin |
||
20 | { |
||
21 | /** |
||
22 | * @return string |
||
23 | */ |
||
24 | 1 | public static function showAdminManager() |
|
25 | { |
||
26 | 1 | if (Request::getInstance()->getMethod() != 'GET') { |
|
27 | return self::updateAdminUsers(); |
||
28 | } |
||
29 | 1 | $admins = AdminServices::getInstance()->getAdmins(); |
|
30 | 1 | $form = new AdminForm(); |
|
31 | $form->build(); |
||
32 | return Template::getInstance()->render('admin.html.twig', array( |
||
33 | 'admins' => $admins, |
||
34 | 'form' => $form, |
||
35 | 'profiles' => Security::getProfiles(), |
||
36 | )); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Método que gestiona los usuarios administradores de la plataforma |
||
41 | * @GET |
||
42 | * @route /admin/setup |
||
43 | * @label Gestor de usuarios PSFS |
||
44 | * @return string|null |
||
45 | * @throws \HttpException |
||
46 | */ |
||
47 | public function adminers() |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public static function updateAdminUsers() |
||
56 | { |
||
57 | $admins = AdminServices::getInstance()->getAdmins(); |
||
58 | $form = new AdminForm(); |
||
59 | $form->build(); |
||
60 | $form->hydrate(); |
||
61 | if ($form->isValid()) { |
||
62 | if (Security::save($form->getData())) { |
||
63 | Logger::log('Configuration saved successful'); |
||
64 | Security::getInstance()->setFlash("callback_message", _("Usuario agregado correctamente")); |
||
65 | Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true)); |
||
66 | } else { |
||
67 | throw new ConfigException(_('Error al guardar los administradores, prueba a cambiar los permisos')); |
||
68 | } |
||
69 | } |
||
70 | return Template::getInstance()->render('admin.html.twig', array( |
||
71 | 'admins' => $admins, |
||
72 | 'form' => $form, |
||
73 | 'profiles' => Security::getProfiles(), |
||
74 | )); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Servicio que guarda los usuarios de administración |
||
79 | * @POST |
||
80 | * @route /admin/setup |
||
81 | * @visible false |
||
82 | * @return string|void |
||
83 | * @throws \HttpException |
||
84 | */ |
||
85 | public function setAdminUsers() |
||
89 | |||
90 | /** |
||
91 | * Acción que pinta un formulario genérico de login pra la zona restringida |
||
92 | * @param string $route |
||
|
|||
93 | * @GET |
||
94 | * @route /admin/login |
||
95 | * @visible false |
||
96 | * @return string HTML |
||
97 | */ |
||
98 | public function adminLogin($route = null) |
||
106 | |||
107 | /** |
||
108 | * Servicio que valida el login |
||
109 | * @param null $route |
||
110 | * @POST |
||
111 | * @visible false |
||
112 | * @route /admin/login |
||
113 | * @return string |
||
114 | * @throws \PSFS\base\exception\FormException |
||
115 | */ |
||
116 | public function postLogin($route = null) |
||
151 | } |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.