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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 390 - (view) (download) (as text)

1 : malsyned 390 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