anchor.diff:  check_auth_bucket(Req, Auth, BucketTuple, ReadOnlyOk) ->
       RV = case ReadOnlyOk of
                true ->
  -                 check_read_only_auth(Req, Auth);
  +                 check_read_only_auth_no_ldap(Req, Auth);
                false ->
  -                 check_admin_auth(Req, Auth)
  +                 check_admin_auth_no_ldap(Req, Auth)
            end,
       case RV of
           {true, _NewReq} ->
               RV;
           false ->
  -            F = bucket_auth_fun(Auth, ReadOnlyOk),
  +            F = bucket_auth_fun(Auth),
               case F(BucketTuple) of
                   true ->
                       {true, store_bucket_auth(Req, Auth)};
                   false ->
  -                    false
  +                    AllowedRoles = case ReadOnlyOk of
  +                                       true ->
  +                                           [ro_admin, admin];
  +                                       false ->
  +                                           [admin]
  +                                   end,
  +                    check_ldap(Req, Auth, AllowedRoles)
               end
       end.
   
  -check_auth(Auth) ->
  -    case check_admin_auth_int(Auth) of
  -        {true, _User, _Source, _Token} ->
  -            true;
  -        false ->
  -            false
  -    end.
  -
   check_admin_auth(Req, Auth) ->
  +    case check_admin_auth_no_ldap(Req, Auth) of
  +        false ->
  +            check_ldap(Req, Auth, [admin]);
  +        RV ->
  +            RV
  +    end.
  +
  +check_admin_auth_no_ldap(Req, Auth) ->
       case check_admin_auth_int(Auth) of
           {true, User, Source, Token} ->
               {true, store_user_info(Req, User, admin, Source, Token)};
  
positive.code: 
  %% Checks if given credentials allow access to any SASL-auth
  %% bucket.
  check_auth_any_bucket(Req, UserPassword) ->
      case check_read_only_auth(Req, UserPassword) of
          {true, _NewReq} = RV ->
              RV;
          false ->
              Buckets = ns_bucket:get_buckets(),
              case lists:any(bucket_auth_fun(UserPassword, true),
                             Buckets) of
                  true ->
                      {true, store_bucket_auth(Req, UserPassword)};
                  false ->
                      false
              end
      end.
  
  
negative.code:         "ro_admin" ->
              BucketsAll;
          _ ->
              F = bucket_auth_fun(UserPassword),
              [Bucket || Bucket <- BucketsAll, F(Bucket)]
      end.
  
  