@@ -67,16 +67,17 @@ function get_iam_username(requested_account_name) {
6767}
6868
6969/**
70- * _create_detailed_message_for_access_in_s3 returns a detailed message with details needed for user who
70+ * _create_detailed_message_for_iam_user_access_in_s3 returns a detailed message with details needed for user who
7171 * tried to perform S3 operation
7272 * - resource_arn is only relevant for operations related to a bucket
73- * @param {object } requesting_account
73+ * @param {object } user_account
7474 * @param {string|string[] } method
7575 * @param {string } resource_arn
7676 */
77- function _create_detailed_message_for_access_in_s3 ( requesting_account , method , resource_arn ) {
78- const arn_for_requesting_account = create_arn_for_user ( requesting_account . owner ,
79- get_iam_username ( requesting_account . name . unwrap ( ) ) , requesting_account . iam_path ) ;
77+ function _create_detailed_message_for_iam_user_access_in_s3 ( user_account , method , resource_arn ) {
78+ const owner_account_id = get_owner_account_id ( user_account ) ;
79+ const arn_for_requesting_account = create_arn_for_user ( owner_account_id ,
80+ get_iam_username ( user_account . name . unwrap ( ) ) , user_account . iam_path ) ;
8081 const full_action_name = Array . isArray ( method ) && method . length > 1 ? method [ 1 ] : method ; // special case for get_object_attributes
8182
8283 const message_start = `User: ${ arn_for_requesting_account } is not authorized to perform: ${ full_action_name } ` ;
@@ -878,5 +879,5 @@ exports.validate_tag_user_params = validate_tag_user_params;
878879exports . validate_untag_user_params = validate_untag_user_params ;
879880exports . validate_list_user_tags_params = validate_list_user_tags_params ;
880881exports . get_owner_account_id = get_owner_account_id ;
881- exports . _create_detailed_message_for_access_in_s3 = _create_detailed_message_for_access_in_s3 ;
882+ exports . _create_detailed_message_for_iam_user_access_in_s3 = _create_detailed_message_for_iam_user_access_in_s3 ;
882883
0 commit comments