anchor.diff:  
   %% fields:
    %% username/name - in webui, name has _ inserted for , (periods) so should check that there are no periods in the name here
  - %% salt - no default - generated in webui
    %% password - no default -
  - %%   cannot be blank, must be 6 chars - encorced in webui
  - %%   it is also encrypted in webui, so might not feasible to verify restrictions here
  + %%   cannot be blank, must be 6 chars
    %% openid - default is none - no restrictions on what it can be set to
   
   -define(DEFAULT_FIELD_VALUES,
           [
             {<<"openid">>, null},
  -          {<<"admin">>, <<"false">>}
  +          {<<"admin">>, false}
           ]).
   
  --define(VALIDATION_CONSTRAINTS,
  -        [
  -          %%{<<"name">>, {match, "" }},   At the least should be non-null
  -          %%{<<"password">>, {match, "" }}, At the least should be non-null
  -          {<<"admin">>, {match, "^true$|^false$"}}
  -        ]).
  +user_spec() ->
  +  {[
  +    {<<"name">>, {string_match, username_validation_regex()}},
  +    {<<"password">>, {string_match, password_validation_regex()}},
  +    {{opt,<<"admin">>}, boolean},
  +    {{opt, <<"openid">>}, string}
  +   ]}.
   
  --type user_action() :: create.
  +username_validation_regex() ->
  +    UsernamePattern = <<"^[a-z0-9\-_]+$">>,
  +    {ok, UsernameRegex} = re:compile(UsernamePattern),
  +    {UsernameRegex, UsernamePattern}.
  +
  +password_validation_regex() ->
  +  PasswordPattern = <<".{6,}">>,
  +  {ok, PasswordRegex} = re:compile(PasswordPattern),
  +  {PasswordRegex, PasswordPattern}.
   
   assemble_user_ejson(#chef_user{username = Name,
                                  public_key = PubKey,
  
positive.code:               User,
                Defaults).
  
  -spec validate_user(ejson_term(), user_action()) -> {ok, ejson_term()}. % or throw
  validate_user(User, create) ->
    case chef_json_validator:validate_json_by_regex_constraints(User, ?VALIDATION_CONSTRAINTS) of
      ok -> {ok, User};
      Bad -> throw(Bad)
    end.
  
  %% @doc Add public and private key data to `UserEjson'. This function infers
  
negative.code: -module(chef_user).
  
  -export([assemble_user_ejson/2,
           parse_binary_json/1,
           set_key_pair/3,
           set_public_key/2]).
  
  