You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on top of a yet-to-be-created authentication layer, the REST APIs should support authorization: limiting certain methods to authenticated users and their roles
Basic idea
useweb\Response;
#[@require(['admin'])]
class Administration {
/** Deletes a URL by a given ID */
#[@delete('/{id}')]
publicfunctiondelete(string$id): Response {
// ...
}
}
The require annotation makes the surrounding layer perform checks on the authenticated user. By annotating the containing class all its methods will be affected.
@require(['admin']) - requires the user to be in the admin role
@require(['admin', 'user']) - requires the user to be in the adminoruser role
@require(function($user) { ... }) - runs a user-defined function on the user. Allows access if function returns true.
The text was updated successfully, but these errors were encountered:
Based on top of a yet-to-be-created authentication layer, the REST APIs should support authorization: limiting certain methods to authenticated users and their roles
Basic idea
The
require
annotation makes the surrounding layer perform checks on the authenticated user. By annotating the containing class all its methods will be affected.@require(['admin'])
- requires the user to be in the admin role@require(['admin', 'user'])
- requires the user to be in the admin or user role@require(function($user) { ... })
- runs a user-defined function on the user. Allows access if function returns true.The text was updated successfully, but these errors were encountered: