It would be so nice if one could merely do something like
$modx->addPermission("content", "Image upload", 0);
to add a new "Image upload" permission to the "Content Management" group with a default of 0 (no).
Then you could check it in the code:
if ($modx->hasPermission("content", "Image upload")) { ... };
Using a system similiar to this, a snippet could register a new permission right during install, along with a default state, and it would autoregister in all roles.
Does this make sense to anyone other than me?
Sounds great!
So I think it should be $modx->addPermission($category,$permCode,$description,$default);
e.g.
$modx->addPermission("Content Roles","image_upload","Image Upload",0);
if ($modx->hasPermission("image_upload")) {
/// do stuff
}
or maybe
if ($modx->hasPermission(array("image_upload","file_upload"))) {
// do stuff
}