anchor.diff:      lfm_proxy:schedule_file_replication(ScheduleNode, SessionId, FileKey, ProviderId).
   
   schedule_file_replication_by_rest(Worker, ProviderId, User, {path, FilePath}, Config) ->
  -    case rest_test_utils:request(Worker,
  -        <<"replicas/", FilePath/binary, "?provider_id=", ProviderId/binary>>,
  -        post, [?USER_TOKEN_HEADER(Config, User)], []
  -    ) of
  -        {ok, 200, _, Body} ->
  -            DecodedBody = json_utils:decode(Body),
  -            #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
  -            {ok, Tid};
  -        {ok, 400, _, Body} ->
  -            {error, Body}
  +    HTTPPath = <<"replicas/", FilePath/binary, "?provider_id=", ProviderId/binary>>,
  +    Headers = [?USER_TOKEN_HEADER(Config, User)],
  +    SpaceId = ?config(?SPACE_ID_KEY, Config),
  +
  +    AllSpacePrivs = privileges:space_privileges(),
  +    SpacePrivs = AllSpacePrivs -- [?SPACE_SCHEDULE_REPLICATION],
  +    UserSpacePrivs = rpc:call(Worker, initializer, node_get_mocked_space_user_privileges, [SpaceId, User]),
  +    ErrorForbidden = rest_test_utils:get_rest_error(?ERROR_FORBIDDEN),
  +
  +    try
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, SpacePrivs -- [?SPACE_SCHEDULE_REPLICATION]),
  +        {ok, Code1, _, Resp1} = rest_test_utils:request(Worker, HTTPPath, post, Headers, []),
  +        ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp1)}),
  +
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, SpacePrivs ++ [?SPACE_SCHEDULE_REPLICATION]),
  +        case rest_test_utils:request(Worker, HTTPPath, post, Headers, []) of
  +            {ok, 200, _, Body} ->
  +                DecodedBody = json_utils:decode(Body),
  +                #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
  +                {ok, Tid};
  +            {ok, 400, _, Body} ->
  +                {error, Body}
  +        end
  +    after
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, UserSpacePrivs)
       end;
   schedule_file_replication_by_rest(Worker, ProviderId, User, {guid, FileGuid}, Config) ->
  +    SpaceId = file_id:guid_to_space_id(FileGuid),
       {ok, FileObjectId} = file_id:guid_to_objectid(FileGuid),
  -    case rest_test_utils:request(Worker,
  -        <<"replicas-id/", FileObjectId/binary, "?provider_id=", ProviderId/binary>>,
  -        post, [?USER_TOKEN_HEADER(Config, User)], []
  -    ) of
  -        {ok, 200, _, Body} ->
  -            DecodedBody = json_utils:decode(Body),
  -            #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
  -            {ok, Tid};
  -        {ok, 400, _, Body} ->
  -            {error, Body}
  +    HTTPPath = <<"replicas-id/", FileObjectId/binary, "?provider_id=", ProviderId/binary>>,
  +    Headers = [?USER_TOKEN_HEADER(Config, User)],
  +
  +    AllSpacePrivs = privileges:space_privileges(),
  +    SpacePrivs = AllSpacePrivs -- [?SPACE_SCHEDULE_REPLICATION],
  +    UserSpacePrivs = rpc:call(Worker, initializer, node_get_mocked_space_user_privileges, [SpaceId, User]),
  +    ErrorForbidden = rest_test_utils:get_rest_error(?ERROR_FORBIDDEN),
  +
  +    try
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, SpacePrivs -- [?SPACE_SCHEDULE_REPLICATION]),
  +        {ok, Code1, _, Resp1} = rest_test_utils:request(Worker, HTTPPath, post, Headers, []),
  +        ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp1)}),
  +
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, SpacePrivs ++ [?SPACE_SCHEDULE_REPLICATION]),
  +        case rest_test_utils:request(Worker, HTTPPath, post, Headers, []) of
  +            {ok, 200, _, Body} ->
  +                DecodedBody = json_utils:decode(Body),
  +                #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
  +                {ok, Tid};
  +            {ok, 400, _, Body} ->
  +                {error, Body}
  +        end
  +    after
  +        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, User, UserSpacePrivs)
       end.
   
   schedule_replication_by_index(ScheduleNode, ProviderId, User, SpaceId, IndexName, QueryViewParams, Config, lfm) ->
  
positive.code: 
  schedule_replica_migration_by_index_via_rest(ScheduleNode, ProviderId, User, SpaceId, IndexName, QueryViewParams, Config, MigrationProviderId) ->
      QueryParamsBin = create_query_string(QueryViewParams),
      case rest_test_utils:request(ScheduleNode,
          <<"replicas-index/", IndexName/binary, "?provider_id=", ProviderId/binary,
              "&migration_provider_id=", MigrationProviderId/binary, "&space_id=", SpaceId/binary, QueryParamsBin/binary
          >>,
          delete, [?USER_TOKEN_HEADER(Config, User)], []
      ) of
          {ok, 200, _, Body} ->
              DecodedBody = json_utils:decode(Body),
              #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
              {ok, Tid};
          {ok, 400, _, Body} ->
              {error, Body}
      end.
  
  cancel_transfer(ScheduleNode, Tid, Config, lfm) ->
  
negative.code: 
  schedule_replica_eviction_by_index_via_rest(ScheduleNode, ProviderId, User, SpaceId, IndexName, QueryViewParams, Config) ->
      QueryParamsBin = create_query_string(QueryViewParams),
      HTTPPath = <<"replicas-index/", IndexName/binary, "?provider_id=", ProviderId/binary, "&space_id=", SpaceId/binary, QueryParamsBin/binary>>,
      Headers = [?USER_TOKEN_HEADER(Config, User)],
  
      AllSpacePrivs = privileges:space_privileges(),
      SpacePrivs = AllSpacePrivs -- [?SPACE_SCHEDULE_EVICTION, ?SPACE_QUERY_INDICES],
      UserSpacePrivs = rpc:call(ScheduleNode, initializer, node_get_mocked_space_user_privileges, [SpaceId, User]),
      ErrorForbidden = rest_test_utils:get_rest_error(?ERROR_FORBIDDEN),
  
      try
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs),
          {ok, Code1, _, Resp1} = rest_test_utils:request(ScheduleNode, HTTPPath, post, Headers, []),
          ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp1)}),
  
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs ++ [?SPACE_SCHEDULE_EVICTION]),
          {ok, Code2, _, Resp2} = rest_test_utils:request(ScheduleNode, HTTPPath, post, Headers, []),
          ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp2)}),
  
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs ++ [?SPACE_QUERY_INDICES]),
          {ok, Code2, _, Resp2} = rest_test_utils:request(ScheduleNode, HTTPPath, post, Headers, []),
          ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp2)}),
  
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs ++ [?SPACE_SCHEDULE_EVICTION, ?SPACE_QUERY_INDICES]),
          case rest_test_utils:request(ScheduleNode, HTTPPath, delete, Headers, []) of
              {ok, 200, _, Body} ->
                  DecodedBody = json_utils:decode(Body),
                  #{<<"transferId">> := Tid} = ?assertMatch(#{<<"transferId">> := _}, DecodedBody),
                  {ok, Tid};
              {ok, 400, _, Body} ->
                  {error, Body}
          end
      after
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, UserSpacePrivs)
      end.
  
  schedule_replica_migration(ScheduleNode, ProviderId, User, FileKey, Config, lfm, MigrationProviderId) ->
  