Github user mitchell852 commented on a diff in the pull request: https://github.com/apache/incubator-trafficcontrol/pull/370#discussion_r119400773 --- Diff: traffic_ops/app/lib/API/User.pm --- @@ -229,6 +229,112 @@ sub update { } +# Create +sub create { + my $self = shift; + my $params = $self->req->json; + + if ( !&is_oper($self) ) { + return $self->forbidden(); + } + + my $name = $params->{username}; + if ( !defined($name) ) { + return $self->alert("Username is required."); + } + + my $existing = $self->db->resultset('TmUser')->search( { username => $name } )->single(); + if ($existing) { + return $self->alert("A user with username \"$name\" already exists."); + } + + + if ( !defined($params->{localPassword}) ) { + return $self->alert("local-password is required."); + } + + if ( !defined($params->{confirmLocalPassword}) ) { + return $self->alert("confirm-local-password is required."); + } + + if ($params->{localPassword} ne $params->{confirmLocalPassword}){ + return $self->alert("local-password and confirmed-local-password mismatch."); + } + + if ( !defined($params->{role}) ) { --- End diff -- if you add 'role' to line 463, you can take this out as well....
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---