Merge branch 'master' of https://bitbucket.org/venbaittech/sparqapi
This commit is contained in:
commit
4d4b6285aa
@ -4,7 +4,7 @@
|
||||
|
||||
/* public key for encrypt AWS JWT SINE_EDGE_USER_POOL_ID_TOKEN
|
||||
*/
|
||||
$config['jwt_public_key'] = '-----BEGIN PUBLIC KEY-----
|
||||
$config['jwt_public_key_sineedge_dev'] = '-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w
|
||||
r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM
|
||||
Dgik5jW8aCBvGM5S6PAZXn3fj59HYtKL0HIQ1cxaoIUVXjRHD/QkcCEZuG5dIxij
|
||||
|
||||
@ -551,7 +551,8 @@ $config['allowed_cors_headers'] = [
|
||||
'Access-Control-Request-Method',
|
||||
'Authorization',
|
||||
'Token',
|
||||
'enctype'
|
||||
'enctype',
|
||||
'From'
|
||||
];
|
||||
|
||||
/*
|
||||
@ -593,4 +594,4 @@ $config['allow_any_cors_domain'] = TRUE;
|
||||
| e.g. $config['allowed_origins'] = ['http://www.example.com', 'https://spa.example.com']
|
||||
|
|
||||
*/
|
||||
$config['allowed_cors_origins'] = [];
|
||||
$config['allowed_cors_origins'] = ['From'];
|
||||
|
||||
@ -90,6 +90,7 @@ $route['saveNewUser'] = 'User_Management_Controller/saveNewUser';
|
||||
$route['updateExistUser'] = 'User_Management_Controller/updateExistUser';
|
||||
$route['getUsersDetails'] = 'User_Management_Controller/getUsersDetails';
|
||||
$route['getSingedProfilePicURL'] = 'User_Management_Controller/getSingedProfilePicURL';
|
||||
$route['checkpin'] = 'User_Management_Controller/checkpin';
|
||||
|
||||
// TEMPLATE MANAGEMENT
|
||||
$route['(listAllTemplates/:any)'] = 'Template_Management_Controller/listAllTemplates/';
|
||||
|
||||
@ -294,7 +294,7 @@ class User_Management_Controller extends REST_Controller {
|
||||
* sriram get roles function
|
||||
*/
|
||||
public function getUsersDetails_post(){
|
||||
|
||||
|
||||
$userid = $this->post('userid');
|
||||
|
||||
$result = $this->User_Management_Model->getUserDetails($userid);
|
||||
@ -357,5 +357,31 @@ class User_Management_Controller extends REST_Controller {
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Check pin for mobile app
|
||||
* @params userid and pin
|
||||
* return data true or false;
|
||||
*/
|
||||
|
||||
public function checkpin_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
|
||||
$pin_details = $this->User_Management_Model->pinDetails($records);
|
||||
if($pin_details != null || $singed_uri != '')
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $pin_details['data'];
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = 'No Profile URL Available';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
api/application/docs/temp_base64_image.png
Executable file
BIN
api/application/docs/temp_base64_image.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
@ -6,6 +6,7 @@ class AUTHORIZATION
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$headersData = getallheaders();
|
||||
|
||||
if (!array_key_exists("Token",$headersData))
|
||||
{
|
||||
set_status_header(REST_CONTROLLER::HTTP_OK,"OK");
|
||||
|
||||
@ -41,6 +41,7 @@ class JWT
|
||||
{
|
||||
|
||||
|
||||
|
||||
$tks = explode('.', $jwt);
|
||||
|
||||
if (count($tks) != 3) {
|
||||
@ -149,17 +150,38 @@ class JWT
|
||||
*/
|
||||
public static function aws_sign($head_body, $signature, $alg)
|
||||
{
|
||||
|
||||
$headers['From'] = 1;
|
||||
$headers = getallheaders();
|
||||
$CI =& get_instance();
|
||||
$jwtkey = '';
|
||||
if (empty(static::$supported_algs[$alg])) {
|
||||
throw new DomainException('Algorithm not supported');
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("From",$headers)){
|
||||
if($headers['From'] ==2)
|
||||
{
|
||||
$jwtkey = $CI->config->item('jwt_public_key_lender_dev');
|
||||
}else if($headers['From'] !='' && $headers['From'] ==3)
|
||||
{
|
||||
$jwtkey = $CI->config->item('jwt_public_key_vendor_dev');
|
||||
}else if($headers['From']!='' && $headers['From'] == 1)
|
||||
{
|
||||
$jwtkey = $CI->config->item('jwt_public_key_sineedge_dev');
|
||||
}else{
|
||||
$jwtkey = '';
|
||||
}
|
||||
}else
|
||||
{
|
||||
$jwtkey = $CI->config->item('jwt_public_key_sineedge_dev');
|
||||
|
||||
}
|
||||
|
||||
|
||||
list($function, $algorithm) = static::$supported_algs[$alg];
|
||||
switch($function) {
|
||||
case 'openssl':
|
||||
$success = openssl_verify($head_body, $signature, $CI->config->item('jwt_public_key'), $algorithm);
|
||||
$success = openssl_verify($head_body, $signature, $jwtkey , $algorithm);
|
||||
if ($success === 1) {
|
||||
return true;
|
||||
} elseif ($success === 0) {
|
||||
|
||||
@ -53,7 +53,7 @@ class User_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function getUserDetails($userid){
|
||||
|
||||
$this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILE.fk_entity_type_id,USERPROFILEROLES.user_role,ENTITYTYPE.name as entitytypename,ROLES.role_name');
|
||||
$this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILE.fk_entity_type_id,USERPROFILEROLES.user_role,ENTITYTYPE.name as entitytypename,ROLES.role_name,USERPROFILE.mpin');
|
||||
$this->db->from(USERPROFILE.' as USERPROFILE');
|
||||
$this->db->join(ENTITY.' as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1','LEFT');
|
||||
$this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1','LEFT');
|
||||
@ -85,4 +85,23 @@ class User_Management_Model extends SPARQ_Model {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function pinDetails($records)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->where('USERPROFILE.userid',$records['userid']);
|
||||
$this->db->where('USERPROFILE.mpin',$records['mpin']);
|
||||
$result = $this->db->get(USERPROFILE.' as USERPROFILE')->first_row();
|
||||
if(count($result) !=0)
|
||||
{
|
||||
$result_data['data_status'] = true;
|
||||
$result_data['data'] = true;
|
||||
return $result_data;
|
||||
}else
|
||||
{
|
||||
$result_data['data_status'] = false;
|
||||
$result_data['data'] = false;
|
||||
return $result_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user