Checking if the user can actually create new posts, seems the base DataHandlerExtension doesn't do this. Also forgot to update documentation!
This commit is contained in:
parent
6a4031dfd5
commit
095f743d57
@ -377,6 +377,7 @@ class OuroborosAPI extends Extension
|
||||
if ($this->match('create')) {
|
||||
// Create
|
||||
// @TODO Should move the validation logic into OuroborosPost instead?
|
||||
if($user->can("create_image")) {
|
||||
$post = array(
|
||||
'tags' => !empty($_REQUEST['post']['tags']) ? filter_var($_REQUEST['post']['tags'], FILTER_SANITIZE_STRING) : 'tagme',
|
||||
'file' => !empty($_REQUEST['post']['file']) ? filter_var($_REQUEST['post']['file'], FILTER_UNSAFE_RAW) : null,
|
||||
@ -391,6 +392,11 @@ class OuroborosAPI extends Extension
|
||||
$md5 = !empty($_REQUEST['md5']) ? filter_var($_REQUEST['md5'], FILTER_SANITIZE_STRING) : null;
|
||||
$this->postCreate(new OuroborosPost($post), $md5);
|
||||
}
|
||||
else {
|
||||
$this->sendResponse(403, 'You cannot create new posts');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($this->match('update')) {
|
||||
// Update
|
||||
//@todo add post update
|
||||
|
Loading…
x
Reference in New Issue
Block a user