Merge pull request #5191 from solgenomics/topic/quality_control
[sgn.git] / lib / CXGN / BrAPI / Authenticate.pm
blob71054c6ac227da54f653aac956a9355254d8583a
1 package CXGN::BrAPI::Authenticate;
3 use Moose;
4 use Moose::Role;
5 use Data::Dumper;
6 use CXGN::Login;
8 requires qw( bcs_schema );
10 sub authenticate_user {
11 my $status = shift;
12 my $session_token = shift;
13 my $authenticate_level = shift;
15 my ($person_id, $user_type, $user_pref, $expired) = CXGN::Login->new($self->bcs_schema->storage->dbh)->query_from_cookie($session_token);
16 #print STDERR $person_id." : ".$user_type." : ".$expired;
18 if (!$person_id || $expired || $user_type ne $authenticate_level) {
19 return 0;
22 return 1;