diff --git a/api/application/config/api_user_auth_config.php b/api/application/config/api_user_auth_config.php index ddf91640..879e27e8 100644 --- a/api/application/config/api_user_auth_config.php +++ b/api/application/config/api_user_auth_config.php @@ -4,55 +4,61 @@ This Config file has info about api routes and user access information as config array */ -$user_auth_info = array( - -'1' => array('role_name' => 'Central Manager','allowed_api_routes' => array()), -'2' => array('role_name' => 'Central PD Officer','allowed_api_routes' => array()) -'3' => array('role_name' => 'PD Manager','allowed_api_routes' => array()) -'4' => array('role_name' => 'PD Executive','allowed_api_routes' => array()) -'5' => array('role_name' => 'PD Officer','allowed_api_routes' => array()) -'6' => array('role_name' => 'QC Manager','allowed_api_routes' => array()) -'7' => array('role_name' => 'QC Officer','allowed_api_routes' => array()) -'8' => array('role_name' => 'Billing Manager','allowed_api_routes' => array()) -'9' => array('role_name' => 'Billing Staff','allowed_api_routes' => array()) -'10' => array('role_name' => 'System Admin','allowed_api_routes' => array()) -'11' => array('role_name' => 'National Sales Head','allowed_api_routes' => array()) -'12' => array('role_name' => 'National Credit Head','allowed_api_routes' => array()) -'13' => array('role_name' => 'Zonal Sales Head','allowed_api_routes' => array()) -'14' => array('role_name' => 'Zonal Credit Head','allowed_api_routes' => array()) -'15' => array('role_name' => 'Area Sales Head','allowed_api_routes' => array()) -'16' => array('role_name' => 'Area Credit Head','allowed_api_routes' => array()) -'17' => array('role_name' => 'City Sales Head','allowed_api_routes' => array()) -'18' => array('role_name' => 'City Credit Head','allowed_api_routes' => array()) -'19' => array('role_name' => 'Branch Sales','allowed_api_routes' => array()) -'20' => array('role_name' => 'Branch Credit','allowed_api_routes' => array()) -'21' => array('role_name' => 'PD Manager Vendor','allowed_api_routes' => array()) -'22' => array('role_name' => 'PD Officer Vendor','allowed_api_routes' => array()) - -); - -$api_user_auth_info = array( +// $user_auth_info = array( +// '1' => array('role_name' => 'Central Manager','allowed_api_routes' => array()), +// '2' => array('role_name' => 'Central PD Officer','allowed_api_routes' => array()), +// '3' => array('role_name' => 'PD Manager','allowed_api_routes' => array()), +// '4' => array('role_name' => 'PD Executive','allowed_api_routes' => array()), +// '5' => array('role_name' => 'PD Officer','allowed_api_routes' => array()), +// '6' => array('role_name' => 'QC Manager','allowed_api_routes' => array()), +// '7' => array('role_name' => 'QC Officer','allowed_api_routes' => array()), +// '8' => array('role_name' => 'Billing Manager','allowed_api_routes' => array()), +// '9' => array('role_name' => 'Billing Staff','allowed_api_routes' => array()), +// '10' => array('role_name' => 'System Admin','allowed_api_routes' => array()), +// '11' => array('role_name' => 'National Sales Head','allowed_api_routes' => array()), +// '12' => array('role_name' => 'National Credit Head','allowed_api_routes' => array()), +// '13' => array('role_name' => 'Zonal Sales Head','allowed_api_routes' => array()), +// '14' => array('role_name' => 'Zonal Credit Head','allowed_api_routes' => array()), +// '15' => array('role_name' => 'Area Sales Head','allowed_api_routes' => array()), +// '16' => array('role_name' => 'Area Credit Head','allowed_api_routes' => array()), +// '17' => array('role_name' => 'City Sales Head','allowed_api_routes' => array()), +// '18' => array('role_name' => 'City Credit Head','allowed_api_routes' => array()), +// '19' => array('role_name' => 'Branch Sales','allowed_api_routes' => array()), +// '20' => array('role_name' => 'Branch Credit','allowed_api_routes' => array()), +// '21' => array('role_name' => 'PD Manager Vendor','allowed_api_routes' => array()), +// '22' => array('role_name' => 'PD Officer Vendor','allowed_api_routes' => array())); +$config['api_user_auth_info'] = array( 'saveNewUser' => array(10), -'updateExistUser' => array(10),//doubt -'getUsersDetails' => array(), -//PD RELATED -'triggerNewPD' = array(), -'updatePDMaster' = array(), -'(listLessPDDetails/:any)' = array(), -'updatePDDocs' = array(), -'updatePDApplicants' = array(), -'allocatePD' = array(), -'schdulePD' = array(), -'getListPDOfficers' = array(), -'loadFullTemplate' = array(), -'generatePDReport' = array(), -'savePDPhotos' = array(), -'savePDFormDetails' = array(), -//ENTITY -'saveNewEntity' = array(), - - +'updateExistUser' => array(10), +//'getUsersDetails' => array(), +'triggerNewPD' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), +'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), +'updatePDDocs' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), +'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), +'allocatePD' => array(2,3,4,5,10,21,22), +'schdulePD' => array(2,3,4,5,21,10,22), +'generatePDReport' => array(6,7,10), +'savePDPhotos' => array(3,4,5,6,7,10,21,22), +'savePDFormDetails' => array(3,4,5,6,7,10,21,22), +'getListOfPDTeam' => array(10), +'saveMaster' => array(10), +'getPdManage' => array(10), +'savePdTeamManage' => array(10), +'saveVendorCityMapping' => array(10), +'saveLenderBranches' => array(10), +'saveTATInfo' => array(10), +'deleteTATCombimaion' => array(10), +'saveEntityPricingInfo' => array(10), +'saveNewEntity' => array(10), +'saveEntityBillingInfo' => array(10), +'saveEntityRegionMapping' => array(10), +'codeigniterViewTest' => array(10), +'getPDFormDetails' => array(3,4,5,6,7,10,21,22), +'getPDImages' => array(3,4,5,6,7,10,21,22), +'updatePDPhoto' => array(3,4,5,6,7,10,21,22), +'saveHTMLReport' => array(6,7,10), +'archivePDImages' => array(6,7,10) ); ?> \ No newline at end of file diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php index fa849ea1..4c40f9d6 100644 --- a/api/application/config/autoload.php +++ b/api/application/config/autoload.php @@ -103,7 +103,7 @@ $autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date', | config files. Otherwise, leave it blank. | */ -$autoload['config'] = array('customconfig_one'); +$autoload['config'] = array('customconfig_one','api_user_auth_config'); /* | ------------------------------------------------------------------- diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 079b42b3..5e1f533f 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -461,14 +461,34 @@ class PD_Controller extends REST_Controller { /***********************END OF PD ALLOCATION TYPE AND PROCESS***********/ $pd_details['pd_date_of_initiation'] = date("Y-m-d H:i:s"); - // if($pd_details['pd_status'] == "" || $pd_details['pd_status'] == null) - // { - // $pd_details['pd_status'] = DRAFT; - - // } - - //die(); + //Generate Random string + + /************ASSIGN Random URL******************/ + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < 16; $i++) + { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + $pd_details['random_string'] = $randomString; + $url = 'https://ssa.sineedge.com/officertracking/#/officertracking/'.$randomString; + /* $ch = curl_init(); + $timeout = 5; + $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString; + + //echo "$url"; + curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + $tinyurl = curl_exec($ch); + curl_close($ch); */ + $pd_details['encrypted_url'] = $url; + //echo $tinyurl; + /************ASSIGN Random URL******************/ + + //End of Generate Random string $pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : NULL; $pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER); @@ -710,32 +730,6 @@ class PD_Controller extends REST_Controller { $pd_details['initiate_location'] = $pd_details['link']; unset($pd_details['link']); - /************ASSIGN Random URL******************/ - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 16; $i++) - { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $pd_details['random_string'] = $randomString; - - - $url = 'https://ssa.sineedge.com/officertracking/#/officertracking/'.$randomString; - /* $ch = curl_init(); - $timeout = 5; - $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString; - - //echo "$url"; - curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); - curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); - curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); - $tinyurl = curl_exec($ch); - curl_close($ch); */ - $pd_details['encrypted_url'] = $url; - //echo $tinyurl; - /************ASSIGN Random URL******************/ - } if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED) { @@ -1746,7 +1740,7 @@ class PD_Controller extends REST_Controller { */ public function listLessPDDetails_get() { - $page = 0;$limit = 100;$sort = 'DESC';$pdofficerid = "";$datetype = "";$fdate ="";$tdate =""; + $page = 0;$limit = 1000;$sort = 'DESC';$pdofficerid = "";$datetype = "";$fdate ="";$tdate =""; $lenderid = "";$status=""; if($this->get('page')) { $page = $this->get('page'); } if($this->get('limit')){ $limit = $this->get('limit'); } @@ -5140,7 +5134,7 @@ class PD_Controller extends REST_Controller { $t = substr_replace($t,'',strpos($t,''),(strlen(''))); } - echo $t; + //echo $t; //PDF Gen using DOM PDF diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index eddd05d2..c2e54c08 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/authorization_helper.php b/api/application/helpers/authorization_helper.php index 304014f3..81073f9d 100644 --- a/api/application/helpers/authorization_helper.php +++ b/api/application/helpers/authorization_helper.php @@ -60,9 +60,14 @@ class AUTHORIZATION $CI =& get_instance(); $headersData = getallheaders(); //print_r($headersData); - - //print_r($CI->uri->uri_string); - //die(); + + $role_permission_array = array(); + if(array_key_exists($CI->uri->uri_string, $CI->config->item('api_user_auth_info'))) + { + $role_permission_array = $CI->config->item('api_user_auth_info')[$CI->uri->uri_string]; + } + // print_r($role_permission_array); + // die(); if( $routingName == ROUTE_LOGIN_X) { @@ -89,8 +94,45 @@ class AUTHORIZATION return $validateToken; } } + //For all route name except contant route else if($routingName!=ROUTE_LOGIN){ $validateToken = self::validateTimestamp(); + + // Check role base arry for current user have permission to access requested API + if(count($role_permission_array)) + { + if(array_key_exists("Token",$headersData)) + { + $token_payload = json_decode(json_encode(JWT::decode($headersData['Token'])), true); + // print_r($token_payload);die(); + + //check role info existing in token paylod + if(array_key_exists('custom:role_id',$token_payload)) + { + if(in_array($token_payload['custom:role_id'],$role_permission_array)){ return $validateToken; } + else { + set_status_header(REST_CONTROLLER::HTTP_UNAUTHORIZED,"Unauthorized"); + $response['status']=false; + $response['error']="Unauthorized Role Access"; + log_message('error','Unauthorized Role Access'); + echo json_encode($response); + exit; + } + } + else + { + set_status_header(REST_CONTROLLER::HTTP_UNAUTHORIZED,"Unauthorized"); + $response['status']=false; + $response['error']="Could not Identify Role!"; + log_message('error','Could not Identify Role'); + echo json_encode($response); + exit; + } + } + + } // end of role based authorization logic + + return $validateToken; } else{ diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index e670eb19..a70adb40 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -232,6 +232,35 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /* #########billwise Table Styles######### */ +/* #########Annexure table ######### */ + + .annexure_table { + /* font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;*/ + /*font-family: Merriweather;*/ + border-collapse: collapse; + width: auto; + +} + +.annexure_table td, .annexure_table th { + border: 1px solid #000; + +} + +.annexure_table tr:nth-child(even){background-color: #f2f2f2;} + +.annexure_table tr:hover {background-color: #ddd;} + +.annexure_table th { + /*padding-top: 4px;*/ + /*padding-bottom: 4px;*/ + text-align: center; + background-color: #0191ed; + color: white; +} +/* #########Annexure######### */ + + .customtd { text-align:center; } .customtd_leftalign { text-align:left; } .customtd_rightalign { text-align:right; } @@ -432,7 +461,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo "

".$main_applicant_name."

"; echo ""; - echo "



";` + echo "



"; ?> @@ -1222,7 +1251,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); // this is for no of employees details if(isset($businessRow['employees_permanent']) && $businessRow['employees_permanent'] <= 0) { - $bindEachResult['company_empployees']='As per person met there are no permanent'; + $bindEachResult['company_employees']='As per person met there are no permanent'; + } else{ $bindEachResult['company_employees']='As per person met, there are '.$businessRow['employees_permanent'].' permanent '; @@ -1239,9 +1269,9 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if(($businessRow['employees_permanent'] != "" && $businessRow['employees_permanent'] == 0) && ($businessRow['employees_temporary'] != "" && $businessRow['employees_temporary'] == 0)) { - $bindEachResult['company_employees'].= 'There are no permanant and temporary employees with company.'; - } + $bindEachResult['company_employees']= 'There are no permanant and temporary employees with company.'; + } if(isset($businessRow['officer_total']) && $businessRow['officer_total'] > 0) { @@ -1832,8 +1862,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } else { - echo - $bindBusinessFinancial["financial_customer"] ="As per Loan Applicant(s) met, the financials are same as financial statement."; + + $bindBusinessFinancial["financial_customer"] ="As per Loan Applicant(s) met, the actual turnover and net profit of his business is same as disclosed in financial statements."; $bindBusinessFinancial['customer_statements']=array(); $bindBusinessFinancial['customer_statements_header']=array(); $bindBusinessFinancial['is_customer_statement'] = 0; @@ -2015,7 +2045,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); As per Loan Applicant(s) met, the financials figures were not provided.

"; } + }//else { echo "

As per Loan Applicant(s) met, the financials figures were not provided.

"; } ?> '; + echo '

'; echo 'Item name : ' . $sale_month_wise['sales_item'].'
'; if($sale_month_wise['sales_type'] == 1) { @@ -3039,7 +3069,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); foreach($ai_core_details_processed['sales_item_wise_to_diaplay'] as $sid) { echo ''; - echo ''; + echo ''; if(isset($sid['margin_per'])){echo ''; } if(isset($sid['margin_per_uom'])){echo ''; } if(isset($sid['margin_final_value'])){echo ''; } @@ -3350,11 +3380,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } } ?> - +
+

Other Sources of Income of Individual Loan Applicants:

0){ //print_r($otherIncomeResult); ?> -

Other Sources of Income of Individual Loan Applicants:

+
'.$sid['sale_item'].''.$sid['sales_qty'].''.$sid['uom'].''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']).''.$sid['frequency'].''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).''.$sid['sale_item'].''.$sid['sales_qty'].''.$sid['uom'].''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']).''.$sid['frequency'].''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).''.$sid['margin_per'].''.$sid['margin_per_uom'].''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).'
@@ -3380,7 +3411,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
-

