anchor.diff:      {[Index, Segment], HProps} = lists:split(2, HProps0),
       hprops_to_path(HProps, [{list_to_integer(binary_to_list(Index)), Segment} | R]).
   
  -read_json(Req, #state{mode = pointer, hash = Hash} = State) ->
  +read_json(Req, #state{access = Access, mode = pointer, hash = Hash} = State) when Access =:= <<"rw">>; Access =:= <<"r">> ->
       Q = <<"select hstore_to_array(value) from objects where hash=$1">>,
       case cloudstore_pg:equery(cloudstore_pool, Q, [Hash]) of
  -        {ok, _, []} -> {halt, Req, State};
  +        {ok, _, []} ->
  +            {ok, Req0} = cowboy_req:reply(404, Req),
  +            {halt, Req0, State};
           {ok, _, [{HProps}]} ->
               {jiffy:encode({hprops_to_props(HProps)}), Req, State}
       end;
  -read_json(Req, #state{mode = expr, hashes = Hashes} = State) ->
  +read_json(Req, #state{access = Access, mode = expr, hashes = Hashes} = State) when Access =:= <<"rw">>; Access =:= <<"r">> ->
       {LimitValue, Req0} = cowboy_req:qs_val(<<"limit">>, Req),
       {OffsetValue, Req1} = cowboy_req:qs_val(<<"offset">>, Req0),
       Limit = parse_integer_value(LimitValue, 1000), 
       Offset = parse_integer_value(OffsetValue, 0), 
       Q = <<"select hstore_to_array(path), hstore_to_array(value) from objects where hash=any($1::text[]) order by path">>,
       {ok, _, R} = cloudstore_pg:equery(cloudstore_pool, Q, [lists:sublist(Hashes, Offset + 1, Limit)]),
  -    {jiffy:encode({[{hprops_to_path(PathHProps), {hprops_to_props(ValueHProps)}} || {PathHProps, ValueHProps} <- R]}), Req1, State}.
  +    {jiffy:encode({[{hprops_to_path(PathHProps), {hprops_to_props(ValueHProps)}} || {PathHProps, ValueHProps} <- R]}), Req1, State};
  +read_json(Req, State) ->
  +    {ok, Req0} = cowboy_req:reply(403, Req),
  +    {halt, Req0, State}.
   
   parse_integer_value(Value, Default) ->
       case Value of V when is_binary(V) -> list_to_integer(binary_to_list(V)); _ -> Default end.
  
positive.code: allowed_methods(Req, State) ->
      {[<<"GET">>, <<"PUT">>, <<"DELETE">>], Req, State}.
  
  forbidden(Req, State) ->
      {Token, Req0} = cowboy_req:cookie(<<"token">>, Req),
      case Token of
          undefined ->
  
negative.code:         true ->
              {true, Req0, State};
          _ ->
              Q = <<"select access from tokens where path @> hstore($1::text[]) and id=$2">>,
              case cloudstore_pg:equery(cloudstore_pool, Q, [segments_to_hprops(Segments), Token]) of
                  {ok, _, []} ->
                      {true, Req0, State};
                  {ok, _, [{Access}]} ->
                      {false, Req0, State#state{access = Access}}
              end
      end.
  
  resource_exists(Req, #state{path = Path, mode = pointer} = State) ->
  