(SOLVED) API Server / User Relation

worldofpcgames46668

Member
YetiShare User
YetiShare Supporter
Jul 28, 2017
99
20
8
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
2,043
108
63
Hi,

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

Thanks,
Adam.
 

worldofpcgames46668

Member
YetiShare User
YetiShare Supporter
Jul 28, 2017
99
20
8
Hi Adam thanks for replying please give it a look and give me a fix for this now, as the next release will take sometime. Thanks a lot :) ;)
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
:) No sorry, it would be reviewed as part of the next release. You would need to wait until then.
 

worldofpcgames46668

Member
YetiShare User
YetiShare Supporter
Jul 28, 2017
99
20
8
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:

worldofpcgames46668

Member
YetiShare User
YetiShare Supporter
Jul 28, 2017
99
20
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();