by madeuptempacct · 8y ago · 0 comments
In my CMS, I had support for granular permissions. So you could do this:
if ($user->can('update')) {
if ($postData) {
$this->processUpdate($postData);
}
// display edit form
} elseif ($user->can('read')) {
// read-only
} else {
return error_403_condition();
}
JWT wouldn't have helped much.The auth service/query is higher per-request overhead, but it also keeps things simple. And simple is what you want unless you're dealing with ridiculous scale.
Also, why can't you make the database request in the request pipeline, right before that "if(hasAccess)" statement. You don't need JWT for this...
You are already wrapping all of your controllers...
Pretty sure most frameworks have a way to structure your code for permission checking.