[system] / trunk / webwork-modperl / lib / WeBWorK / Authz.pm Repository:
ViewVC logotype

View of /trunk/webwork-modperl/lib/WeBWorK/Authz.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 562 - (download) (as text) (annotate)
Fri Sep 27 23:53:42 2002 UTC (10 years, 7 months ago) by sh002i
File size: 986 byte(s)
- created macros/IO.pl, which is loaded with no opmask by PG.pm. It is a copy
  of WeBWorK::PG::IO.pm, with some changes to make it work as a macro package.
  The translator no longer shares IO.pm's functions with the safe compartment.
  This is a BAD THING, and should be reconsidered when the Translator is
  revised.
- Changed many (but not all) checks for HTML or HTML_tth modes to match /^HTML/
  in the macros.
- changed &header to &head in Problem.pm
- Added problem environment variables for gif2eps and png2eps and modified
  &dangerousMacros::alias to use them
- fixed MOST of the harmless warnings in the system. there's still the "Use
  of uninitialized value in null operation" warning in template(), tho.

Still to come:

- make images in PDFs work
- fix TTH mode character encodings on mac (maybe)
- have logout button invalidate key
- Pretty die messages (from outside of the translator)
- Feedback - need nice modular way of sending email
- Options - email address and password

    1 ################################################################################
    2 # WeBWorK mod_perl (c) 2000-2002 WeBWorK Project
    3 # $Id$
    4 ################################################################################
    5 
    6 package WeBWorK::Authz;
    7 
    8 =head1 NAME
    9 
   10 WeBWorK::Authz - check user permissions.
   11 
   12 =cut
   13 
   14 use strict;
   15 use warnings;
   16 use WeBWorK::DB::Auth;
   17 
   18 sub new($$$) {
   19   my $invocant = shift;
   20   my $class = ref($invocant) || $invocant;
   21   my $self = {};
   22   ($self->{r}, $self->{courseEnvironment}) = @_;
   23   bless $self, $class;
   24   return $self;
   25 }
   26 
   27 sub hasPermissions {
   28   my ($self, $user, $activity) = @_;
   29   my $r = $self->{r};
   30   my $courseEnvironment = $self->{courseEnvironment};
   31   my $permission_hash = $courseEnvironment->{permission_hash};
   32   my $auth = WeBWorK::DB::Auth->new($courseEnvironment);
   33 
   34   my $permissionLevel = $auth->getPermissions($user);
   35   if (defined $permission_hash->{$activity}
   36       and $permissionLevel >= $permission_hash->{$activity}) {
   37     return 1;
   38   } else {return 0;}
   39 }
   40 
   41 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9