Parent Directory
|
Revision Log
Revision 5078 - (view) (download) (as text)
| 1 : | mleventi | 5009 | package WebworkSOAP; |
| 2 : | |||
| 3 : | use strict; | ||
| 4 : | |||
| 5 : | use WeBWorK::Utils qw(pretty_print_rh); | ||
| 6 : | use WeBWorK::Utils::CourseManagement qw(addCourse renameCourse deleteCourse listCourses archiveCourse listArchivedCourses unarchiveCourse); | ||
| 7 : | use WeBWorK::DB; | ||
| 8 : | mleventi | 5064 | use WeBWorK::DB::Utils qw(initializeUserProblem); |
| 9 : | mleventi | 5009 | use WeBWorK::CourseEnvironment; |
| 10 : | use WeBWorK::ContentGenerator::Instructor; | ||
| 11 : | |||
| 12 : | use WebworkSOAP::Classes::GlobalSet; | ||
| 13 : | use WebworkSOAP::Classes::UserSet; | ||
| 14 : | use WebworkSOAP::Classes::GlobalProblem; | ||
| 15 : | use WebworkSOAP::Classes::UserProblem; | ||
| 16 : | use WebworkSOAP::Classes::User; | ||
| 17 : | use WebworkSOAP::Classes::Key; | ||
| 18 : | use WebworkSOAP::Classes::Password; | ||
| 19 : | use WebworkSOAP::Classes::Permission; | ||
| 20 : | |||
| 21 : | #init | ||
| 22 : | |||
| 23 : | use constant { | ||
| 24 : | SOAPERROR_MAJOR => 1, | ||
| 25 : | SOAPERROR_MINOR => 2, | ||
| 26 : | SOAPERROR_CLASS_NOT_FOUND => 3, | ||
| 27 : | SOAPERROR_USER_NOT_FOUND => 4, | ||
| 28 : | SOAPERROR_SET_NOT_FOUND => 5, | ||
| 29 : | SOAPERROR_PROBLEM_NOT_FOUND => 6, | ||
| 30 : | SOAPERROR_KEY_NOT_FOUND => 7, | ||
| 31 : | SOAPERROR_AUTHEN_FAILED => 8 | ||
| 32 : | }; | ||
| 33 : | |||
| 34 : | our %SeedCE; | ||
| 35 : | mleventi | 5057 | $WebworkSOAP::SeedCE{soap_authen_key} = "123456789123456789"; |
| 36 : | $WebworkSOAP::SeedCE{webwork_dir} = "/home/mleventi/webwork_projects/webwork/webwork2/"; | ||
| 37 : | mleventi | 5009 | |
| 38 : | sub new { | ||
| 39 : | my($self,$authenKey,$courseName) = @_; | ||
| 40 : | $self = {}; | ||
| 41 : | #Construct Course | ||
| 42 : | mleventi | 5057 | my $ce = eval { new WeBWorK::CourseEnvironment({%SeedCE, courseName => $courseName }) }; |
| 43 : | mleventi | 5009 | $@ and soap_fault_major("Course Environment cannot be constructed."); |
| 44 : | #Authentication Check | ||
| 45 : | if($ce->{soap_authen_key} != $authenKey) { | ||
| 46 : | soap_fault_authen(); | ||
| 47 : | } | ||
| 48 : | #Construct DB handle | ||
| 49 : | my $db = eval { new WeBWorK::DB($ce->{dbLayout}); }; | ||
| 50 : | $@ and soap_fault_major("Failed to initialize database handle."); | ||
| 51 : | $self->{db} = $db; | ||
| 52 : | $self->{ce} = $ce; | ||
| 53 : | bless $self; | ||
| 54 : | return $self; | ||
| 55 : | } | ||
| 56 : | |||
| 57 : | sub soap_fault_authen { | ||
| 58 : | die SOAP::Fault->faultcode(SOAPERROR_AUTHEN_FAILED) | ||
| 59 : | ->faultstring("SOAP Webservice Authentication Failed!"); | ||
| 60 : | } | ||
| 61 : | |||
| 62 : | sub soap_fault { | ||
| 63 : | my ($errorCode,$errorMsg) = @_; | ||
| 64 : | die SOAP::Fault->faultcode($errorCode) | ||
| 65 : | ->faultstring($errorMsg); | ||
| 66 : | } | ||
| 67 : | |||
| 68 : | sub soap_fault_major { | ||
| 69 : | my ($errorMsg) = @_; | ||
| 70 : | soap_fault(SOAPERROR_MAJOR,$errorMsg); | ||
| 71 : | } | ||
| 72 : | #################################################################################### | ||
| 73 : | #SOAP CALLABLE FUNCTIONS | ||
| 74 : | #################################################################################### | ||
| 75 : | |||
| 76 : | =pod | ||
| 77 : | =begin WSDL | ||
| 78 : | _RETURN $string Hello World! | ||
| 79 : | =cut | ||
| 80 : | sub hello { | ||
| 81 : | return "Hello world!"; | ||
| 82 : | } | ||
| 83 : | |||
| 84 : | ################################################# | ||
| 85 : | #Course | ||
| 86 : | ################################################# | ||
| 87 : | |||
| 88 : | =pod | ||
| 89 : | =begin WSDL | ||
| 90 : | _IN authenKey $string | ||
| 91 : | _RETURN @string | ||
| 92 : | =end WSDL | ||
| 93 : | =cut | ||
| 94 : | sub list_courses { | ||
| 95 : | my ($self,$authenKey) = @_; | ||
| 96 : | mleventi | 5057 | my $ce = eval { new WeBWorK::CourseEnvironment({%WeBWorK::SeedCE })}; |
| 97 : | $@ and soap_fault_major("Internal Course Environment cannot be constructed."); | ||
| 98 : | if($authenKey != $WebworkSOAP::SeedCE{soap_authen_key}) { | ||
| 99 : | mleventi | 5009 | soap_fault_authen; |
| 100 : | } | ||
| 101 : | $@ and soap_fault_major("Course Environment cannot be constructed."); | ||
| 102 : | my @test = listCourses($ce); | ||
| 103 : | return \@test; | ||
| 104 : | } | ||
| 105 : | |||
| 106 : | =pod | ||
| 107 : | =begin WSDL | ||
| 108 : | _IN authenKey $string | ||
| 109 : | _IN courseName $string | ||
| 110 : | _IN userID $string | ||
| 111 : | _RETURN $string | ||
| 112 : | =end WSDL | ||
| 113 : | =cut | ||
| 114 : | sub login_user { | ||
| 115 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 116 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 117 : | my $newKey; | ||
| 118 : | my $timestamp = time; | ||
| 119 : | my @chars = @{ $soapEnv->{ce}->{sessionKeyChars} }; | ||
| 120 : | my $length = $soapEnv->{ce}->{sessionKeyLength}; | ||
| 121 : | srand; | ||
| 122 : | $newKey = join ("", @chars[map rand(@chars), 1 .. $length]); | ||
| 123 : | my $Key = $soapEnv->{db}->newKey(user_id=>$userID, key=>$newKey, timestamp=>$timestamp); | ||
| 124 : | eval { $soapEnv->{db}->deleteKey($userID) }; | ||
| 125 : | eval { $soapEnv->{db}->addKey($Key) }; | ||
| 126 : | $@ and soap_fault(SOAPERROR_USER_NOT_FOUND,"User not found."); | ||
| 127 : | return $newKey; | ||
| 128 : | } | ||
| 129 : | |||
| 130 : | =pod | ||
| 131 : | =begin WSDL | ||
| 132 : | _IN authenKey $string | ||
| 133 : | _IN courseName $string | ||
| 134 : | _IN userID $string | ||
| 135 : | _IN setID $string | ||
| 136 : | _RETURN $string | ||
| 137 : | =end WSDL | ||
| 138 : | =cut | ||
| 139 : | sub assign_set_to_user { | ||
| 140 : | my ($self,$authenKey,$courseName,$userID,$setID) = @_; | ||
| 141 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 142 : | my $GlobalSet = eval {$soapEnv->{db}->getGlobalSet($setID)}; | ||
| 143 : | $@ and soap_fault(SOAPERROR_SET_NOT_FOUND,"Set not found."); | ||
| 144 : | my $setID = $GlobalSet->set_id; | ||
| 145 : | my $db = $soapEnv->{db}; | ||
| 146 : | my $UserSet = $db->newUserSet; | ||
| 147 : | $UserSet->user_id($userID); | ||
| 148 : | $UserSet->set_id($setID); | ||
| 149 : | my @results; | ||
| 150 : | my $set_assigned = 0; | ||
| 151 : | eval { $db->addUserSet($UserSet) }; | ||
| 152 : | if ($@) { | ||
| 153 : | if ($@ =~ m/user set exists/) { | ||
| 154 : | push @results, "set $setID is already assigned to user $userID."; | ||
| 155 : | $set_assigned = 1; | ||
| 156 : | } else { | ||
| 157 : | die $@; | ||
| 158 : | } | ||
| 159 : | } | ||
| 160 : | mleventi | 5035 | |
| 161 : | mleventi | 5009 | my @GlobalProblems = grep { defined $_ } $db->getAllGlobalProblems($setID); |
| 162 : | foreach my $GlobalProblem (@GlobalProblems) { | ||
| 163 : | mleventi | 5057 | my $seed = int( rand( 2423) ) + 36; |
| 164 : | my $UserProblem = $db->newUserProblem; | ||
| 165 : | $UserProblem->user_id($userID); | ||
| 166 : | $UserProblem->set_id($GlobalProblem->set_id); | ||
| 167 : | $UserProblem->problem_id($GlobalProblem->problem_id); | ||
| 168 : | initializeUserProblem($UserProblem, $seed); | ||
| 169 : | eval { $db->addUserProblem($UserProblem) }; | ||
| 170 : | mleventi | 5035 | } |
| 171 : | mleventi | 5009 | return @results; |
| 172 : | } | ||
| 173 : | |||
| 174 : | mleventi | 5035 | |
| 175 : | mleventi | 5009 | #################################################################### |
| 176 : | ##FUNCTIONS DIRECTLY MAPPED TO FUNCTIONS IN DB.pm | ||
| 177 : | #################################################################### | ||
| 178 : | mleventi | 5057 | ############################################### |
| 179 : | mleventi | 5009 | ##Password |
| 180 : | mleventi | 5057 | ############################################### |
| 181 : | mleventi | 5009 | |
| 182 : | =pod | ||
| 183 : | =begin WSDL | ||
| 184 : | _IN authenKey $string | ||
| 185 : | _IN courseName $string | ||
| 186 : | _IN record $WebworkSOAP::Classes::Password | ||
| 187 : | _RETURN $integer | ||
| 188 : | =end WSDL | ||
| 189 : | =cut | ||
| 190 : | sub add_password { | ||
| 191 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 192 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 193 : | mleventi | 5035 | my $newPassword = $soapEnv->{db}->newPassword; |
| 194 : | %$newPassword = %$record; | ||
| 195 : | return $soapEnv->{db}->addPassword($newPassword); | ||
| 196 : | mleventi | 5009 | } |
| 197 : | |||
| 198 : | =pod | ||
| 199 : | =begin WSDL | ||
| 200 : | _IN authenKey $string | ||
| 201 : | _IN courseName $string | ||
| 202 : | _IN record $WebworkSOAP::Classes::Password | ||
| 203 : | _RETURN $integer | ||
| 204 : | =end WSDL | ||
| 205 : | =cut | ||
| 206 : | sub put_password { | ||
| 207 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 208 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 209 : | return $soapEnv->{db}->putPassword($record); | ||
| 210 : | } | ||
| 211 : | |||
| 212 : | =pod | ||
| 213 : | =begin WSDL | ||
| 214 : | _IN authenKey $string | ||
| 215 : | _IN courseName $string | ||
| 216 : | _RETURN @string | ||
| 217 : | =end WSDL | ||
| 218 : | =cut | ||
| 219 : | sub list_password { | ||
| 220 : | my ($self,$authenKey,$courseName) = @_; | ||
| 221 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 222 : | my @tempArray = $soapEnv->{db}->listPasswords; | ||
| 223 : | return \@tempArray; | ||
| 224 : | } | ||
| 225 : | |||
| 226 : | =pod | ||
| 227 : | =begin WSDL | ||
| 228 : | _IN authenKey $string | ||
| 229 : | _IN courseName $string | ||
| 230 : | _IN userIDs @string | ||
| 231 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::Password Array of user objects |
| 232 : | mleventi | 5009 | =end WSDL |
| 233 : | =cut | ||
| 234 : | sub get_passwords { | ||
| 235 : | my ($self,$authenKey,$courseName,$userIDs) = @_; | ||
| 236 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 237 : | mleventi | 5035 | my @passwordData = $soapEnv->{db}->getPasswords(@$userIDs); |
| 238 : | my @passwords; | ||
| 239 : | for(my $i=0;$i<@passwordData;$i++) { | ||
| 240 : | push(@passwords,new WebworkSOAP::Classes::Password(@passwordData[$i])); | ||
| 241 : | mleventi | 5009 | } |
| 242 : | mleventi | 5035 | return \@passwords; |
| 243 : | mleventi | 5009 | } |
| 244 : | |||
| 245 : | =pod | ||
| 246 : | =begin WSDL | ||
| 247 : | _IN authenKey $string | ||
| 248 : | _IN courseName $string | ||
| 249 : | _IN userID $string | ||
| 250 : | _RETURN $WebworkSOAP::Classes::Password of names objects. | ||
| 251 : | =end WSDL | ||
| 252 : | =cut | ||
| 253 : | sub get_password { | ||
| 254 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 255 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 256 : | mleventi | 5035 | my $passwordData = $soapEnv->{db}->getPassword($userID); |
| 257 : | if(not defined $passwordData) { | ||
| 258 : | return -1; | ||
| 259 : | } | ||
| 260 : | my $password = new WebworkSOAP::Classes::Password($passwordData); | ||
| 261 : | return ($password); | ||
| 262 : | mleventi | 5009 | } |
| 263 : | |||
| 264 : | ################################################## | ||
| 265 : | ##Permission | ||
| 266 : | ################################################## | ||
| 267 : | |||
| 268 : | =pod | ||
| 269 : | =begin WSDL | ||
| 270 : | _IN authenKey $string | ||
| 271 : | _IN courseName $string | ||
| 272 : | _IN record $WebworkSOAP::Classes::Permission | ||
| 273 : | _RETURN $integer | ||
| 274 : | =end WSDL | ||
| 275 : | =cut | ||
| 276 : | sub add_permission { | ||
| 277 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 278 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 279 : | mleventi | 5035 | my $newPermissionLevel = $soapEnv->{db}->newPermissionLevel; |
| 280 : | %$newPermissionLevel = %$record; | ||
| 281 : | return $soapEnv->{db}->addPermissionLevel($newPermissionLevel); | ||
| 282 : | mleventi | 5009 | } |
| 283 : | |||
| 284 : | =pod | ||
| 285 : | =begin WSDL | ||
| 286 : | _IN authenKey $string | ||
| 287 : | _IN courseName $string | ||
| 288 : | _IN record $WebworkSOAP::Classes::Permission | ||
| 289 : | _RETURN $integer | ||
| 290 : | =end WSDL | ||
| 291 : | =cut | ||
| 292 : | sub put_permission { | ||
| 293 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 294 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 295 : | return $soapEnv->{db}->putPermissionLevel($record); | ||
| 296 : | } | ||
| 297 : | |||
| 298 : | =pod | ||
| 299 : | =begin WSDL | ||
| 300 : | _IN authenKey $string | ||
| 301 : | _IN courseName $string | ||
| 302 : | _RETURN @string | ||
| 303 : | =end WSDL | ||
| 304 : | =cut | ||
| 305 : | sub list_permissions { | ||
| 306 : | my ($self,$authenKey,$courseName) = @_; | ||
| 307 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 308 : | my @tempArray = $soapEnv->{db}->listPermissionLevels; | ||
| 309 : | return \@tempArray; | ||
| 310 : | } | ||
| 311 : | |||
| 312 : | =pod | ||
| 313 : | =begin WSDL | ||
| 314 : | _IN authenKey $string | ||
| 315 : | _IN courseName $string | ||
| 316 : | _IN userIDs @string | ||
| 317 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::Permission Array of user objects |
| 318 : | mleventi | 5009 | =end WSDL |
| 319 : | =cut | ||
| 320 : | sub get_permissions { | ||
| 321 : | my ($self,$authenKey,$courseName,$userIDs) = @_; | ||
| 322 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 323 : | mleventi | 5035 | my @permissionData = $soapEnv->{db}->getPermissionLevels(@$userIDs); |
| 324 : | my @permissions; | ||
| 325 : | for(my $i=0;$i<@permissionData;$i++) { | ||
| 326 : | push(@permissions,new WebworkSOAP::Classes::Permission(@permissionData[$i])); | ||
| 327 : | mleventi | 5009 | } |
| 328 : | mleventi | 5035 | return \@permissions; |
| 329 : | mleventi | 5009 | } |
| 330 : | |||
| 331 : | =pod | ||
| 332 : | =begin WSDL | ||
| 333 : | _IN authenKey $string | ||
| 334 : | _IN courseName $string | ||
| 335 : | _IN userID $string | ||
| 336 : | _RETURN $WebworkSOAP::Classes::Permission of names objects. | ||
| 337 : | =end WSDL | ||
| 338 : | =cut | ||
| 339 : | sub get_permission { | ||
| 340 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 341 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 342 : | mleventi | 5035 | my $permissionData = $soapEnv->{db}->getPermissionLevel($userID); |
| 343 : | if(not defined $permissionData) { | ||
| 344 : | return -1; | ||
| 345 : | } | ||
| 346 : | my $permission = new WebworkSOAP::Classes::Permission($permissionData); | ||
| 347 : | return ($permission); | ||
| 348 : | mleventi | 5009 | } |
| 349 : | |||
| 350 : | ################################################## | ||
| 351 : | ##Key | ||
| 352 : | ################################################## | ||
| 353 : | |||
| 354 : | =pod | ||
| 355 : | =begin WSDL | ||
| 356 : | _IN authenKey $string | ||
| 357 : | _IN courseName $string | ||
| 358 : | _IN record $WebworkSOAP::Classes::Key | ||
| 359 : | _RETURN $integer | ||
| 360 : | =end WSDL | ||
| 361 : | =cut | ||
| 362 : | sub add_key { | ||
| 363 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 364 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 365 : | mleventi | 5035 | my $newKey = $soapEnv->{db}->newKey; |
| 366 : | %$newKey = %$record; | ||
| 367 : | return $soapEnv->{db}->addKey($newKey); | ||
| 368 : | mleventi | 5009 | } |
| 369 : | |||
| 370 : | =pod | ||
| 371 : | =begin WSDL | ||
| 372 : | _IN authenKey $string | ||
| 373 : | _IN courseName $string | ||
| 374 : | _IN record $WebworkSOAP::Classes::Key | ||
| 375 : | _RETURN $integer | ||
| 376 : | =end WSDL | ||
| 377 : | =cut | ||
| 378 : | sub put_key { | ||
| 379 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 380 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 381 : | return $soapEnv->{db}->putKey($record); | ||
| 382 : | } | ||
| 383 : | |||
| 384 : | =pod | ||
| 385 : | =begin WSDL | ||
| 386 : | _IN authenKey $string | ||
| 387 : | _IN courseName $string | ||
| 388 : | _RETURN @string | ||
| 389 : | =end WSDL | ||
| 390 : | =cut | ||
| 391 : | sub list_keys { | ||
| 392 : | my ($self,$authenKey,$courseName) = @_; | ||
| 393 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 394 : | my @tempArray = $soapEnv->{db}->listKeys; | ||
| 395 : | return \@tempArray; | ||
| 396 : | } | ||
| 397 : | |||
| 398 : | =pod | ||
| 399 : | =begin WSDL | ||
| 400 : | _IN authenKey $string | ||
| 401 : | _IN courseName $string | ||
| 402 : | _IN userIDs @string | ||
| 403 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::Key Array of user objects |
| 404 : | mleventi | 5009 | =end WSDL |
| 405 : | =cut | ||
| 406 : | sub get_keys { | ||
| 407 : | my ($self,$authenKey,$courseName,$userIDs) = @_; | ||
| 408 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 409 : | my @keyData = $soapEnv->{db}->getKeys(@$userIDs); | ||
| 410 : | my @keys; | ||
| 411 : | for(my $i=0;$i<@keyData;$i++) { | ||
| 412 : | push(@keys,new WebworkSOAP::Classes::Key(@keyData[$i])); | ||
| 413 : | } | ||
| 414 : | return \@keys; | ||
| 415 : | } | ||
| 416 : | |||
| 417 : | =pod | ||
| 418 : | =begin WSDL | ||
| 419 : | _IN authenKey $string | ||
| 420 : | _IN courseName $string | ||
| 421 : | _IN userID $string | ||
| 422 : | _RETURN $WebworkSOAP::Classes::Key of names objects. | ||
| 423 : | =end WSDL | ||
| 424 : | =cut | ||
| 425 : | sub get_key { | ||
| 426 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 427 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 428 : | my $keyData = $soapEnv->{db}->getKey($userID); | ||
| 429 : | mleventi | 5035 | if(not defined $keyData) { |
| 430 : | return -1; | ||
| 431 : | } | ||
| 432 : | mleventi | 5009 | my $key = new WebworkSOAP::Classes::Key($keyData); |
| 433 : | return ($key); | ||
| 434 : | } | ||
| 435 : | |||
| 436 : | ################################################## | ||
| 437 : | ##User | ||
| 438 : | ################################################## | ||
| 439 : | |||
| 440 : | =pod | ||
| 441 : | =begin WSDL | ||
| 442 : | _IN authenKey $string | ||
| 443 : | _IN courseName $string | ||
| 444 : | _IN record $WebworkSOAP::Classes::User | ||
| 445 : | _RETURN $integer | ||
| 446 : | =end WSDL | ||
| 447 : | =cut | ||
| 448 : | sub add_user { | ||
| 449 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 450 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 451 : | mleventi | 5035 | my $newUser = $soapEnv->{db}->newUser; |
| 452 : | %$newUser = %$record; | ||
| 453 : | return $soapEnv->{db}->addUser($newUser); | ||
| 454 : | mleventi | 5009 | } |
| 455 : | |||
| 456 : | =pod | ||
| 457 : | =begin WSDL | ||
| 458 : | _IN authenKey $string | ||
| 459 : | _IN courseName $string | ||
| 460 : | _IN record $WebworkSOAP::Classes::User | ||
| 461 : | _RETURN $integer | ||
| 462 : | =end WSDL | ||
| 463 : | =cut | ||
| 464 : | sub put_user { | ||
| 465 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 466 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 467 : | return $soapEnv->{db}->putUser($record); | ||
| 468 : | } | ||
| 469 : | |||
| 470 : | =pod | ||
| 471 : | =begin WSDL | ||
| 472 : | _IN authenKey $string | ||
| 473 : | _IN courseName $string | ||
| 474 : | _RETURN @string of names objects. | ||
| 475 : | =end WSDL | ||
| 476 : | =cut | ||
| 477 : | sub list_users { | ||
| 478 : | mleventi | 5035 | my ($self,$authenKey,$courseName) = @_; |
| 479 : | mleventi | 5009 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 480 : | my @tempArray = $soapEnv->{db}->listUsers; | ||
| 481 : | return \@tempArray; | ||
| 482 : | } | ||
| 483 : | |||
| 484 : | =pod | ||
| 485 : | =begin WSDL | ||
| 486 : | _IN authenKey $string | ||
| 487 : | _IN courseName $string | ||
| 488 : | _IN userID $string | ||
| 489 : | _RETURN $WebworkSOAP::Classes::User of names objects. | ||
| 490 : | =end WSDL | ||
| 491 : | =cut | ||
| 492 : | sub get_user { | ||
| 493 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 494 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 495 : | my $userData = $soapEnv->{db}->getUser($userID); | ||
| 496 : | mleventi | 5035 | if(not defined $userData) { |
| 497 : | return -1; | ||
| 498 : | } | ||
| 499 : | my $user = new WebworkSOAP::Classes::User($userData); | ||
| 500 : | return ($user); | ||
| 501 : | mleventi | 5009 | } |
| 502 : | |||
| 503 : | =pod | ||
| 504 : | =begin WSDL | ||
| 505 : | _IN authenKey $string | ||
| 506 : | _IN courseName $string | ||
| 507 : | _IN userIDs @string | ||
| 508 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::User Array of user objects |
| 509 : | mleventi | 5009 | =end WSDL |
| 510 : | =cut | ||
| 511 : | sub get_users { | ||
| 512 : | my ($self,$authenKey,$courseName,$userIDs) = @_; | ||
| 513 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 514 : | my @userData = $soapEnv->{db}->getUsers(@$userIDs); | ||
| 515 : | my @users; | ||
| 516 : | for(my $i=0;$i<@userData;$i++) { | ||
| 517 : | push(@users,new WebworkSOAP::Classes::User(@userData[$i])); | ||
| 518 : | } | ||
| 519 : | return \@users; | ||
| 520 : | } | ||
| 521 : | |||
| 522 : | =pod | ||
| 523 : | =begin WSDL | ||
| 524 : | _IN authenKey $string | ||
| 525 : | _IN courseName $string | ||
| 526 : | _IN userID $string | ||
| 527 : | _RETURN $integer | ||
| 528 : | =end WSDL | ||
| 529 : | =cut | ||
| 530 : | sub delete_user { | ||
| 531 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 532 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 533 : | return $soapEnv->{db}->deleteUser($userID); | ||
| 534 : | } | ||
| 535 : | |||
| 536 : | ################################################## | ||
| 537 : | ##Global Sets | ||
| 538 : | ################################################## | ||
| 539 : | |||
| 540 : | =pod | ||
| 541 : | =begin WSDL | ||
| 542 : | _IN authenKey $string | ||
| 543 : | _IN courseName $string | ||
| 544 : | _IN record $WebworkSOAP::Classes::GlobalSet | ||
| 545 : | _RETURN $integer | ||
| 546 : | =end WSDL | ||
| 547 : | =cut | ||
| 548 : | sub add_global_set { | ||
| 549 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 550 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 551 : | mleventi | 5035 | my $newGlobalSet = $soapEnv->{db}->newGlobalSet; |
| 552 : | %$newGlobalSet = %$record; | ||
| 553 : | return $soapEnv->{db}->addGlobalSet($newGlobalSet); | ||
| 554 : | mleventi | 5009 | } |
| 555 : | |||
| 556 : | =pod | ||
| 557 : | =begin WSDL | ||
| 558 : | _IN authenKey $string | ||
| 559 : | _IN courseName $string | ||
| 560 : | _IN record $WebworkSOAP::Classes::GlobalSet | ||
| 561 : | _RETURN $integer | ||
| 562 : | =end WSDL | ||
| 563 : | =cut | ||
| 564 : | sub put_global_set { | ||
| 565 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 566 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 567 : | return $soapEnv->{db}->putGlobalSet($record); | ||
| 568 : | } | ||
| 569 : | |||
| 570 : | =pod | ||
| 571 : | =begin WSDL | ||
| 572 : | _IN authenKey $string | ||
| 573 : | _IN courseName $string | ||
| 574 : | _RETURN @string of names objects. | ||
| 575 : | =end WSDL | ||
| 576 : | =cut | ||
| 577 : | sub list_global_sets { | ||
| 578 : | my ($self,$authenKey,$courseName) = @_; | ||
| 579 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 580 : | my @tempArray = $soapEnv->{db}->listGlobalSets; | ||
| 581 : | return \@tempArray; | ||
| 582 : | } | ||
| 583 : | |||
| 584 : | |||
| 585 : | =pod | ||
| 586 : | =begin WSDL | ||
| 587 : | _IN authenKey $string | ||
| 588 : | _IN courseName $string | ||
| 589 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::GlobalSet Array of user objects |
| 590 : | mleventi | 5009 | =end WSDL |
| 591 : | =cut | ||
| 592 : | sub get_all_global_sets { | ||
| 593 : | my ($self,$authenKey,$courseName) = @_; | ||
| 594 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 595 : | my @tempArray = $soapEnv->{db}->listGlobalSets; | ||
| 596 : | my @setData = $soapEnv->{db}->getGlobalSets(@tempArray); | ||
| 597 : | my @sets; | ||
| 598 : | for(my $i=0;$i<@setData;$i++) { | ||
| 599 : | push(@sets,new WebworkSOAP::Classes::GlobalSet(@setData[$i])); | ||
| 600 : | } | ||
| 601 : | return \@sets; | ||
| 602 : | } | ||
| 603 : | |||
| 604 : | =pod | ||
| 605 : | =begin WSDL | ||
| 606 : | _IN authenKey $string | ||
| 607 : | _IN courseName $string | ||
| 608 : | _IN setIDs @string | ||
| 609 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::GlobalSet Array of user objects |
| 610 : | mleventi | 5009 | =end WSDL |
| 611 : | =cut | ||
| 612 : | sub get_global_sets { | ||
| 613 : | my ($self,$authenKey,$courseName,$setIDs) = @_; | ||
| 614 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 615 : | my @setData = $soapEnv->{db}->getGlobalSets(@$setIDs); | ||
| 616 : | my @sets; | ||
| 617 : | for(my $i=0;$i<@setData;$i++) { | ||
| 618 : | push(@sets,new WebworkSOAP::Classes::GlobalSet(@setData[$i])); | ||
| 619 : | } | ||
| 620 : | return \@sets; | ||
| 621 : | } | ||
| 622 : | |||
| 623 : | =pod | ||
| 624 : | =begin WSDL | ||
| 625 : | _IN authenKey $string | ||
| 626 : | _IN courseName $string | ||
| 627 : | _IN setID $string | ||
| 628 : | mleventi | 5057 | _RETURN $WebworkSOAP::Classes::GlobalSet |
| 629 : | mleventi | 5009 | =end WSDL |
| 630 : | =cut | ||
| 631 : | sub get_global_set { | ||
| 632 : | my ($self,$authenKey,$courseName,$setID) = @_; | ||
| 633 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 634 : | my $setData = $soapEnv->{db}->getGlobalSet($setID); | ||
| 635 : | mleventi | 5035 | if(not defined $setData) { |
| 636 : | return -1; | ||
| 637 : | } | ||
| 638 : | mleventi | 5009 | my $set = new WebworkSOAP::Classes::GlobalSet($setData); |
| 639 : | return ($set); | ||
| 640 : | } | ||
| 641 : | |||
| 642 : | =pod | ||
| 643 : | =begin WSDL | ||
| 644 : | _IN authenKey $string | ||
| 645 : | _IN courseName $string | ||
| 646 : | _IN setID $string | ||
| 647 : | _RETURN $integer | ||
| 648 : | =end WSDL | ||
| 649 : | =cut | ||
| 650 : | mleventi | 5057 | sub delete_global_set { |
| 651 : | mleventi | 5009 | my ($self,$authenKey,$courseName,$setID) = @_; |
| 652 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 653 : | return $soapEnv->{db}->deleteGlobalSet($setID); | ||
| 654 : | } | ||
| 655 : | |||
| 656 : | ################################################## | ||
| 657 : | ##Global Problems | ||
| 658 : | ################################################## | ||
| 659 : | |||
| 660 : | =pod | ||
| 661 : | =begin WSDL | ||
| 662 : | _IN authenKey $string | ||
| 663 : | _IN courseName $string | ||
| 664 : | _IN record $WebworkSOAP::Classes::GlobalProblem | ||
| 665 : | _RETURN $integer | ||
| 666 : | =end WSDL | ||
| 667 : | =cut | ||
| 668 : | sub add_global_problem { | ||
| 669 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 670 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 671 : | mleventi | 5035 | my $newGlobalProblem = $soapEnv->{db}->newGlobalProblem; |
| 672 : | %$newGlobalProblem = %$record; | ||
| 673 : | return $soapEnv->{db}->addGlobalProblem($newGlobalProblem); | ||
| 674 : | mleventi | 5009 | } |
| 675 : | |||
| 676 : | =pod | ||
| 677 : | =begin WSDL | ||
| 678 : | _IN authenKey $string | ||
| 679 : | _IN courseName $string | ||
| 680 : | _IN record $WebworkSOAP::Classes::GlobalProblem | ||
| 681 : | _RETURN $integer | ||
| 682 : | =end WSDL | ||
| 683 : | =cut | ||
| 684 : | sub put_global_problem { | ||
| 685 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 686 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 687 : | return $soapEnv->{db}->putGlobalProblem($record); | ||
| 688 : | } | ||
| 689 : | |||
| 690 : | =pod | ||
| 691 : | =begin WSDL | ||
| 692 : | _IN authenKey $string | ||
| 693 : | _IN courseName $string | ||
| 694 : | mleventi | 5064 | _IN setID $string |
| 695 : | mleventi | 5009 | _RETURN @string of names objects. |
| 696 : | =end WSDL | ||
| 697 : | =cut | ||
| 698 : | sub list_global_problems { | ||
| 699 : | mleventi | 5064 | my ($self,$authenKey,$courseName,$setID) = @_; |
| 700 : | mleventi | 5009 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 701 : | mleventi | 5064 | my @tempArray = $soapEnv->{db}->listGlobalProblems($setID); |
| 702 : | mleventi | 5009 | return \@tempArray; |
| 703 : | } | ||
| 704 : | |||
| 705 : | =pod | ||
| 706 : | =begin WSDL | ||
| 707 : | _IN authenKey $string | ||
| 708 : | _IN courseName $string | ||
| 709 : | _IN setID $string | ||
| 710 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::GlobalProblem Array of user objects |
| 711 : | mleventi | 5009 | =end WSDL |
| 712 : | =cut | ||
| 713 : | sub get_all_global_problems { | ||
| 714 : | my ($self,$authenKey,$courseName,$setID) = @_; | ||
| 715 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 716 : | my @problemData = $soapEnv->{db}->getAllGlobalProblems($setID); | ||
| 717 : | my @problems; | ||
| 718 : | for(my $i=0;$i<@problemData;$i++) { | ||
| 719 : | push(@problems,new WebworkSOAP::Classes::GlobalProblem(@problemData[$i])); | ||
| 720 : | } | ||
| 721 : | return \@problems; | ||
| 722 : | } | ||
| 723 : | |||
| 724 : | =pod | ||
| 725 : | =begin | ||
| 726 : | _IN authenKey $string | ||
| 727 : | _IN courseName $string | ||
| 728 : | _IN problemIDs @string | ||
| 729 : | mleventi | 5035 | _RETURN @WebworkSOAP::Classes::GlobalProblem Array of user objects |
| 730 : | mleventi | 5009 | =end WSDL |
| 731 : | =cut | ||
| 732 : | sub get_global_problems { | ||
| 733 : | my ($self,$authenKey,$courseName,$problemIDs) = @_; | ||
| 734 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 735 : | my @problemData = $soapEnv->{db}->getGlobalProblems(@$problemIDs); | ||
| 736 : | my @problems; | ||
| 737 : | for(my $i=0;$i<@problemData;$i++) { | ||
| 738 : | push(@problems,new WebworkSOAP::Classes::GlobalProblem(@problemData[$i])); | ||
| 739 : | } | ||
| 740 : | return \@problems; | ||
| 741 : | } | ||
| 742 : | |||
| 743 : | =pod | ||
| 744 : | =begin WSDL | ||
| 745 : | _IN authenKey $string | ||
| 746 : | _IN courseName $string | ||
| 747 : | _IN setID $string | ||
| 748 : | _IN problemID $string | ||
| 749 : | _RETURN $WebworkSOAP::Classes::GlobalProblem of names objects. | ||
| 750 : | =end WSDL | ||
| 751 : | =cut | ||
| 752 : | sub get_global_problem { | ||
| 753 : | my ($self,$authenKey,$courseName,$setID,$problemID) = @_; | ||
| 754 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 755 : | my $problemData = $soapEnv->{db}->getGlobalProblem($setID,$problemID); | ||
| 756 : | if(not defined $problemData) { | ||
| 757 : | return -1; | ||
| 758 : | } | ||
| 759 : | my $problem = new WebworkSOAP::Classes::GlobalProblem($problemData); | ||
| 760 : | return ($problem); | ||
| 761 : | } | ||
| 762 : | |||
| 763 : | =pod | ||
| 764 : | =begin WSDL | ||
| 765 : | _IN authenKey $string | ||
| 766 : | _IN courseName $string | ||
| 767 : | _IN setID $string | ||
| 768 : | _IN problemID $string | ||
| 769 : | _RETURN $integer | ||
| 770 : | =end WSDL | ||
| 771 : | =cut | ||
| 772 : | sub delete_global_problem { | ||
| 773 : | my ($self,$authenKey,$courseName,$setID,$problemID) = @_; | ||
| 774 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 775 : | return $soapEnv->{db}->deleteGlobalProblem($setID,$problemID); | ||
| 776 : | } | ||
| 777 : | |||
| 778 : | ################################################## | ||
| 779 : | ##USER PROBLEM | ||
| 780 : | ################################################## | ||
| 781 : | |||
| 782 : | =pod | ||
| 783 : | =begin WSDL | ||
| 784 : | _IN authenKey $string | ||
| 785 : | _IN courseName $string | ||
| 786 : | _IN record $WebworkSOAP::Classes::UserProblem | ||
| 787 : | _RETURN $integer | ||
| 788 : | =end WSDL | ||
| 789 : | =cut | ||
| 790 : | sub add_user_problem { | ||
| 791 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 792 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 793 : | mleventi | 5035 | my $newUserProblem = $soapEnv->{db}->newUserProblem; |
| 794 : | %$newUserProblem = %$record; | ||
| 795 : | return $soapEnv->{db}->addUserProblem($newUserProblem); | ||
| 796 : | mleventi | 5009 | } |
| 797 : | |||
| 798 : | =pod | ||
| 799 : | =begin WSDL | ||
| 800 : | _IN authenKey $string | ||
| 801 : | _IN courseName $string | ||
| 802 : | _IN record $WebworkSOAP::Classes::UserProblem | ||
| 803 : | _RETURN $integer | ||
| 804 : | =end WSDL | ||
| 805 : | =cut | ||
| 806 : | sub put_user_problem { | ||
| 807 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 808 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 809 : | return $soapEnv->{db}->putUserProblem($record); | ||
| 810 : | } | ||
| 811 : | |||
| 812 : | =pod | ||
| 813 : | =begin WSDL | ||
| 814 : | _IN authenKey $string | ||
| 815 : | _IN courseName $string | ||
| 816 : | _IN userID $string | ||
| 817 : | _RETURN @string of names objects. | ||
| 818 : | =end WSDL | ||
| 819 : | =cut | ||
| 820 : | sub list_user_problems { | ||
| 821 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 822 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 823 : | my @tempArray = $soapEnv->{db}->listUserProblems($userID); | ||
| 824 : | return \@tempArray; | ||
| 825 : | } | ||
| 826 : | |||
| 827 : | =pod | ||
| 828 : | =begin WSDL | ||
| 829 : | _IN authenKey $string | ||
| 830 : | _IN courseName $string | ||
| 831 : | _IN userID $string | ||
| 832 : | _IN setID $string | ||
| 833 : | _RETURN @WebworkSOAP::Classes::UserProblem of names objects. | ||
| 834 : | =end WSDL | ||
| 835 : | =cut | ||
| 836 : | sub get_all_user_problems { | ||
| 837 : | my ($self,$authenKey,$courseName,$userID,$setID) = @_; | ||
| 838 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 839 : | my @problemData = $soapEnv->{db}->getAllUserProblems($userID,$setID); | ||
| 840 : | my @problems; | ||
| 841 : | for(my $i=0;$i<@problemData;$i++) { | ||
| 842 : | push(@problems,new WebworkSOAP::Classes::UserProblem(@problemData[$i])); | ||
| 843 : | } | ||
| 844 : | mleventi | 5035 | return \@problems; |
| 845 : | mleventi | 5009 | } |
| 846 : | |||
| 847 : | =pod | ||
| 848 : | =begin WSDL | ||
| 849 : | _IN authenKey $string | ||
| 850 : | _IN courseName $string | ||
| 851 : | _IN userProblemIDs @string | ||
| 852 : | _RETURN @WebworkSOAP::Classes::UserProblem of names objects. | ||
| 853 : | =end WSDL | ||
| 854 : | =cut | ||
| 855 : | sub get_user_problems { | ||
| 856 : | my ($self,$authenKey,$courseName,$userProblemIDs) = @_; | ||
| 857 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 858 : | my @problemData = $soapEnv->{db}->getUserProblems(@$userProblemIDs); | ||
| 859 : | my @problems; | ||
| 860 : | for(my $i=0;$i<@problemData;$i++) { | ||
| 861 : | push(@problems,new WebworkSOAP::Classes::UserProblem(@problemData[$i])); | ||
| 862 : | } | ||
| 863 : | mleventi | 5035 | return \@problems; |
| 864 : | mleventi | 5009 | } |
| 865 : | |||
| 866 : | =pod | ||
| 867 : | =begin WSDL | ||
| 868 : | _IN authenKey $string | ||
| 869 : | _IN courseName $string | ||
| 870 : | _IN userID $string | ||
| 871 : | _IN setID $string | ||
| 872 : | _IN problemID $string | ||
| 873 : | _RETURN $WebworkSOAP::Classes::UserProblem of names objects. | ||
| 874 : | =end WSDL | ||
| 875 : | =cut | ||
| 876 : | sub get_user_problem { | ||
| 877 : | my ($self,$authenKey,$courseName,$userID,$setID,$problemID) = @_; | ||
| 878 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 879 : | my $problemData = $soapEnv->{db}->getUserProblem($userID,$setID,$problemID); | ||
| 880 : | if(not defined $problemData) { | ||
| 881 : | return -1; | ||
| 882 : | } | ||
| 883 : | my $problem = new WebworkSOAP::Classes::UserProblem($problemData); | ||
| 884 : | mleventi | 5035 | return ($problem); |
| 885 : | mleventi | 5009 | } |
| 886 : | |||
| 887 : | =pod | ||
| 888 : | =begin WSDL | ||
| 889 : | _IN authenKey $string | ||
| 890 : | _IN courseName $string | ||
| 891 : | _IN userID $string | ||
| 892 : | _IN setID $string | ||
| 893 : | _IN problemID $string | ||
| 894 : | _RETURN $integer | ||
| 895 : | =end WSDL | ||
| 896 : | =cut | ||
| 897 : | sub delete_user_problem { | ||
| 898 : | my ($self,$authenKey,$courseName,$userID,$setID,$problemID) = @_; | ||
| 899 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 900 : | return $soapEnv->{db}->deleteUserProblem($userID,$setID,$problemID); | ||
| 901 : | } | ||
| 902 : | |||
| 903 : | ################################################## | ||
| 904 : | ##USER SET | ||
| 905 : | ################################################## | ||
| 906 : | |||
| 907 : | =pod | ||
| 908 : | =begin WSDL | ||
| 909 : | _IN authenKey $string | ||
| 910 : | _IN courseName $string | ||
| 911 : | _IN record $WebworkSOAP::Classes::UserSet | ||
| 912 : | _RETURN $integer | ||
| 913 : | =end WSDL | ||
| 914 : | =cut | ||
| 915 : | sub add_user_set { | ||
| 916 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 917 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 918 : | mleventi | 5035 | my $newUserSet = $soapEnv->{db}->newUserSet; |
| 919 : | %$newUserSet = %$record; | ||
| 920 : | return $soapEnv->{db}->addUserSet($newUserSet); | ||
| 921 : | mleventi | 5009 | } |
| 922 : | |||
| 923 : | =pod | ||
| 924 : | =begin WSDL | ||
| 925 : | _IN authenKey $string | ||
| 926 : | _IN courseName $string | ||
| 927 : | _IN record $WebworkSOAP::Classes::UserSet | ||
| 928 : | _RETURN $integer | ||
| 929 : | =end WSDL | ||
| 930 : | =cut | ||
| 931 : | sub put_user_set { | ||
| 932 : | my ($self,$authenKey,$courseName,$record) = @_; | ||
| 933 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 934 : | return $soapEnv->{db}->addUserSet($record); | ||
| 935 : | } | ||
| 936 : | |||
| 937 : | =pod | ||
| 938 : | =begin WSDL | ||
| 939 : | _IN authenKey $string | ||
| 940 : | _IN courseName $string | ||
| 941 : | _IN userID $string | ||
| 942 : | _RETURN @string of names objects. | ||
| 943 : | =end WSDL | ||
| 944 : | =cut | ||
| 945 : | sub list_user_sets { | ||
| 946 : | my ($self,$authenKey,$courseName,$userID) = @_; | ||
| 947 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 948 : | my @tempArray = $soapEnv->{db}->listUserSets($userID); | ||
| 949 : | return \@tempArray; | ||
| 950 : | } | ||
| 951 : | |||
| 952 : | =pod | ||
| 953 : | =begin WSDL | ||
| 954 : | _IN authenKey $string | ||
| 955 : | _IN courseName $string | ||
| 956 : | _RETURN @WebworkSOAP::Classes::UserSet of names objects. | ||
| 957 : | =end WSDL | ||
| 958 : | =cut | ||
| 959 : | sub get_all_user_sets { | ||
| 960 : | my ($self,$authenKey,$courseName) = @_; | ||
| 961 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 962 : | my @setData = $soapEnv->{db}->getAllUserSets(); | ||
| 963 : | my @sets; | ||
| 964 : | for(my $i=0;$i<@setData;$i++) { | ||
| 965 : | push(@sets,new WebworkSOAP::Classes::UserSet(@setData[$i])); | ||
| 966 : | } | ||
| 967 : | mleventi | 5035 | return \@sets; |
| 968 : | mleventi | 5009 | } |
| 969 : | |||
| 970 : | =pod | ||
| 971 : | =begin WSDL | ||
| 972 : | _IN authenKey $string | ||
| 973 : | _IN courseName $string | ||
| 974 : | _IN userSetIDs $string | ||
| 975 : | _RETURN @WebworkSOAP::Classes::UserSet of names objects. | ||
| 976 : | =end WSDL | ||
| 977 : | =cut | ||
| 978 : | sub get_user_sets { | ||
| 979 : | my ($self,$authenKey,$courseName,$userSetIDs) = @_; | ||
| 980 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 981 : | my @setData = $soapEnv->{db}->getUserSets(@$userSetIDs); | ||
| 982 : | my @sets; | ||
| 983 : | for(my $i=0;$i<@setData;$i++) { | ||
| 984 : | push(@sets,new WebworkSOAP::Classes::UserSet(@setData[$i])); | ||
| 985 : | } | ||
| 986 : | mleventi | 5035 | return \@sets; |
| 987 : | mleventi | 5009 | } |
| 988 : | |||
| 989 : | =pod | ||
| 990 : | =begin WSDL | ||
| 991 : | _IN authenKey $string | ||
| 992 : | _IN courseName $string | ||
| 993 : | _IN userID $string | ||
| 994 : | _IN setID $string | ||
| 995 : | _RETURN $WebworkSOAP::Classes::UserSet of names objects. | ||
| 996 : | =end WSDL | ||
| 997 : | =cut | ||
| 998 : | sub get_user_set { | ||
| 999 : | my ($self,$authenKey,$courseName,$userID,$setID) = @_; | ||
| 1000 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 1001 : | my $setData = $soapEnv->{db}->getUserSet($userID,$setID); | ||
| 1002 : | if(not defined $setData) { | ||
| 1003 : | return -1; | ||
| 1004 : | } | ||
| 1005 : | my $set = new WebworkSOAP::Classes::UserSet($setData); | ||
| 1006 : | return $set; | ||
| 1007 : | } | ||
| 1008 : | |||
| 1009 : | =pod | ||
| 1010 : | =begin WSDL | ||
| 1011 : | _IN authenKey $string | ||
| 1012 : | _IN courseName $string | ||
| 1013 : | _IN userID $string | ||
| 1014 : | _IN setID $string | ||
| 1015 : | _RETURN $integer | ||
| 1016 : | =end WSDL | ||
| 1017 : | =cut | ||
| 1018 : | sub delete_user_set { | ||
| 1019 : | my ($self,$authenKey,$courseName,$userID,$setID) = @_; | ||
| 1020 : | my $soapEnv = new WebworkSOAP($authenKey,$courseName); | ||
| 1021 : | return $soapEnv->{db}->deleteUserSet($userID,$setID); | ||
| 1022 : | } | ||
| 1023 : | |||
| 1024 : | |||
| 1025 : | 1; |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |