Changeset 37998
- Timestamp:
- Mar 24, 2015, 12:12:45 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstampparse.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstampparse.pl
r37997 r37998 270 270 my $num_jobs = 0; 271 271 272 my $accessLevel = getUsersAccessLevel($email, $label); 273 if ($accessLevel < 0) { 274 print STDERR "Data access forbidden.\n"; 275 insertFakeJobForRow(undef, 0, $PSTAMP_NOT_AUTHORIZED); 276 exit 0; 277 } 278 272 279 foreach my $row (@$rows) { 273 280 … … 281 288 $row->{job_num} = 0; 282 289 $row->{error_code} = 0; 290 $row->{accessLevel} = $accessLevel; 283 291 284 292 $num_jobs += processRow($action, $row); … … 1132 1140 } 1133 1141 1142 # Prototype function for setting access level. 1143 # XXX: Implement something more flexible using the database. 1144 sub getUsersAccessLevel { 1145 my $email = shift; 1146 my $label = shift; 1147 1148 my $level = -1; 1149 1150 if (!$email) { 1151 # No email provided. Eventually this will be forbidden. 1152 # For now in order to temporarily continue to support the version 1 request format 1153 # set the access rights based on the assigned label. 1154 if ($label eq 'IFA' or $label eq 'QUB' or $label =~ 'MOPS') { 1155 $level = 2; 1156 } else { 1157 # access rights PS1 data only 1158 $level = 1; 1159 } 1160 } else { 1161 # we've got an email check the domain 1162 my ($user, $domain) = split '@', $email; 1163 if ($domain) { 1164 $domain = lc($domain); 1165 if ($domain eq 'ifa.hawaii.edu' or $domain eq 'qub.ac.uk') { 1166 $level = 2; 1167 } else { 1168 # XXX check for special users 1169 # access rights PS1 data only 1170 $level = 1; 1171 } 1172 } else { 1173 print STDERR "Error: $email is not a valid email address\n"; 1174 } 1175 } 1176 1177 return $level; 1178 } 1179 1134 1180 sub my_die 1135 1181 {
Note:
See TracChangeset
for help on using the changeset viewer.
