@@ -12,6 +12,7 @@ const s3_logging = require('./s3_bucket_logging');
1212const time_utils = require ( '../../util/time_utils' ) ;
1313const http_utils = require ( '../../util/http_utils' ) ;
1414const signature_utils = require ( '../../util/signature_utils' ) ;
15+ const iam_utils = require ( '../../endpoint/iam/iam_utils' ) ;
1516const config = require ( '../../../config' ) ;
1617const s3_utils = require ( './s3_utils' ) ;
1718
@@ -254,6 +255,8 @@ async function authorize_request_policy(req) {
254255 const account = req . object_sdk . requesting_account ;
255256 const account_identifier_name = req . object_sdk . nsfs_config_root ? account . name . unwrap ( ) : account . email . unwrap ( ) ;
256257 const account_identifier_id = req . object_sdk . nsfs_config_root ? account . _id : undefined ;
258+ const arn = account . owner ? iam_utils . create_arn_for_user ( account . owner , account . name . unwrap ( ) . split ( ':' ) [ 0 ] , account . iam_path ) :
259+ iam_utils . create_arn_for_account ( account . _id ) ;
257260
258261 // deny delete_bucket permissions from bucket_claim_owner accounts (accounts that were created by OBC from openshift\k8s)
259262 // the OBC bucket can still be delete by normal accounts according to the access policy which is checked below
@@ -304,9 +307,9 @@ async function authorize_request_policy(req) {
304307 }
305308 if ( permission_by_id === "DENY" ) throw new S3Error ( S3Error . AccessDenied ) ;
306309
307- if ( ( ! account_identifier_id || permission_by_id !== "DENY" ) && account . owner === undefined ) {
310+ if ( ! account_identifier_id || permission_by_id !== "DENY" ) {
308311 permission_by_name = await s3_bucket_policy_utils . has_bucket_policy_permission (
309- s3_policy , account_identifier_name , method , arn_path , req , public_access_block ?. restrict_public_buckets
312+ s3_policy , arn , method , arn_path , req , public_access_block ?. restrict_public_buckets
310313 ) ;
311314 dbg . log3 ( 'authorize_request_policy: permission_by_name' , permission_by_name ) ;
312315 }
0 commit comments