package IIf36e12b41a7a84d25fce0419eb850e82::mod_adduser; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; use IIa67e09caf104f2e50322b7bc59b766fb; use IIcdb458e6ed5c40b1928de1833ef734bb; use IIf6c7e28bdd48eb29efc7b9362c0037a2; use II7f67ad53d58f9d59124105b4105c9e5b; use II1d17f4bae0cdcee9878216ee8bd5ec5d; use II4599daf4f7c9e8dcf3409f19788cfc0e; use IIb02f8d3064e235967de5c537b3e7ce9b; use II8cd87797a2b7926f5332e1055f4fc090; sub call { my ($class, $api, $in) = @_; return (undef, 'MISSING_EMAIL', "User's e-mail must be specified") unless $in->{email}; return (undef, 'USER_EXISTS', "There is already a user with such e-mail in the database") if II720d6e18aa34327713eb014408fc9144::llllIlIlIIIIIIlI($II982446f8950cc3dc59e487adba22df54::IlllIlIlllIIllIl{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIIlIlIlIlIIIl},114,$II982446f8950cc3dc59e487adba22df54::IlllIlIlllIIllIl{$II720d6e18aa34327713eb014408fc9144::IIIIIIllIIlllIIl})->search(email => $in->{email})->[0]; my $user = II8dae0e141ee45f5daba6a74e4a7c3b6f::llIIlIIlIIIIlIlI($II8dae0e141ee45f5daba6a74e4a7c3b6f::IIllllIllllllIll{$II982446f8950cc3dc59e487adba22df54::IIIllIlIlIIIllII},114,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IIllllIllllllIll{$IIb39071a48a82a07eeb9256f406abebc5::llIIllIlIIlIllII})->get; for my $f ($user->fieldsWithExtObjects) { $user->{$f} = $in->{$f} if exists $in->{$f}; } $user->{regtime} = II720d6e18aa34327713eb014408fc9144::lIIlIIlIIIIlIIIl($II720d6e18aa34327713eb014408fc9144::IlIlIllIlIlIIlll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::lIIIIIIIllIIIIIl},1010,$II720d6e18aa34327713eb014408fc9144::IlIlIllIlIlIIlll{$II982446f8950cc3dc59e487adba22df54::lIlIlllIIIlIlIll})->new->datetime; $user->{reg_ip} ||= $ENV{REMOTE_ADDR}; $user->{signature} = undef; $user->finalizeRegistration; while (my ($k, $v) = each %$in) { if ($k =~ /^assign_membership_(\d+)/) { if (my $mem = II720d6e18aa34327713eb014408fc9144::IlllIllllIllIIIl($II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIIIlIlIlIII{$II982446f8950cc3dc59e487adba22df54::IllllIlIIIlIIIII},162,$II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIIIlIlIlIII{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlllllIllIIlIl})->search(id => $1)->[0]) { II8dae0e141ee45f5daba6a74e4a7c3b6f::lllIllIIIllIllII($IIb39071a48a82a07eeb9256f406abebc5::IlllIIlIllllIIIl{$II982446f8950cc3dc59e487adba22df54::llIlIIlllIlIlIlI},7,$IIb39071a48a82a07eeb9256f406abebc5::IlllIIlIllllIIIl{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllllIIIIIlIllIl})->get->set( type => 'membership', user_id => $user->{id}, obj_id => $mem->{id}, obj_title => $mem->{url}, expires => ($in->{$k} || undef), )->save; } } elsif ($k =~ /^assign_role_(\d+)/) { if (my $role = II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIIIIIIlllIlII($II8dae0e141ee45f5daba6a74e4a7c3b6f::IIlllIIIlIIIlIlI{$II720d6e18aa34327713eb014408fc9144::llIlIIIIlIllIIll},20,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IIlllIIIlIIIlIlI{$II982446f8950cc3dc59e487adba22df54::IlIllIlIlIIlIlll})->search(id => $1)->[0]) { II8dae0e141ee45f5daba6a74e4a7c3b6f::llIIlIIlIIIIlIlI($IIb39071a48a82a07eeb9256f406abebc5::IlllIllIllIllIll{$IIb39071a48a82a07eeb9256f406abebc5::llllIIIlllllIlII},107,$IIb39071a48a82a07eeb9256f406abebc5::IlllIllIllIllIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlllllIllIIlIl})->get->set( user_id => $user->{id}, role_id => $role->{id}, role_title => $role->{title}, expires => ($in->{$k} || undef), )->save; } } elsif ($k =~ /^assign_affprog_(\d+)/) { if (my $affprog = II8dae0e141ee45f5daba6a74e4a7c3b6f::llIIlIIlIIIIlIlI($II8dae0e141ee45f5daba6a74e4a7c3b6f::IIllllIllllllIll{$IIb39071a48a82a07eeb9256f406abebc5::lIlIlIllIlllIIII},77,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IIllllIllllllIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllllIIIIIlIllIl})->search(id => $1)->[0]) { II720d6e18aa34327713eb014408fc9144::lIIlIIIIllIllIIl($II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$II720d6e18aa34327713eb014408fc9144::llIlIlIIIIIlIIlI},157,$II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$IIb39071a48a82a07eeb9256f406abebc5::IIlIllIIlIIIlIIl})->get->set( user_id => $user->{id}, affprog_id => $affprog->{id}, affprog_title => $affprog->{title}, expires => ($in->{$k} || undef), )->save; } } } return +{ ID => $user->id }; } 1; 