As per the loan applicants met by PD officer, they do not have any other source of Income.

+

As per the loan applicants, they do not have any other source of Income.

'. $other_source_income_common_remarks.'

'; } @@ -3472,12 +3503,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } } ?> +
+

Existing loan obligation

0){ //print_r($existLoanResult); ?> -

Existing Loan Obligation

+

The table below lists the details of Existing Loan Obligations of the Loan Applicants.

@@ -3508,7 +3541,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); // } else {?> -

As per loan applicant he does not have any existing loan obligations.

+

As per loan applicant he does not have any existing loan obligations.

'.$existing_loan_form_common_remarks.'

';} @@ -3741,10 +3774,11 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo '

'.$pd_officer_final_remark.'

' ?> - +
- + + 0) { for($business_count = 0;$business_count < $total_no_of_business; $business_count++) { @@ -3755,10 +3789,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { echo "
"; echo '

Kuchha Sales Book/Bills Details:

'; + //print_r($ai_core_details_processed['sales_month_wise_to_display']);die(); foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise) { - // if($sale_month_wise['sales_type'] == 1) - // { + echo '
'; echo 'Item name : ' . $sale_month_wise['sales_item'].'
'; if($sale_month_wise['sales_type'] == 1) @@ -3787,8 +3821,11 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //echo ''; if(isset($sale_month_wise['months'][$j])) { + + //print_r($sale_month_wise['months'][$j]) ;die(); echo '
'; - echo ''; + //echo '
'; + echo '
'; echo ''; if($sale_month_wise['sales_type'] == 1) { @@ -3797,7 +3834,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if($sale_month_wise['sales_type'] == 1) { echo ''; - }else if($sale_month_wise['months'][$j]['sales_type'] == 2) + }else if(($sale_month_wise['sales_type'] == 2)) { echo ''; } @@ -3838,7 +3875,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } ?> - +
Date Value
Frequncy Value