Loading...
 
Skip to main content

Features / Usability


Permissions f. Categories

Hi again,

I have a problem with setting permissions for categories.
Restricting access to pages in categories works, if a user clicks a page in a category which is set to a usergroup he is not assigned to he gets an errorpage.

But he can still download files in those categories.

Doesnt tiki-downloadfile.php check if he´s allowed to access the category?
Can I make it checking it ?
I searched the code already, tiki-index.php does the following:

// Check to see if page is categorized
$objId = urldecode($page);
if ($tiki_p_admin != 'y' && $feature_categories == 'y' && !$object_has_perms) {
// Check to see if page is categorized
$perms_array = $categlib->get_object_categories_perms($user, 'wiki page', $objId);
if ($perms_array) {
$is_categorized = TRUE;
foreach ($perms_array as $perm => $value) {
$$perm = $value;
}
} else {
$is_categorized = FALSE;
}
if ($is_categorized && isset($tiki_p_view_categories) && $tiki_p_view_categories != 'y') {
if (!isset($user)){
$smarty->assign('msg',$smarty->fetch('modules/mod-login_boxI.tpl'));
$smarty->assign('errortitle',tra("Please login"));
} else {
$smarty->assign('msg',tra("Permission denied you cannot view this page"));
}
$smarty->display("error.tpl");
die;
}
} elseif ($feature_categories == 'y') {
$is_categorized = $categlib->is_categorized('wiki page',$objId);
} else {
$is_categorized = FALSE;
}


If i want to use this, I guess I have to get the $file instead of $page or something ?
Or is this completely nonsense ?
Help.

Thx,
Martin
(TW 1.8.6, MySQL5.0, Apache2.01)

> Hi again,
>
> I have a problem with setting permissions for categories.
> Restricting access to pages in categories works, if a user clicks a page in a category which is set to a usergroup he is not assigned to he gets an errorpage.
>
> But he can still download files in those categories.
>
> Doesnt tiki-downloadfile.php check if he´s allowed to access the category?
> Can I make it checking it ?
> I searched the code already, tiki-index.php does the following:

As far as I can tell, neither tiki-downloadfile.php (for downloading files from file an image galleries) nor tiki-download_wiki_attachment.php (for downloading wiki attachments) check category permissions.


Is it possible to add checking ?
I mean, is it a lot more than just adding:
" if ($is_categorized && isset($tiki_p_view_categories) && $tiki_p_view_categories != 'y') {...} "
in the right place ?


I´m not THAT into the tikiwiki thing...could someone tell if its worth trying or nearly impossible ?
Thank you already 😉

Martin


>Is it possible to add checking ?
>I mean, is it a lot more than just adding:
>" if ($is_categorized && isset($tiki_p_view_categories) && $tiki_p_view_categories != 'y') {...} "
>in the right place ?
>
>
>I´m not THAT into the tikiwiki thing...could someone tell if its worth trying or nearly impossible ?
>Thank you already 😉
>
>Martin

I'm still a novice at tiki programming, but as far as I can tell, categories apply to pages, not attachments or files. Hopefully, someone will correct me if I'm wrong on this.