-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibilities of having S3 credentials under A post type for every User? #518
Comments
@Boby you could conditionally set the S3_UPLOADS constants to user-specific values perhaps. This would look something like: add_action( 'plugins_loaded', function () {
if ( $_SERVER['REQUEST_URI'] === '/wp-admin/async-upload.php' && isset( $_POST['post_id'] ) ) {
$access_key = get_post_meta( intval( $_POST['post_id'] ), 'aws_acces_key', true );
define( 'S3_UPLOAD_ACCESS_KEY', $access_key );
}
}, 9 ); // hook in before S3 Uploads is loaded Or something along those lines. Doing it dynamically for S3-Uploads call (like if you needed to upload multiple images from different users in the same request), then that would be a little more tricky. |
okay what I understand if we defined the key again to we need to ->get instance again? and setup? @joehoyle |
@joehoyle What if I wanted to support multiple S3 endpoints, each with its own credentials, to store multiple files (say, files from 2021 are stored in one bucket, 2022 in a new one), and then the code needs to access some files from 2021 and 2022? As you said, dynamic would be a little more tricky, but what is the direction you'd recommend going in? Perhaps there could be official support added for multi-endpoint feature? I imagine it could be a relatively common feature request. Thanks. |
We do not intend to add support for this, as we do not use or need this functionality. See our support policy: https://engineering.hmn.md/projects/support/ You're welcome to fork S3 Uploads and add the functionality to your own plugin though :) |
Hi,
I am trying to break down user to use credentials based on the post(each post will have each own secret key), and when user tries to upload it will reinit the instance with new credentials,
Does that means a rewrite or I can hook the _init and check based on postid?
thanks
The text was updated successfully, but these errors were encountered: