mirror of
https://github.com/friendica/friendica
synced 2025-04-24 01:10:11 +00:00
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
|
@ -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'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue