Revoking S3 access keys in WHMCS
You can revoke the specified access key pair of the specified user with the ostor-users
service and the following parameters: emailAddress
specifying the user email address, revokeKey
specifying the access key in the key pair. WHMCS removes the key pair when you click Revoke Access Key. Create a file S3_revokeAccessKey.php with the following contents:
<?php // Load configuration and libraries. require('../../includes/staas_scripts/S3_delClientNote.php'); require('../../includes/staas_scripts/S3_getClient.php'); require('../../includes/staas_scripts/S3_getConfig.php'); require('../../includes/staas_scripts/S3_requestCurl.php'); require('../../init.php'); // Revoke s3 access key pair. function S3_revokeAccessKey($userid) { // Load configuration. $s3_config = s3_getConfig(); // Get whmcs user email. $s3_whmcs = S3_getClient($userid, $s3_config['whmcs_username']); // Get first s3 access key. $s3_client = S3_requestCurl( $s3_config['s3_key'], $s3_config['s3_secret'], $s3_config['s3_gateway'], "/?ostor-users&emailAddress=" . $s3_whmcs['email'], "GET" ); // Revoke s3 access key. S3_requestCurl( $s3_config['s3_key'], $s3_config['s3_secret'], $s3_config['s3_gateway'], "/?ostor-users&emailAddress=" . $s3_whmcs['email'] . "&revokeKey=" . $s3_client['AWSAccessKeys']['0']['AWSAccessKeyId'], "POST" ); // Delete note with the s3 access key and s3 secret. S3_delClientNote( $s3_whmcs['userid'], $s3_config['whmcs_username'], $s3_client['UserId'], $s3_client['AWSAccessKeys']['0']['AWSAccessKeyId'] ); // Redirect back. header('Location: ' . $_SERVER['HTTP_REFERER']); } // Call function. S3_revokeAccessKey($_GET['userid']); ?>