FIX_role based

This commit is contained in:
venba-Inspriron-3558 2025-10-27 13:09:56 +05:30
parent a133e52319
commit 660dcf56f5
4 changed files with 47 additions and 11 deletions

View File

@ -94,12 +94,12 @@ define('EVENT_PRIORITY_NORMAL', 100);
define('EVENT_PRIORITY_HIGH', 10);
/**
* @User Role Constant
* @User Teams Constant
*/
define('ENROLLMENT_TEAM_ID', '1');
define('CLAIMS_TEAM_ID', '2');
define('BUSINESS_TEAM_ID', '3');
// define('BUSINESS_TEAM_ID', '3'); // old don't delete it
define('BUSINESS_TEAM_ID', '4'); // 25th OCT 2025 changed
define('FINANCE_TEAM_ID', '4');
define('SALES_TEAM_ID', '5');
define('MANAGEMENT_TEAM_ID', '6');
@ -107,9 +107,8 @@ define('BUSINESS_SUPPORT_TEAM_ID', '7');
define('POS_TEAM_ID', '8');
/**
* @User Teams Constant
* @User Role Constant
*/
define('ADMIN_ROLE_ID', 1);
define('MANAGER_ROLE_ID', 2);
define('ACCOUNT_MANAGER_ROLE_ID', 3);

View File

@ -62,7 +62,7 @@ class UserController extends AdminController
// echo '<pre>';
// print_r($data); die;
$data['roleData'] = $this->roleModel->select('id, role')->findAll();
$data['teamData'] = $this->teamModel->select('id, name')->findAll();
$data['teamData'] = $this->teamModel->select('id, name')->where('is_active',1)->findAll();
$this->loadLayout('UserList', $data);
}
@ -156,9 +156,11 @@ class UserController extends AdminController
public function edit()
{
// echo ":/ in 159";
if (!$this->request->getPost()) {
return redirect()->to(base_url('/user/list'));
} else {
// echo ":/ in 163";
$id = $this->request->getPost('PrimaryKey');
$teams = $this->request->getPost('team');
$userData = $this->request->getPost();
@ -166,6 +168,7 @@ class UserController extends AdminController
unset($userData['PrimaryKey']);
$existingData = $this->userModel->where('id',$id)->first();;
// dd($existingData);die;
// Update data in the 'users' table based on the $id
$userData['updated_by'] = get_session_userid();

View File

@ -673,7 +673,34 @@ table.dataTable tbody td {
<td>BDS - All access</td>
<td>All access</td>
</tr>
<tr>
<td class="team-cell" rowspan="6">Accounts</td>
<td>BDS - Policy Transaction</td>
<td>Policy | Endorsement | Statement Upload</td>
</tr>
<tr>
<td>BDS - Report</td>
<td>TAT wise | ACM Status wise | ACM TAT wise</td>
</tr>
<tr>
<td>BDS - Policy Report</td>
<td>BDS | Variance | Outstanding | IRDA | Renewal | TAT Band </td>
</tr>
<tr>
<td>BDS - Pending Actions</td>
<td>Finance Team</td>
</tr>
<tr>
<td>BDS - Masters</td>
<td>Vehicle | CD | Insurer</td>
</tr>
<tr>
<td>BDS - Documents</td>
<td></td>
</tr>
<!-- Temporary please don't delete (start's) -->
<!--
<tr>
<td class="team-cell" rowspan="5">Finance</td>
<td>BDS - Policy Transaction</td>
<td>Policy | Endorsement | Statement Upload</td>
@ -715,6 +742,8 @@ table.dataTable tbody td {
<td>BDS - Documents</td>
<td></td>
</tr>
-->
<!-- Temporary please don't delete (ends) -->
<tr>
<td class="team-cell" rowspan="2">POS</td>
<td>BDS - Policy Transaction</td>

View File

@ -1766,7 +1766,7 @@
<?php } ?>
<!-- Masters -->
<?php if (get_role_id() == 1 || get_role_id() == 5 || get_role_id() == 4) { ?>
<?php if (get_role_id() == 1 || get_role_id() == 5 || ( get_role_id() == 4 && (in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())))) { ?>
<li class="li-seperate" id="masters-li">
<a href="#sidebarPolicies" data-toggle="collapse" class=" img-inactive">
@ -1895,7 +1895,7 @@
</li>
<?php } ?>
<!-- BDS -->
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<?php if ((get_role_id() == 1 || get_role_id() == 5 || get_role_id() == 4) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li class="li-seperate" id="policy-transactions-li">
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect img-inactive">
<img
@ -1930,9 +1930,9 @@
</div>
</li>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<?php if ((get_role_id() == 1 || get_role_id() == 5) ||(get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<?php if (in_array(get_role_id(), [1, 5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team())) { ?>
<?php if (in_array(get_role_id(), [1, 5]) ||(get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team())) { ?>
<li>
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
@ -1943,7 +1943,7 @@
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<?php if (in_array(get_role_id(), [1, 5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<?php if (in_array(get_role_id(), [1, 5]) || (get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
@ -2023,6 +2023,11 @@
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
<?php if ((get_role_id() === 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(BUSINESS_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/master/insurer/list') ?>">Insurer Master</a>
</li>
<?php } ?>
</ul>
</div>
</li>