anchor.diff:      undefined = Req:get_header_value("menelaus-auth-src"),
       undefined = Req:get_header_value("menelaus-auth-token").
   
  -store_user_info(_Req, _User, _Role, _Source, _Token) ->
  -    erlang:error(to_be_deleted).
  -
   store_user_info(Req, {User, Src}, Token) ->
       Headers = Req:get(headers),
       H1 = mochiweb_headers:enter("menelaus-auth-user", User, Headers),
  
positive.code:         [User] -> User;
          [User, _Password] -> User
      end.
  
  %% returns function that when applied to bucket <name, config> tuple
  %% returns if UserPassword credentials allow access to that bucket.
  %%
  %% NOTE: that no-auth buckets are always accessible even without
  %% password at all
  bucket_auth_fun(Auth) ->
      fun ({BucketName, BucketProps}) ->
              case {proplists:get_value(auth_type, BucketProps),
                    proplists:get_value(sasl_password, BucketProps),
                    Auth} of
                  {none, _, undefined} ->
                      true;
                  {none, _, {BucketName, ""}} ->
                      true;
                  {sasl, "", undefined} ->
                      true;
                  {sasl, BucketPassword, {BucketName, BucketPassword}} ->
                      true;
                  _ ->
                      false
              end
      end.
  
  check_ldap(Req, Auth, AllowedRoles) ->
      case check_ldap_int(Auth, AllowedRoles) of
          {true, User, Role} ->
              {true, store_user_info(Req, User, Role, saslauthd, undefined)};
          false ->
              false
      end.
  
  check_ldap_int({token, _Token}, _) ->
      false;
  check_ldap_int({User, Password}, AllowedRoles) ->
      Role = saslauthd_auth:check(User, Password),
      case lists:member(Role, AllowedRoles) of
          true ->
              {true, User, Role};
          false ->
              false
      end;
  check_ldap_int(undefined, _) ->
      false.
  
  has_permission(Permission, Req) ->
      Identity = get_identity(Req),
  
negative.code: %% TODO RBAC: to be removed
  get_role(_Req) ->
      none.
  
  extract_auth_user(Req) ->
      case Req:get_header_value("authorization") of
  