[system] / trunk / webwork2 / lib / WeBWorK / Authz.pm Repository:
ViewVC logotype

View of /trunk/webwork2/lib/WeBWorK/Authz.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 390 - (download) (as text) (annotate)
Wed Jun 19 22:45:47 2002 UTC (17 years, 8 months ago) by malsyned
File size: 633 byte(s)
This commit brings several packages up to date and working.  I wish I could
be more specific, but it's been a while since I've committed.  You'll have
to check the CVS diffs for more info.
--Dennis

    1 package WeBWorK::Authz;
    2 
    3 use WeBWorK::DB::Auth;
    4 
    5 sub new($$$) {
    6   my $invocant = shift;
    7   my $class = ref($invocant) || $invocant;
    8   my $self = {};
    9   ($self->{r}, $self->{courseEnvironment}) = @_;
   10   bless $self, $class;
   11   return $self;
   12 }
   13 
   14 sub hasPermissions {
   15   my ($self, $user, $activity) = @_;
   16   my $r = $self->{r};
   17   my $courseEnvironment = $self->{courseEnvironment};
   18   my $permission_hash = $courseEnvironment->{permission_hash};
   19   my $auth = WeBWorK::DB::Auth->new($courseEnvironment);
   20 
   21   my $permissionLevel = $auth->getPermissions($user);
   22   if ($permissionLevel >= $permission_hash->{$activity}) {
   23     return 1;
   24   } else {return 0;}
   25 }
   26 
   27 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9