WeBWorK Main Forum

Removing menus for students in theme

Re: Removing menus for students in theme

by Björn Bergstrand -
Number of replies: 0
Thank you for the help!
I ended up adding the function 
sub if_permissionlevel {
        my ($self, $arg) = @_;
        my $r = $self->r;
        my $db = $r->db;
        my $userID = $r->param('user');
        #bail out if not logged in
        return 0 unless $userID;

        if ($db->getPermissionLevel($userID)->permission == $arg) {
                return 1;
        } else {
                return 0;
        }
}

to ContentGenerator.pm, to get e.g. <!--#if permissionlevel="10"--> to work in the template showing content only to (in this case) professors.