anchor.diff:  %   ]}
   % ]}
   
  -build_pool_info(Id) ->
  +bucket_auth_fun(User, Password) ->
  +    fun({BucketName, BucketProps}) ->
  +            case proplists:get_value(auth_plain, BucketProps) of
  +                undefined -> true;
  +                BucketPassword ->
  +                    (BucketName =:= User andalso
  +                     BucketPassword =:= Password)
  +            end
  +    end.
  +
  +build_pool_info(Id, UserPassword) ->
       MyPool = find_pool_by_id(Id),
  -    Buckets = expect_prop_value(buckets, MyPool),
       Nodes = build_nodes_info(MyPool, true),
  -    BucketsInfo = [{struct, [{uri, list_to_binary("/pools/" ++ Id ++ "/buckets/" ++ Name)},
  +    IsSuper = check_auth(UserPassword),
  +    BucketsAll = expect_prop_value(buckets, MyPool),
  +    Buckets =
  +        % We got this far, so we assume we're authorized.
  +        % Only emit the buckets that match our UserPassword;
  +        % or, emit all buckets if our UserPassword matches the rest_creds
  +        % or, emit all buckets if we're not secure.
  +        case {IsSuper, UserPassword} of
  +            {true, _}      -> BucketsAll;
  +            {_, undefined} -> BucketsAll;
  +            {_, {User, Password}} ->
  +                lists:filter(
  +                  bucket_auth_fun(User, Password),
  +                  BucketsAll)
  +        end,
  +    BucketsInfo = [{struct, [{uri, list_to_binary("/pools/" ++ Id ++
  +                                                  "/buckets/" ++ Name)},
                                {name, list_to_binary(Name)}]}
                      || Name <- proplists:get_keys(Buckets)],
       {struct, [{name, list_to_binary(Id)},
  
positive.code:     %% end.
  
  handle_pool_info(Id, Req) ->
      reply_json(Req, build_pool_info(Id)).
  
  handle_pool_info_streaming(Id, Req) ->
      %% TODO: this shouldn't be timer driven, but rather should register a callback based on some state change in the Erlang OS
      HTTPRes = Req:ok({"application/json; charset=utf-8",
                    [{"Server", "NorthScale menelaus %TODO gitversion%"}],
                    chunked}),
      Res = build_pool_info(Id),
      HTTPRes:write_chunk(mochijson2:encode(Res)),
      %% TODO: resolve why mochiweb doesn't support zero chunk... this
      %%       indicates the end of a response for now
      HTTPRes:write_chunk("\n\n\n\n"),
      handle_pool_info_streaming(Id, HTTPRes, 3000).
  
  handle_pool_info_streaming(Id, HTTPRes, Wait) ->
      receive
      after Wait ->
              Res = build_pool_info(Id),
          HTTPRes:write_chunk(mochijson2:encode(Res)),
          %% TODO: resolve why mochiweb doesn't support zero chunk... this
          %%       indicates the end of a response for now
          HTTPRes:write_chunk("\n\n\n\n")
      end,
      handle_pool_info_streaming(Id, HTTPRes, 10000).
  
  find_bucket_by_id(Pool, Id) ->
      Buckets = expect_prop_value(buckets, Pool),
  
negative.code:                      case PathTokens of
                           [] -> {done, redirect_permanently("/index.html", Req)};
                           ["pools"] ->
                               {need_auth_bucket, fun handle_pools/1};
                           ["pools", Id] ->
                               {need_auth_bucket, fun handle_pool_info/2, [Id]};
                           ["pools", Id, "stats"] ->
                               {need_auth, fun handle_bucket_stats/3, ["asd", Id]};
                           ["poolsStreaming", Id] ->
                               {need_auth, fun handle_pool_info_streaming/2, [Id]};
                           ["pools", PoolId, "buckets", Id] ->
                               {need_auth_bucket, fun handle_bucket_info/3, [PoolId, Id]};
                           ["pools", PoolId, "buckets", Id, "stats"] ->
                               {need_auth, fun handle_bucket_stats/3, [PoolId, Id]};
                           ["alerts"] ->
  