[ [ 'pattern' => 'kp/kangaworld/v1', 'method' => 'POST', 'action' => function() { $response = array(); $response['result'] = 'false'; $response['reason'] = 'Unknown error.'; // Although Kirby only allows admins this far, we may have a //configurable sub-role for API access later. if (kirby()->user()->role()->id() == 'admin') { switch (get('command')) { case 'USER_CREATE': kpApiUserCreate(get('name'), get('email'), get('password'), $response); break; case 'USER_GET': kpApiUserGet(get('email'), $response); break; default: $response['reason'] = 'Invalid command.'; break; } } else { $response['reason'] = 'Unauthorized.'; } return $response; } ] ] ]; ?>