From 2090086975847e7680a72675aa147dd30f125b18 Mon Sep 17 00:00:00 2001 From: velz Date: Thu, 20 Sep 2018 18:10:22 +0530 Subject: [PATCH] PRESIGNED URL FOR USR_MGMT --- .../Entity_Management_Controller.php | 2 +- .../models/User_Management_Model.php | 41 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 36e76147..ce18cc2f 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -67,7 +67,7 @@ class Entity_Management_Controller extends REST_Controller { if($entity_id != '' || $entity_id != null) { - if($entity['fk_entity_type_id'] == 2)// If New Entity is Lender(2) type then create a S3 bucket. + if($entity['fk_entity_type_id'] == 2)// If New Entity is Lender(2) type, then create a S3 bucket for corresponding lender. { $bucket_name = 'lender'.$entity_id; $bucket_status = $this->aws_s3->createNewBucket($bucket_name); diff --git a/api/application/models/User_Management_Model.php b/api/application/models/User_Management_Model.php index cba504da..8d2a9771 100644 --- a/api/application/models/User_Management_Model.php +++ b/api/application/models/User_Management_Model.php @@ -32,26 +32,29 @@ class User_Management_Model extends SPARQ_Model { $result = $this->db->get()->result_array(); - - if($result['profilepic'] != '' || $result['profilepic'] != null) + + foreach($result as $key => $pics) { - $profilepics3path = ''; - if($result['fk_entity_id'] == 1) //1 means sine_edge Profile - { - $profilepics3path = 'sineedge/'.$result['profilepic']; - } - else if($result['fk_entity_id'] == 2)//1 means lender Profile - { - $profilepics3path = 'lender/'.$result['profilepic']; - } - else // else or 3 means vendor Profile - { - $profilepics3path = 'vendor/'.$result['profilepic']; - } - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 mintues'); - - $result['profilepic_singed_url'] = $singed_uri; - + if($pics['profilepic'] != '' || $pics['profilepic'] != null) + { + $profilepics3path = ''; + if($pics['fk_entity_id'] == 1) //1 means sine_edge Profile + { + $profilepics3path = 'sineedge/'.$pics['profilepic']; + } + else if($pics['fk_entity_id'] == 2)//1 means lender Profile + { + $profilepics3path = 'lender/'.$pics['profilepic']; + } + else // else or 3 means vendor Profile + { + $profilepics3path = 'vendor/'.$pics['profilepic']; + } + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 minutes'); + + $result[$key]['profilepic_singed_url'] = $singed_uri; + + } } if($result != '' ){