[CONTROLLER][Note] Respect note scope
This commit is contained in:
parent
d891089945
commit
fec1861b80
@ -26,6 +26,7 @@ namespace App\Controller;
|
|||||||
use App\Core\Controller;
|
use App\Core\Controller;
|
||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use function App\Core\I18n\_m;
|
use function App\Core\I18n\_m;
|
||||||
|
use App\Util\Common;
|
||||||
use App\Util\Exception\ClientException;
|
use App\Util\Exception\ClientException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
@ -40,7 +41,11 @@ class Note extends Controller
|
|||||||
if (empty($note)) {
|
if (empty($note)) {
|
||||||
throw new ClientException(_m('No such note.'), 404);
|
throw new ClientException(_m('No such note.'), 404);
|
||||||
} else {
|
} else {
|
||||||
|
if ($note->isVisibleTo(Common::actor())) {
|
||||||
return $handle($note);
|
return $handle($note);
|
||||||
|
} else {
|
||||||
|
throw new ClientException(_m('You don\'t have permissions to view this note.'), 401);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user