
Backend/Func/CheckViewForum.pm - Check restrictions
This function was initially used simply for checking whether a user could view a forum. It has since morphed into an all-round ``user can perform X action in this forum'' function. Unfortunately, it's too late to change it's name.
This function checks whether the specified user can perform a certain action in a forum. Some of the actions include: Posting new threads, replying, attaching files, actually seeing the forum on the main board page (checks for ``hidden'' forums), viewing the forum at all, posting polls and using HTML. All of these can have a ``Admins, Mods & Specified Users'' option, this function also checks the specified users.
my $bool = $self->CheckViewForum($userdetails_object, $who_object, $spec_object);
Example
my $fid = $self->_param('fid');
my $forum = $self->{db}->listforums();
# whoview/specview - Permission to view the forum
# whohide/spechide - Can view forum on the main board page
# whonew/specnew - Can post new threads
# whorep/specrep - Can reply to threads
# whopoll/specpoll - Can post polls
# whoatt/specatt - Can attach files
# whohtml/spechtml - Can use HTML
# Checks if the user can attach files:
my $nopermission = $self->CheckViewForum($self->{userdetails}, $forum->{$fid}->{whoatt}, $forum-{$fid}->{specatt});
if ($nopermission) {
# User cannot perform that action.
}
|