refactor(auth): replace myth/auth with codeigniter/shield + define new roles

closes #222
This commit is contained in:
Yassine Doghri 2022-10-15 11:22:08 +00:00
commit c1287cbe6c
213 changed files with 3366 additions and 3204 deletions

View file

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Modules\Auth\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RedirectResponse;
/**
* Class ActionController
*
* A generic controller to handle Authentication Actions.
*/
class InteractController extends Controller
{
public function attemptInteractAsActor(): RedirectResponse
{
$rules = [
'actor_id' => 'required|numeric',
];
if (! $this->validate($rules)) {
return redirect()
->back()
->withInput()
->with('errors', service('validation')->getErrors());
}
helper('auth');
set_interact_as_actor((int) $this->request->getPost('actor_id'));
return redirect()->back();
}
}