function edit_privilege() { // $perm = Access_controllerservice :: checkAccess('EDIT_PRIVILEGES'); // if ($perm) { $privileges_model = new Privilege_model(); $privilege_service = new Privilege_service(); $privileges_model->set_privilege_master_code($this->input->post('master_privilege_code', TRUE)); $privileges_model->set_privilege($this->input->post('privilege', TRUE)); $privileges_model->set_privilege_description($this->input->post('privilege_desc', TRUE)); $privileges_model->set_priviledge_code_HF($this->input->post('privilege_hf', TRUE)); $privileges_model->set_assign_for($this->input->post('assign_for', TRUE)); $privileges_model->set_privilege_code($this->input->post('privilege_code', TRUE)); echo $privilege_service->update_privilege($privileges_model); // } else { // $this->template->load('template/access_denied_page'); // } }
function user_privileges_delete_all() { $user_privilege_model = new User_privileges_model(); $user_privilege_service = new User_privileges_service(); $privilege_service = new Privilege_service(); $privilege_master_service = new Privilege_master_service(); $user_service = new User_service(); $user_model = new User_model(); $user_model->set_id($this->input->post('user_id', TRUE)); //setting the user id $user = $user_service->get_admin_by_id($user_model); $user_privilege_model->set_user_id($this->input->post('user_id', TRUE)); $master_privileges = $privilege_master_service->get_privilege_master_by_system_code($this->input->post('system_code', TRUE)); foreach ($master_privileges as $master_privilege) { $privileges = $privilege_service->get_privileges_by_master_privilege_assigned_for($master_privilege->privilege_master_code, $user->user_type); foreach ($privileges as $privilege) { $user_privilege_model->set_privilege_code($privilege->privilege_code); $user_privilege_service->delete_new_user_privilege_system($user_privilege_model); } } //adding the user piviledges based on the template echo 1; }
<section class="panel"> <header class="panel-heading"> <?php echo 'Assign Privileges For ' . ' - ' . ucfirst($user_detail->name); ?> <span class="tools pull-right"> <a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-times"></a> </span> </header> <div> <header class="panel-heading tab-bg-dark-navy-blue"> <ul class="nav nav-tabs" id="emp_privi_tab"> <?php $privilege_master_service = new Privilege_master_service(); $privilege_service = new Privilege_service(); $systems = $this->config->item('SYSTEMS'); $a = 0; foreach ($systems as $system) { ++$a; ?> <li <?php if ($a == 1) { ?> class="active" <?php } ?> > <a data-toggle="tab" <?php if ($a == 1) { ?>