function isValidPermitString($permit) { $permit_funcs = fetchPermissionValidators(); $permit_arr = parsePermitString($permit); foreach ($permit_arr as $p) { $name = $p['name']; if (!isset($permit_funcs[$name])) { addAlert("danger", "I'm sorry, the permission validator {$name} does not exist."); return false; } } return true; }
function loadPermissionValidators() { // This block automatically checks this action against the permissions database before running. if (!checkActionPermissionSelf(__FUNCTION__, func_get_args())) { addAlert("danger", "Sorry, you do not have permission to access this resource."); return false; } return fetchPermissionValidators(); }