Also, the try/catch block there is for the Authentication->GetCurrentUser() call, since I'm coding to PHP 7.0+, and there's no nullable return type (function foo(): ?bar{} ), so I'm throwing a custom exception to indicate when there is no current user.
Some may complain, saying that a user not being logged in isn't exceptional... But personally, I consider code that doesn't think to handle cases where there are no logged in users to be objectionable, and I'm happy throwing at them
PHP code block Show more
Yep, that's a copy/paste of my live code to decide whether to display the admin bar or not.
(Uses Transphporm as the templating system.. Basically "TSS" is to XML structure and display on a pre-render basis as CSS is to HTML on a pre-display basis.)
Anyways, plugins will need to register which permissions they'll watch out for when the plugin's install script is ran... but that's a few sprints away.
(Side note: I'm not actually using an agile process, just using common jargon.)