Use "checkAllowedScope" instead of "login"
This commit is contained in:
parent
5853fe562d
commit
2a440c0bae
54 changed files with 62 additions and 73 deletions
|
@ -35,7 +35,7 @@ class Index extends BaseApi
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Show extends BaseApi
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
// retrieve general information about profiles for user
|
// retrieve general information about profiles for user
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Block extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Follow extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Followers extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Following extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class IdentityProofs extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
|
|
||||||
System::jsonExit([]);
|
System::jsonExit([]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Lists extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Mute extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Note extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Relationships extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Search extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Unblock extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Unfollow extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Unmute extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class UpdateCredentials extends BaseApi
|
||||||
{
|
{
|
||||||
public static function patch(array $parameters = [])
|
public static function patch(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$data = HTTPInputData::process();
|
$data = HTTPInputData::process();
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VerifyCredentials extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$self = User::getOwnerDataById($uid);
|
$self = User::getOwnerDataById($uid);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Announcements extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
|
|
||||||
// @todo Possibly use the message from the pageheader addon for this
|
// @todo Possibly use the message from the pageheader addon for this
|
||||||
System::jsonExit([]);
|
System::jsonExit([]);
|
||||||
|
|
|
@ -32,7 +32,7 @@ class VerifyCredentials extends BaseApi
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$application = self::getCurrentApplication();
|
$application = self::getCurrentApplication();
|
||||||
|
|
||||||
if (empty($application['id'])) {
|
if (empty($application['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Blocks extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Bookmarks extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Conversations extends BaseApi
|
||||||
{
|
{
|
||||||
public static function delete(array $parameters = [])
|
public static function delete(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (!empty($parameters['id'])) {
|
if (!empty($parameters['id'])) {
|
||||||
|
@ -52,7 +52,7 @@ class Conversations extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Read extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (!empty($parameters['id'])) {
|
if (!empty($parameters['id'])) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Favourited extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
// @todo provide HTTP link header
|
// @todo provide HTTP link header
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Filters extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
|
|
||||||
self::unsupported('post');
|
self::unsupported('post');
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class Filters extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
|
|
||||||
System::jsonExit([]);
|
System::jsonExit([]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class FollowRequests extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$introduction = DI::intro()->selectFirst(['id' => $parameters['id'], 'uid' => $uid]);
|
$introduction = DI::intro()->selectFirst(['id' => $parameters['id'], 'uid' => $uid]);
|
||||||
|
@ -83,7 +83,7 @@ class FollowRequests extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Lists extends BaseApi
|
||||||
{
|
{
|
||||||
public static function delete(array $parameters = [])
|
public static function delete(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
@ -53,7 +53,7 @@ class Lists extends BaseApi
|
||||||
|
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
@ -94,7 +94,7 @@ class Lists extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Accounts extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Markers extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
|
|
||||||
self::unsupported('post');
|
self::unsupported('post');
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class Markers extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
|
|
||||||
System::jsonExit([]);
|
System::jsonExit([]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Media extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
Logger::info('Photo post', ['request' => $_REQUEST, 'files' => $_FILES]);
|
Logger::info('Photo post', ['request' => $_REQUEST, 'files' => $_FILES]);
|
||||||
|
@ -55,7 +55,7 @@ class Media extends BaseApi
|
||||||
|
|
||||||
public static function put(array $parameters = [])
|
public static function put(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
@ -85,7 +85,7 @@ class Media extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Mutes extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Notifications extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (!empty($parameters['id'])) {
|
if (!empty($parameters['id'])) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Clear extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
DBA::update('notification', ['seen' => true], ['uid' => $uid]);
|
DBA::update('notification', ['seen' => true], ['uid' => $uid]);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Dismiss extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Preferences extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$user = User::getById($uid, ['language', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
|
$user = User::getById($uid, ['language', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Search extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Statuses extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
@ -194,7 +194,7 @@ class Statuses extends BaseApi
|
||||||
|
|
||||||
public static function delete(array $parameters = [])
|
public static function delete(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Bookmark extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Favourite extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Mute extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Pin extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Reblog extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Unbookmark extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Unfavourite extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Unmute extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Unpin extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Unreblog extends BaseApi
|
||||||
{
|
{
|
||||||
public static function post(array $parameters = [])
|
public static function post(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Suggestions extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Direct extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Home extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ListTimeline extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['id'])) {
|
if (empty($parameters['id'])) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Tag extends BaseApi
|
||||||
*/
|
*/
|
||||||
public static function rawContent(array $parameters = [])
|
public static function rawContent(array $parameters = [])
|
||||||
{
|
{
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($parameters['hashtag'])) {
|
if (empty($parameters['hashtag'])) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ abstract class ContactEndpoint extends BaseApi
|
||||||
{
|
{
|
||||||
parent::init($parameters);
|
parent::init($parameters);
|
||||||
|
|
||||||
self::login(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -168,17 +168,6 @@ class BaseApi extends BaseModule
|
||||||
return $request;
|
return $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use checkAllowedScope instead
|
|
||||||
* Log in user via OAuth or Basic HTTP Auth.
|
|
||||||
*
|
|
||||||
* @param string $scope the requested scope (read, write, follow)
|
|
||||||
*/
|
|
||||||
protected static function login(string $scope)
|
|
||||||
{
|
|
||||||
self::checkAllowedScope($scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current application token
|
* Get current application token
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue