-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create event * Add button url * Fix url * Secure backend from unauthorised changes * logic for admin to delete comments * lint * pencil is not displayed for admin * cleaned update opinion method on backend * Fix unnecessary commits and cs * Fix DataImporter.php * Added policies * Added validation and fixed policy * change policy to bool * Change policy logic * fix updating opinion * Fix policy --------- Co-authored-by: JakubKermes <[email protected]> Co-authored-by: zmigroo <[email protected]>
- Loading branch information
1 parent
911b999
commit 39e2e60
Showing
7 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Policies; | ||
|
||
use App\Models\CityOpinion; | ||
use App\Models\User; | ||
|
||
class CityOpinionPolicy | ||
{ | ||
public function update(User $user, CityOpinion $cityOpinion): bool | ||
{ | ||
return $cityOpinion->user_id === $user->id; | ||
} | ||
|
||
public function delete(User $user, CityOpinion $cityOpinion): bool | ||
{ | ||
return $cityOpinion->user_id === $user->id || $user->hasRole("admin"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters