(SOLVED) API Server / User Relation

worldofpcgames46668

Member
YetiShare User
Jul 28, 2017
44
9
8
#1
Hi adam, i would like to request a change. The user account changes does not override the site settings in the API.

Example: In the site settings i have set the default uploads to File Server 4, but i have assigned File Server 5 to a specific user,

But when using the API to upload the files, it follows the sites rule and uploads files in File Server 4 isntead of 5. I hope you can fix this in the upcoming update and tell me a quick fix now so that i can help my users.
 

adam

Administrator
Staff member
Dec 5, 2009
1,722
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#4
Hi,

I'd agree it should match. I'll look into fixing it for the next release.

Thanks,
Adam.
 

adam

Administrator
Staff member
Dec 5, 2009
1,722
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#6
:) No sorry, it would be reviewed as part of the next release. You would need to wait until then.
 

worldofpcgames46668

Member
YetiShare User
Jul 28, 2017
44
9
8
#7
Okay Adam no problem i will wait for the release, i have replaced core\includes\api\v2\endpoint/file.api.php

Code:
 $url = file::getUploadUrl() . '/core/page/ajax/api_upload_handler.ajax.php';
With

Code:
$Auth->impersonate($username);
        $url = file::getUploadUrl() . '/core/page/ajax/api_upload_handler.ajax.php';
        $Auth->logout();
Would this work?

Edit: NOT WORKING
 
Last edited:
Jul 28, 2017
44
9
8
#8
To fix the issue, simply go to /core/includes/api/v2/endpoint/file.api.php and replace the following with

Code:
$url = file::getUploadUrl() . '/core/page/ajax/api_upload_handler.ajax.php';
With


Code:
 $Auth = Auth::getAuth();
        $Auth->impersonate($username);
        $url = file::getUploadUrl() . '/core/page/ajax/api_upload_handler.ajax.php';
        $Auth->logout();