gcgov / framework-service-user-crud
Implement standard CRUD routes to manage the user collection. Even if your app doesn't provide a custom user model (`\app\models\user`), your auth or database service may provide you with a standard user model that implements (`\gcgov\framework\interfaces\auth\user`).
Package info
github.com/gcgov/framework-service-user-crud
Type:framework-service
pkg:composer/gcgov/framework-service-user-crud
v1.0.3
2023-08-07 15:35 UTC
Requires
- php: >=8.1
This package is auto-updated.
Last update: 2026-03-07 21:10:33 UTC
README
Service to extend gcgov/framework
Primary purpose
- Implement standard CRUD routes to manage the user collection. Even if your app doesn't provide a custom user
model (
\app\models\user), your auth or database service may provide you with a standard user model that implements (\gcgov\framework\interfaces\auth\user).
User Model Standard and Customization
- The class fully qualified domain name returned by
\gcgov\framework\services\request::getUserClassFqdn()shall be used to select the correct user model for purposes of authentication services and the user crud service. The class returned byrequest::getUserClassFqdnmust implement\gcgov\framework\interfaces\auth\user. It will return the first class available in this list, in order.\app\models\user- Database provider user model
\gcgov\framework\services\mongodb\models\auth\user
Impact to application
- Router
- User Routes Adds standard CRUD user controller that will interface with the application's user model.
- Adds route
/user- GET all users; Required Roles:User.Read - Adds route
/user/{id}- GET one user by id or 'new'; Required Roles:User.Read - Adds route
/user/{id}- POST save user; Required Roles:User.Read,User.Write - Adds route
/user/{id}- DELETE user; Required Roles:User.Read,User.Write
- Adds route
- Adds authentication guard
- All routes in app with authentication=true will be guarded by this guard. The HTTP Authorization header is required and it's access token is validated by the jwt service.
- Provided user routes require authentication and
User.Read/User.Writeroles.
- User Routes Adds standard CRUD user controller that will interface with the application's user model.
Installation:
- Require using Composer https://packagist.org/packages/gcgov/framework-service-user-crud
- Add namespace
\gcgov\framework\services\usercrudto\app\app->registerFrameworkServiceNamespaces()