This PR introduces several improvements to the UserController and PostController to enhance security and data access control. It includes the implementation of Laravel policies for user access and refactoring of methods to leverage these policies.
Changes Made
Added Laravel policies for User and Post models: Created UserPolicyand PostPolicy to handle authorization logic.
Refactored UserControllerand PostController: Updated methods to use policies for access control.
Motivation
For better control over user and post access, policies are now used to centralize and standardize authorization checks. This improves security by ensuring that access permissions are consistently applied and reduces code duplication.
Description
This PR introduces several improvements to the UserController and PostController to enhance security and data access control. It includes the implementation of Laravel policies for user access and refactoring of methods to leverage these policies.
Changes Made
UserPolicy
andPostPolicy
to handle authorization logic.UserController
andPostController
: Updated methods to use policies for access control.Motivation
For better control over user and post access, policies are now used to centralize and standardize authorization checks. This improves security by ensuring that access permissions are consistently applied and reduces code duplication.