Make BaseApi->checkAllowedScope into an object method
- It isn't called from static contexts anymore
This commit is contained in:
parent
f70a64891c
commit
9e71610711
131 changed files with 152 additions and 152 deletions
|
|
@ -45,7 +45,7 @@ class Inbox extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
$page = $request['page'] ?? null;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Outbox extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
$postdata = Network::postdata();
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Whoami extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Activity extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Create extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Delete extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Show extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Update extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Search extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Setseen extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Create extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Delete extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Index extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Notification extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$Notifies = DI::notify()->selectAllForUser($uid, 50);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Seen extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (DI::args()->getArgc() !== 4) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Photo extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Create extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Lists extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Update extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Delete extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Index extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$albums = Photo::getAlbums($uid);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Show extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$type = $this->getRequestValue($this->parameters, 'extension', 'json');
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Update extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Show extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
// retrieve general information about profiles for user
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Dislike extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Undislike extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Conversation extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Block extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class FeaturedTags extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
|
||||
$this->jsonExit([]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Follow extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Followers extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Following extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class IdentityProofs extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
|
||||
$this->jsonExit([]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Lists extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Mute extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Note extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Relationships extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Search extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Unblock extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Unfollow extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Unmute extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class UpdateCredentials extends BaseApi
|
|||
{
|
||||
protected function patch(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class VerifyCredentials extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$self = User::getOwnerDataById($uid);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Announcements extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
|
||||
// @todo Possibly use the message from the pageheader addon for this
|
||||
$this->jsonExit([]);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class VerifyCredentials extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
if (empty($application['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Blocks extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Bookmarks extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Conversations extends BaseApi
|
|||
{
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (!empty($this->parameters['id'])) {
|
||||
|
|
@ -51,7 +51,7 @@ class Conversations extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Read extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (!empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Favourited extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Filters extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$this->response->unsupported(Router::POST, $request);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ class Filters extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
|
||||
$this->jsonExit([]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class FollowRequests extends BaseApi
|
|||
*/
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
|
||||
|
|
@ -89,7 +89,7 @@ class FollowRequests extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class FollowedTags extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Lists extends BaseApi
|
|||
{
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
@ -53,7 +53,7 @@ class Lists extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
@ -93,7 +93,7 @@ class Lists extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Accounts extends BaseApi
|
|||
{
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$request = $this->getRequest([
|
||||
'account_ids' => [], // Array of account IDs to remove from the list
|
||||
|
|
@ -51,7 +51,7 @@ class Accounts extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$request = $this->getRequest([
|
||||
'account_ids' => [], // Array of account IDs to add to the list
|
||||
|
|
@ -69,7 +69,7 @@ class Accounts extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Markers extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ class Markers extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Media extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
@ -63,7 +63,7 @@ class Media extends BaseApi
|
|||
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
@ -100,7 +100,7 @@ class Media extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Mutes extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Notifications extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (!empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Clear extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
DI::notification()->setAllDismissedForUser($uid);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Dismiss extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Preferences extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$user = User::getById($uid, ['language', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class PushSubscription extends BaseApi
|
|||
|
||||
protected function post(array $request = []): void
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$this->checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class PushSubscription extends BaseApi
|
|||
|
||||
public function put(array $request = []): void
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$this->checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class PushSubscription extends BaseApi
|
|||
|
||||
protected function delete(array $request = []): void
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$this->checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ class PushSubscription extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = []): void
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$this->checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
$application = self::getCurrentApplication();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class Reports extends BaseApi
|
|||
|
||||
public function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$request = $this->getRequest([
|
||||
'account_id' => '', // ID of the account to report
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ScheduledStatuses extends BaseApi
|
|||
{
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$this->response->unsupported(Router::PUT, $request);
|
||||
|
|
@ -43,7 +43,7 @@ class ScheduledStatuses extends BaseApi
|
|||
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
@ -64,7 +64,7 @@ class ScheduledStatuses extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (isset($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class Search extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Statuses extends BaseApi
|
|||
{
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
@ -164,7 +164,7 @@ class Statuses extends BaseApi
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
@ -315,7 +315,7 @@ class Statuses extends BaseApi
|
|||
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Bookmark extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Favourite extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Mute extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Pin extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Reblog extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Source extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Unbookmark extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Unfavourite extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Unmute extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Unpin extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Unreblog extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Suggestions extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Tags extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['hashtag'])) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Follow extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['hashtag'])) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Unfollow extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['hashtag'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Direct extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Home extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$request = $this->getRequest([
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class ListTimeline extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Tag extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['hashtag'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class UpdateProfile extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$api_user = DI::twitterUser()->createFromUserId($uid, true)->toArray();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class UpdateProfileImage extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// get mediadata from image or media (Twitter call api/account/update_profile_image provides image)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class VerifyCredentials extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$skip_status = $this->getRequestValue($request, 'skip_status', false);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Ids extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Lists extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ abstract class ContactEndpoint extends BaseApi
|
|||
{
|
||||
parent::__construct($errorFactory, $app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class All extends DirectMessagesEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$this->getMessages($request, $uid, []);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Conversation extends DirectMessagesEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$this->getMessages($request, $uid, ["`parent-uri` = ?", $this->getRequestValue($request, 'uri', '')]);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Destroy extends BaseApi
|
|||
}
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Inbox extends DirectMessagesEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$pcid = Contact::getPublicIdByUserId($uid);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class NewDM extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (empty($request['text']) || empty($request['screen_name']) && empty($request['user_id'])) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Sent extends DirectMessagesEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
$pcid = Contact::getPublicIdByUserId($uid);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Favorites extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// in friendica starred item are private
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Create extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Destroy extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Ids extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Lists extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Ids extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Lists extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Destroy extends ContactEndpoint
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Incoming extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// Expected value for user_id parameter: public/user contact id
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Show extends ContactEndpoint
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$source_cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'source_screen_name', ''), '', $this->getRequestValue($request, 'source_id', 0), $uid);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class Create extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class Destroy extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Lists extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// This is a dummy endpoint
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Ownership extends BaseApi
|
|||
}
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$circles = $this->dba->select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null]);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Statuses extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (empty($request['list_id'])) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class Update extends BaseApi
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// params
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Create extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$postdata = Network::postdata();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Upload extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_WRITE);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (empty($_FILES['media'])) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class SavedSearches extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$this->checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$terms = DBA::select('search', ['id', 'term'], ['uid' => $uid]);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Tweets extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (empty($request['q'])) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Destroy extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class HomeTimeline extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// get last network messages
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Mentions extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// get last network messages
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class NetworkPublicTimeline extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class PublicTimeline extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
// get last network messages
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Retweet extends BaseApi
|
|||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Show extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$id = $this->getRequestValue($request, 'id', 0);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Update extends BaseApi
|
|||
{
|
||||
public function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class UserTimeline extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $request]);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Lookup extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$users = [];
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Search extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
$userlist = [];
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Show extends BaseApi
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||
$uid = BaseApi::getCurrentUserID();
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class BaseApi extends BaseModule
|
|||
case Router::PATCH:
|
||||
case Router::POST:
|
||||
case Router::PUT:
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$this->checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
if (!self::getCurrentUserID()) {
|
||||
throw new HTTPException\ForbiddenException($this->t('Permission denied.'));
|
||||
|
|
@ -418,22 +418,22 @@ class BaseApi extends BaseModule
|
|||
*
|
||||
* @param string $scope the requested scope (read, write, follow, push)
|
||||
*/
|
||||
public static function checkAllowedScope(string $scope)
|
||||
public function checkAllowedScope(string $scope)
|
||||
{
|
||||
$token = self::getCurrentApplication();
|
||||
|
||||
if (empty($token)) {
|
||||
Logger::notice('Empty application token');
|
||||
$this->logger->notice('Empty application token');
|
||||
DI::mstdnError()->Forbidden();
|
||||
}
|
||||
|
||||
if (!isset($token[$scope])) {
|
||||
Logger::warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]);
|
||||
$this->logger->warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]);
|
||||
DI::mstdnError()->Forbidden();
|
||||
}
|
||||
|
||||
if (empty($token[$scope])) {
|
||||
Logger::warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]);
|
||||
$this->logger->warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]);
|
||||
DI::mstdnError()->Forbidden();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue