SINGED URL AND NEW ENTITY BUCKET CREATION
This commit is contained in:
parent
f11734c681
commit
5a6553232a
@ -86,10 +86,10 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
|
||||
|
||||
// define login route name for token verification
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'login'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfUsers'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILEPICTUREBUCKETNAME') OR define('PROFILEPICTUREBUCKETNAME','sineedgedevprofilepic');
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ class Entity_Management_Controller extends REST_Controller {
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
$this->load->model('Entity_Management_Model');
|
||||
$this->load->library('AWS_S3');
|
||||
|
||||
}
|
||||
|
||||
@ -64,7 +65,15 @@ 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.
|
||||
{
|
||||
$bucket_name = 'lender'.$entity_id;
|
||||
$bucket_status = $this->aws_s3->createNewBucket($bucket_name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($entity_id != '' || $entity_id != null)
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ class User_Management_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$bucketname = PROFILEPICTUREBUCKETNAME;
|
||||
$bucketname = PROFILE_PICTURE_BUCKET_NAME;
|
||||
$key = $profilepics3path;
|
||||
$sourcefile = $profilepic;
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class AWS_S3
|
||||
}
|
||||
|
||||
/* This Function return signed URI of single S3 Object*/
|
||||
public function getSingleObjectInaBucketAsSignedURI($bucket_name,$folder_name)//get as singed url
|
||||
public function getSingleObjectInaBucketAsSignedURI($bucket_name,$folder_name,$time = '+5 minutes')//get as singed url
|
||||
{
|
||||
$result = array();
|
||||
|
||||
@ -95,12 +95,12 @@ class AWS_S3
|
||||
'Key' => $folder_name
|
||||
]);
|
||||
|
||||
$request = $this->S3->createPresignedRequest($cmd, '+60 seconds');
|
||||
$request = $this->S3->createPresignedRequest($cmd, $time);
|
||||
$presignedUrl = (string) $request->getUri();
|
||||
}
|
||||
catch(AwsException $e)
|
||||
{
|
||||
echo $e->getMessage();
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
return $presignedUrl;
|
||||
|
||||
@ -7,6 +7,7 @@ class User_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('AWS_S3');
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +32,29 @@ class User_Management_Model extends SPARQ_Model {
|
||||
|
||||
|
||||
$result = $this->db->get()->result_array();
|
||||
if($result !=''){
|
||||
|
||||
if($result['profilepic'] != '' || $result['profilepic'] != null)
|
||||
{
|
||||
$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($result != '' ){
|
||||
|
||||
foreach($result as $key =>$roles){
|
||||
$role = $this->db->get_where(USERPROFILEROLES.' as USERPROFILEROLES',array('fk_userid'=>$roles['userid'],'isactive'=>1))->result_array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user