Disabled Category still showing for limited access user
Moderator: mkoch227
Disabled Category still showing for limited access user
I've disabled a category for a non admin user, He do not see those category tickets in his profile (which is good) but can select that hidden category when making a new ticket, is this a bug or am i missing something ?
Re: Disabled Category still showing for limited access user
Like Microsoft would say - it's not a bug, it's a feature
Actually this is normal because usually even if a staff member doesn't have access to a category, he/she should be able to for example enter or move tickets to more appropriate category.
But I see your point, will consider adding a permission to disallow this.

Actually this is normal because usually even if a staff member doesn't have access to a category, he/she should be able to for example enter or move tickets to more appropriate category.
But I see your point, will consider adding a permission to disallow this.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Disabled Category still showing for limited access user
Does anybody have any idea how to make a quick hack to only show categories the logged in user has permission to view?
-Steve
Re: Disabled Category still showing for limited access user
Find the SQL code that gets category list in the file you are editing and check each category with the hesk_okCategory() function.
For example in admin_ticket.php this would probably work (didn't test it): change to
For example in admin_ticket.php this would probably work (didn't test it): change
Code: Select all
$categories_options='';
while ($row=hesk_dbFetchAssoc($result))
Code: Select all
$categories_options='';
while ($row=hesk_dbFetchAssoc($result) && hesk_okCategory($row['id'], 0) )
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Disabled Category still showing for limited access user
That did seam to work, when this code is used the category drop down box does not have any data.
Here was my mod (admin/new_ticket.php)
Here was my mod (admin/new_ticket.php)
Code: Select all
<?php
if (!empty($_GET['catid']))
{
$_SESSION['as_category'] = intval($_GET['catid']);
}
$sql = 'SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` ORDER BY `cat_order` ASC';
$result = hesk_dbQuery($sql);
while ($row=hesk_dbFetchAssoc($result) && hesk_okCategory($row['id'], 0) )
{
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {$selected = ' selected="selected"';}
else {$selected = '';}
echo '<option value="'.$row['id'].'"'.$selected.'>'.$row['name'].'</option>';
}
?>
-Steve
Re: Disabled Category still showing for limited access user
No, sorry, after thinking about it it's wrong code, obviously
Instead of that rather add this to inside the while loop, after {

Instead of that rather add this to inside the while loop, after {
Code: Select all
if ( ! hesk_okCategory($row['id'], 0) ) {continue;}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Disabled Category still showing for limited access user
Where do you add your mod in /admin/new_ticket.php ?
I'm noob in php coding..
EDIT: sorry for my mistake I find where put it!
Thanks for your job!
I'm noob in php coding..
EDIT: sorry for my mistake I find where put it!
Thanks for your job!