diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index f97713634..da1859b23 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -10,7 +10,7 @@ class adif extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->model('user_model'); - if(!$this->user_model->authorize(2) || !clubaccess_check(9)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + if(!$this->user_model->authorize(2) || !clubaccess_check(6)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } } public function test() { @@ -242,10 +242,18 @@ class adif extends CI_Controller { $record['contest_id'] = $contest; } - //handle club operator - if ($club_operator != '') { - $record['operator'] = strtoupper($club_operator); + //handle club operator based on permission level + $user_permission_level = $this->session->userdata('cd_p_level'); + if ($user_permission_level >= 9) { + // Club Officer: Allow operator override + if ($club_operator != '') { + $record['operator'] = strtoupper($club_operator); + } + } elseif ($user_permission_level == 6) { + // ClubMemberPlus: Force operator to current user, ignore input + $record['operator'] = strtoupper($this->session->userdata('operator_callsign')); } + // Note: Regular Club Member (Level 3) should not reach here due to constructor permission check //check if contest_id exists in record and extract all found contest_ids if(array_key_exists('contest_id', $record)){ diff --git a/application/controllers/Club.php b/application/controllers/Club.php index 78fec7681..493b87787 100644 --- a/application/controllers/Club.php +++ b/application/controllers/Club.php @@ -21,6 +21,7 @@ class Club extends CI_Controller $this->permissions = [ 9 => __("Club Officer"), + 6 => __("Club Member Plus"), 3 => __("Club Member"), ]; } @@ -118,9 +119,9 @@ class Club extends CI_Controller $this->session->set_flashdata('error', __("Invalid Club ID!")); redirect('dashboard'); } - if(!$this->user_model->authorize(99) && !$this->club_model->club_authorize(9, $club_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); - redirect('dashboard'); + if(!$this->user_model->authorize(99) && !$this->club_model->club_authorize(9, $club_id) && !$this->club_model->club_authorize(6, $club_id)) { + $this->session->set_flashdata('error', __("You're not allowed to do that!")); + redirect('dashboard'); } $this->club_model->alter_member($club_id, $user_id, $p_level); @@ -147,9 +148,9 @@ class Club extends CI_Controller $this->session->set_flashdata('error', __("Invalid Club ID!")); redirect('dashboard'); } - if(!$this->user_model->authorize(99) && !$this->club_model->club_authorize(9, $club_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); - redirect('dashboard'); + if(!$this->user_model->authorize(99) && !$this->club_model->club_authorize(9, $club_id) && !$this->club_model->club_authorize(6, $club_id)) { + $this->session->set_flashdata('error', __("You're not allowed to do that!")); + redirect('dashboard'); } if ($this->club_model->delete_member($club_id, $user_id)) { diff --git a/application/helpers/club_helper.php b/application/helpers/club_helper.php index 780800b98..819cb0f31 100644 --- a/application/helpers/club_helper.php +++ b/application/helpers/club_helper.php @@ -30,9 +30,18 @@ if (!function_exists('clubaccess_check')) { // check if the QSO belongs to the user $CI->load->model('logbook_model'); $qso = $CI->logbook_model->get_qso($qso_id)->row(); - if ($qso->COL_OPERATOR == $CI->session->userdata('operator_callsign') || $CI->session->userdata('cd_p_level') >= 9) { + $user_level = $CI->session->userdata('cd_p_level'); + $operator_callsign = $CI->session->userdata('operator_callsign'); + + // Enhanced logic for ClubMemberPlus (Level 6) + if ($user_level >= 9) { + // Officers can access any QSO return true; + } elseif ($user_level >= 6) { + // ClubMemberPlus and regular members can only access their own QSOs + return $qso->COL_OPERATOR == $operator_callsign; } else { + // Lower levels (shouldn't reach here for ADIF access) return false; } } else { diff --git a/application/views/club/permissions.php b/application/views/club/permissions.php index 73e2c9849..61d5845cb 100644 --- a/application/views/club/permissions.php +++ b/application/views/club/permissions.php @@ -237,6 +237,8 @@