anchor.diff:              false
       end.
   
  -is_read_only_auth(Auth) ->
  -    case check_read_only_auth(Auth) of
  -        {true, _, _, _} ->
  -            true;
  -        false ->
  -            false
  -    end.
  -
   check_read_only_auth(Req, Auth) ->
  -    case check_read_only_auth(Auth) of
  +    case check_read_only_auth_no_ldap(Req, Auth) of
  +        false ->
  +            check_ldap(Req, Auth, [ro_admin, admin]);
  +        RV ->
  +            RV
  +    end.
  +
  +check_read_only_auth_no_ldap(Req, Auth) ->
  +    case check_read_only_auth_int(Auth) of
           {true, User, Source, Token} ->
               {true, store_user_info(Req, User, ro_admin, Source, Token)};
           false ->
  -            check_admin_auth(Req, Auth)
  -    end.
  -
  -check_read_only_auth({token, Token}) ->
  +            check_admin_auth_no_ldap(Req, Auth)
  +    end.
  +
  +check_read_only_auth_int({token, Token}) ->
       case menelaus_ui_auth:check(Token) of
           {ok, {User, ro_admin, Source}} ->
               {true, User, Source, Token};
           _ ->
               false
       end;
  -check_read_only_auth({User, Password}) ->
  -    case check_user_creds(ro_admin, User, Password) of
  -        {true, Source} ->
  -            {true, User, Source, undefined};
  +check_read_only_auth_int({User, Password}) ->
  +    case ns_config_auth:authenticate(ro_admin, User, Password) of
  +        true ->
  +            {true, User, builtin, undefined};
           false ->
               false
       end;
  -check_read_only_auth(undefined) ->
  +check_read_only_auth_int(undefined) ->
       false.
   
   extract_auth_user(Req) ->
  
positive.code: %% buckets are accessible only with admin or bucket credentials.
  -spec is_bucket_accessible({string(), list()}, any()) -> boolean().
  is_bucket_accessible(BucketTuple, Req) ->
      UserPassword = menelaus_auth:extract_auth(Req),
      F = bucket_auth_fun(UserPassword, false),
      F(BucketTuple).
  
  apply_auth(Req, F, Args) ->
      UserPassword = extract_auth(Req),
  
negative.code:         "ro_admin" ->
              BucketsAll;
          _ ->
              F = bucket_auth_fun(UserPassword),
              [Bucket || Bucket <- BucketsAll, F(Bucket)]
      end.
  
  