GWM : hr suth token
This commit is contained in:
parent
86d381fe2f
commit
97a54b8c5e
@ -660,7 +660,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if(isset($this->request->getJSON()->mobile_no)){
|
if(isset($this->request->getJSON()->mobile_no)){
|
||||||
|
|
||||||
$getAllhrData = $this->hrModel->select('level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name')
|
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name, client_branch.pre_branch_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||||
->where('level_contacts.mobile', $mobile_number )
|
->where('level_contacts.mobile', $mobile_number )
|
||||||
@ -671,7 +671,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||||
|
|
||||||
$getAllhrData = $this->hrModel->select('level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name')
|
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name, client_branch.pre_branch_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||||
->where('level_contacts.email', $email )
|
->where('level_contacts.email', $email )
|
||||||
@ -679,16 +679,46 @@ class RestAuthenticationController extends AdminController
|
|||||||
->findAll();
|
->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
print_rr($getAllhrData); die;
|
if(count($getAllhrData))
|
||||||
$HRAccessData = $this->getHRAccessData( $hrData['0']['id'] , 'post_enrollment');
|
{
|
||||||
|
|
||||||
if(isset($HRAccessData['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['allowed_modules'],true)['post']; }else{ $hrData['0']['allowed_modules'] = []; }
|
foreach ($getAllhrData as $key => $value) {
|
||||||
|
|
||||||
$hrData['0']['token_type'] = 'post';
|
$HRAccessData = $this->hrAccessControlModel
|
||||||
$result = JWTToken::encode($hrData['0']);
|
->where('post_client_id',$value['client_id'])
|
||||||
|
->where('post_branch_id', $value['client_branch_id'])
|
||||||
|
->where('post_hr_id', $value['id'])
|
||||||
|
->get()->getRowArray();
|
||||||
|
|
||||||
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
if (!empty($HRAccessData) && isset($HRAccessData['allowed_modules'])) {
|
||||||
|
|
||||||
|
$decoded = json_decode($HRAccessData['allowed_modules'], true);
|
||||||
|
$getAllhrData[$key]['allowed_modules'] = $decoded;
|
||||||
|
|
||||||
|
$token = JWTToken::encode($HRAccessData);
|
||||||
|
$getAllhrData[$key]['token'] = $token;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$getAllhrData[$key]['allowed_modules'] = [];
|
||||||
|
$getAllhrData[$key]['token'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $getAllhrData ],200);
|
||||||
|
|
||||||
|
|
||||||
|
// $HRAccessData = $this->getHRAccessData( $hrData['0']['id'] , 'post_enrollment');
|
||||||
|
|
||||||
|
// if(isset($HRAccessData['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['allowed_modules'],true)['post']; }else{ $hrData['0']['allowed_modules'] = []; }
|
||||||
|
|
||||||
|
// $hrData['0']['token_type'] = 'post';
|
||||||
|
// $result = JWTToken::encode($hrData['0']);
|
||||||
|
|
||||||
|
|
||||||
|
// return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user