Skip to content

Commit

Permalink
Merge pull request #1139 from dbarzin/dev
Browse files Browse the repository at this point in the history
fix bug in access rights
  • Loading branch information
dbarzin authored Feb 27, 2025
2 parents dd5461e + 624cdab commit d1eb03d
Show file tree
Hide file tree
Showing 8 changed files with 2,490 additions and 1,896 deletions.
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Changements prévus en 2025 :
- [o] Ajouter des champs personnalisés aux objets de la cartographie
- [ ] Générer un annuaire de crise
- [ ] Identifier les chemins critiques
- [ ] Exploiter les logs - recherche et afficher tout les changements d'un objet
- [ ] Utiliser des [Accessor pour les Model](https://laravel.com/docs/9.x/eloquent-mutators#defining-a-mutator)
- [ ] Généraliser la notion de cartographe à d'autres objets (cf.: https://laravel.com/docs/10.x/authorization)
- [ ] Générer les cartographes dans la gestion des utilisateurs
Expand Down Expand Up @@ -40,6 +39,7 @@ Changements réalisés en 2024 :
- [x] Améliorer la recherche des CVE en assignat un CPE [Common Plateform Enumeration](https://nvd.nist.gov/products/cpe) aux objets de la cartographie.
- [x] Pouvoir changer les images des objets
- [x] Upgrade to [Bootstrap 5.3](https://getbootstrap.com/)
- [x] Exploiter les logs - recherche et afficher tout les changements d'un objet

## Evolutions mineurs

Expand Down
10 changes: 5 additions & 5 deletions app/Http/Controllers/API/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ApplicationController extends Controller
{
public function index()
{
abort_if(Gate::denies('application_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$applications = MApplication::all();

Expand All @@ -23,7 +23,7 @@ public function index()

public function store(StoreApplicationRequest $request)
{
abort_if(Gate::denies('application_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$application = MApplication::create($request->all());
$application->entities()->sync($request->input('entities', []));
Expand All @@ -37,14 +37,14 @@ public function store(StoreApplicationRequest $request)

public function show(MApplication $application)
{
abort_if(Gate::denies('application_show'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_show'), Response::HTTP_FORBIDDEN, '403 Forbidden');

return new ApplicationResource($application);
}

public function update(UpdateApplicationRequest $request, MApplication $application)
{
abort_if(Gate::denies('application_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$application->update($request->all());
$application->entities()->sync($request->input('entities', []));
Expand All @@ -58,7 +58,7 @@ public function update(UpdateApplicationRequest $request, MApplication $applicat

public function destroy(MApplication $application)
{
abort_if(Gate::denies('application_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');

$application->delete();

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/MassDestroyApplicationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MassDestroyApplicationRequest extends FormRequest
{
public function authorize()
{
abort_if(Gate::denies('application_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/StoreApplicationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class StoreApplicationRequest extends FormRequest
{
public function authorize()
{
abort_if(Gate::denies('application_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/UpdateApplicationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class UpdateApplicationRequest extends FormRequest
{
public function authorize()
{
abort_if(Gate::denies('application_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('m_application_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');

return true;
}
Expand Down
Loading

0 comments on commit d1eb03d

Please sign in to comment.