Commit Graph

806 Commits

Author SHA1 Message Date
Florent Vilmart
7319aabf7a improves test performance on mongodb (#4862)
* improves test performance on mongodb

* Removes unused methdos
2018-08-12 17:49:09 -04:00
Florent Vilmart
6b36ce1bb5 Ensure User ACL's are more flexible and secure #3588 (#4860)
* Fixes an issue that would let the beforeDelete be called when user has no access to the object

* Ensure we properly lock user

- Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey
- This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios

* nits

* Caps insufficient
2018-08-12 17:49:09 -04:00
greenkeeper[bot]
320eba1081 Update mongodb to the latest version 🚀 (#4855)
* fix(package): update mongodb to version 3.1.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile

* starting mongo 3.1.0, read preferences are passed again

* Adds test confirming #4831 is properly functional now
2018-08-12 17:49:09 -04:00
Chris
43be9fed9d #4678: Converting strings to Date when schema.type is Date within agg… (#4743)
* #4678: Converting strings to Date when schema.type is Date within aggregate function

* Added test cases to test new date match aggregate query

* Added function to parse match aggregate arguments and convert necessary values to Date objects

* Added missing return value

* Improved code quality based on suggestions and figured out why tests were failing

* Added tests from @dplewis

* Supporting project aggregation as well as exists operator

* Excluding exists match for postgres

* Handling the $group operator similar to $match and $project

* Added more tests for better code coverage

* Excluding certain tests from being run on postgres

* Excluding one more test  from postgres

* clean up
2018-08-12 17:49:09 -04:00
Diamond Lewis
df01846361 Aggregate allow multiple of same stage (#4835)
* Aggregate Allow Multiple Stages

* remove testing files

* nit

* spread them
2018-08-12 17:49:09 -04:00
Diamond Lewis
197190fc29 nit 2018-08-12 17:49:09 -04:00
Diamond Lewis
48ddcdb303 add includeAll option 2018-08-12 17:49:09 -04:00
Johnny
c8b303a9d2 Added verify password to users router and tests. (#4747)
* Added verify password to users router and tests.

* Added more tests to support more coverage.

* Added additional tests to spec. Removed condition from verifyPassword function where authData null keys condition wasn't necessary.

* Removed POST handling from verifyPassword.

* Refactored handleLogin and handleVerifyPassword to use shared helper function to validate the password provided in the request.

* Refactored verifyPassword and login to not use try/catch. Parent promise returns the error. Moved login specific functions to login handler.

* Added account lockout policy to verify password function. Added test spec for account lockout in verify password.

* no message

* Merged new changes from master. Made changes as requested from comments.

* We cannot remove hidden properties from the helper before returning to the login function. The password expiration check in the login function is dependent on some hidden properties, otherwise three password policy tests fail.
2018-08-12 17:49:09 -04:00
Florent Vilmart
4d81f8fc30 Ensure read preference is never overriden, so DB config prevails (#4833) 2018-08-12 17:49:09 -04:00
Manuel
cddb924703 add support for geoWithin.centerSphere queries via withJSON (#4825)
* add support for geoWithin.centerSphere queries via withJSON

* added test for passing array of lat, lng instead of Parse.GeoPoint

* added postgres support

* added more tests

* improved tests and validation

* added more tests
2018-08-12 17:49:09 -04:00
Arthur Cinader
1427eeac5a Don't error when attempting to sort on an object field (#4806)
* add failing test to demonstrate that you can't sort on a
field in an object.

* Only validate the base of the field name.

* fix test name

* Only test sort for mongo.

* pg order by nested object

* level 2 test

* Factor out operation to get a field's base name.  Add comment.

* tweak comment wording so it wont make my grammar teacher angry.
2018-08-12 17:49:09 -04:00
Jaeger
348489784a Don't merge JSON fields after save() when using Postgres to keep same behaviour as MongoDB (#4808) (#4815) 2018-08-12 17:49:09 -04:00
Florent Vilmart
d15a3ce8f5 Adds exposed headers to avoid issue in JS SDK (#4934)
* Adds exposed headers to avoid issue in JS SDK

* Adds test for headers
2018-08-07 11:19:49 -04:00
Florent Vilmart
9bff44b446 Ensure users with undefined ACL are treated as readable (#4795)
* Adds test to reproduce issue #4790

* Attempt to allow failure on node STABLE

* Use new format for apt packages
2018-05-30 12:55:15 -04:00
Mads Bjerre
57da2def1d Adds withinPolygon support for Polygon object (#4067)
* Whitespace

* Add Polygon type to $polygon query

* Add tests

Polygon object in $polygon query
$geoIntersects queries

* Refactor

* Postgres support

* More tests

* Remove duplicate test

* Missing semicolon

* fix tests
2018-05-22 12:06:43 -04:00
Florent Vilmart
a619119684 Bumps minimum node engine to 8+ (#4474)
* Use node 8 as development environment

* fixup! Use node 8 as development environment

* bump node to 8.10

* Targets node 8 for everything

* Run npm install so lock file is up to date

* Use push adapter v3

* Deflake a test on ParseUser

* Adds slight delay after logout

* Ensure we wait even if call fails

* Use node carbon
2018-05-18 15:49:00 -04:00
Jérémy Piednoel
77ed10f57b Adding $nor operator support (#4768)
* adding nor to specialQuerykeys

* adding nor suport

* adding test

* CRLF

* adding postgres NOR

* adding nor validation

* adding NOR test

* adding test amd fixing NOR cases

* revert the nor logic
2018-05-18 14:26:33 -05:00
Florent Vilmart
fc47f9b84f issue(afterFind): Fixes issue when using afterFind with relations (#4752)
* Adds failing test for the issue

* Adds fix for the issue
2018-05-18 09:36:56 -04:00
Jérémy Piednoel
c0f86ae1d1 Adding Mongodb element to add arrayMatches the #4762 (#4766)
* Adding elemMatch and nor

* lint

* adding test

* adding edge test

* postgres support

* clean up

* empty test
2018-05-18 08:35:50 -05:00
Florent Vilmart
ad244d6654 feature: User Lockout (#4749)
* Allows masterKey to lock _User object and prevent login with email / password

* Ensure the authData based auth can be locked out as well when accounts is masterKey only
2018-05-16 15:40:02 -04:00
Eduard Bosch Bertran
c0e3672e32 New query condition support to match all strings that starts with some other given strings (#3864)
* feat: Convert $regex value to RegExp object

* feat: Add lib folder

* Revert "feat: Add lib folder"

This reverts commit c9dfbcbf699ff220baeb2df5586a944d19808e5e.

* feat: Add $regex test in $all array

* test: Test regex with $all only in MongoDB

* Revert "test: Test regex with $all only in MongoDB"

This reverts commit d7194c7869dee98d924fbc2502593a198385dba1.

* feat: Add tests for containsAllStartingWith

* feat: Add postgres support

Thanks to @dplewis

* feat: Check that all values in $all must be regex or none

* test: Check that $all vaules must be regex or none

* feat: Update tests to use only REST API

* refactor: Move $all regex check to adapter

* feat: Check for valid $all values in progres

* refactor: Update function name

* fix:  Postgres $all values regex checking

* fix: Check starts with as string

* fix: Define contains all regex sql function

* fix: Wrong value check

* fix: Check valid data

* fix: Check regex when there is only one value

* fix: Constains all starting with string returns empty with bad params

* fix: Pass correct regex value

* feat: Add missing tests

* feat: Add missing tests

* feat: Add more tests

* fix: Unify MongoDB and PostgreSQL functionality

* fix: Lint checks

* fix: Test broken

$regex in $all list must be { $regex: "string" }

* test for empty $all
2018-05-15 20:42:32 -05:00
Vitaly Tomilov
a1f5f37af7 upgrading pg-promise to 8.4.0 (#4736) 2018-05-01 13:27:29 -04:00
Florent Vilmart
fad7b46c65 chore: Fixes issue related to flow types (#4724)
* Fixes issue related to flow types

* Improves type inference on where clause, index

* run parse-server start on liveQueryServer only on mongo, state leaks on postgres
2018-05-01 07:37:38 -04:00
Claire Neveu
04588bccb9 Allow creation of indices on default fields (#4738)
* Allow creation of indexes on default fields

* Update test

* Try to address flaky cache test
2018-04-25 16:06:10 -07:00
Diamond Lewis
0fd8493929 Fix purging empty class (#4676)
* Fix purging empty class

* remove fit
2018-03-25 08:41:25 -05:00
Diamond Lewis
710848938f PG: Fixes issues comparing to zero or false (#4667)
* initial test

* more test

* clean up

* added correct errors

* test fix

* $eq null test

* type check
2018-03-24 17:45:34 -05:00
Diamond Lewis
c36ef99368 Fix Aggregate Match Pointer (#4643) 2018-03-14 21:57:30 -05:00
Diamond Lewis
c6bc81caef Mongo: Fix reversing polygon coordinates (#4609)
* Fix reversing polygon coordinates

* comments fix

* real data test

* improved tests
2018-03-10 14:27:03 -06:00
Diamond Lewis
f0674df424 Fixes Issue unsetting in beforeSave doesn't allow object creation (#4610)
* skip unset fields on canAddField

* removed fit

* add null check
2018-03-08 10:31:53 -06:00
maciej-ka
9db63a4a50 fix: failing tests with dates in local time 2018-03-01 10:24:24 -08:00
Diamond Lewis
d8f3fb16bd Skip afterFind for Aggregate and Distinct Queries (#4596) 2018-02-28 19:32:01 -06:00
6thfdwp
213801c4b1 auth: add adapter for Facebook accountkit login (#4434)
* Integrate auth adapter for Facebook accountkit login

* Also verify Facebook app id associated with account kit login

* Add appsecret_proof as extra graph request parameter

* Specific error message for Account kit and more test coverage

* One more test to cover when AppIds for Facebook account kit not configured properly
2018-02-23 07:37:55 -05:00
Florent Vilmart
b754d51e8e chore(package): update jasmine to version 3.0.0 (#4553)
* chore(package): update jasmine to version 3.0.0

Closes #4547

* Fixes failing tests for jasmine 3.0

Starting 3.0, done(something) will fail

* Update tests so they dont leverage var, but let and const

With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var`

* Remove randomizer

* Use same adapter for PG tests, drop table to ensure the tests dont side effect
2018-02-17 09:55:30 -05:00
Diamond Lewis
143b0f01cf PG: Add dates to group aggregate (#4549)
* PG: Add dates to group aggregate

* returns dates as UTC
2018-02-16 12:41:02 -06:00
Diamond Lewis
848a6cf7ae Distinct support for null (#4559)
* distinct support for null

* better testing
2018-02-16 10:44:42 -05:00
fridays
8be7491595 Fix server crash on invalid LiveQuery socket event (#4533)
* add failing test for missing command message

* don't mock tv4.validate

* fix existing tests

* make request.op required

* Update comment
2018-02-16 08:40:04 -05:00
Diamond Lewis
3cd77eeb7c duplicate value on unique index error (#4560) 2018-02-09 07:39:35 -06:00
Benjamin Wilson Friedman
db8594dd33 Regenerate Email Verification Token on Email Request (#4439)
* regenerate email verification token & expiration in /verificationEmailRequest

* Remove password field when saving on postgres
2018-02-01 18:35:08 -05:00
Paulo Reis
f2e21b0538 Additional test for emailVerified set to false on email changed from existing (#4532)
* Create a test to check the issue #4501
* Check if after the user confirms the email and change the email again a new verification email is sent
* Change the spec text to requested in PR
2018-02-01 14:39:57 -08:00
Florent Vilmart
401cc357e5 Fixes issue affecting sorting in beforeFind (#4519)
* Fixes issue affecting sorting in beforeFind

* Update CloudCode.spec.js
2018-01-24 15:15:05 -05:00
Diamond Lewis
64e568d000 Improved match aggregate (#4495)
* Improve aggregate queries

* using pg-promise query formatting

* match multiple comparison

* $or and complex match
2018-01-20 08:00:36 -06:00
Florent Vilmart
33890bbbfc Do not mark the empty pushs as failed (#4497) 2018-01-13 15:12:19 -05:00
Diamond Lewis
8ec07b83d0 Support pointer in aggregate query (#4493) 2018-01-08 20:42:08 -06:00
Paulo Reis
cb8f038ca8 #4338 pg schema upgrade (#4375)
* Method to upgrade schemas in Postgres;

Adds:
  - schemaUpgrade method which check the fields to add and delete from old schema;

* Remove the columns delete in schemaUpgrade method;

* ESLint fix and PostgresStorageAdapter.schemaUpgrade spec test

Adds:
  - Add PostgresStorageAdapter.schemaUpgrade spec tests: creates a table,
    simulates the addition of a new field and checks if its present in the database
Chores:
  - ESLint eol-last fix;

* Add check columns before and after schema upgrade, and remove the unnecessary piece of code

Add:
  - Check the right columns is present before schema upgrade and the new field is not,
    then check if the right columns is present and the new field;
Remove:
  - Piece of code unnecessary because it not need to remove diff columns;

* Optimize the schemaUpgrade method following @vitaly-t instructions, and more tests;

* If the class does not have any columns and needs an upgrade the code would
return without doing so. Fixed this.

Chore:
  - Allows class with no column to be upgraded;
  - Test for class with no columns being upgraded;

* Update PostgresStorageAdapter.js

rewriting method schemaUpgrade

* Update PostgresStorageAdapter.spec.js

* Update PostgresStorageAdapter.spec.js
2018-01-03 03:23:05 +00:00
Florent Vilmart
10631371e6 Introduces flow types for storage (#4349)
* Introduces flow types for storage

* Better typing of QueryOptions

* Adds flow types to SchemaCOntroller,

- runs flow on pre tests
- fixes flow

* Adds ClassLevelPermissions type

* Moves Controller types into a single file

* Changes import styles

* Changes import styles

* fixing method setIndexesWithSchemaFormat (#4454)

Fixing invalid database code in method `setIndexesWithSchemaFormat`:

* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters

* nits

* Fixes tests, improves flow typing
2017-12-30 20:44:18 -05:00
Diamond Lewis
6143988a82 Support pointer in distinct query (#4471)
* Support pointer in distinct query

* extract transform pointer string
2017-12-29 21:32:40 -06:00
Benjamin Wilson Friedman
7a9d4044af Scrub Passwords with URL Encoded Characters (#4433)
* scrub passwords with url encoded characters from logs

* compose query string from parsed params, redacting based on key if needed
2017-12-29 13:16:32 -05:00
Diamond Lewis
04f8673edd PG: Support for multiple projection in aggregate (#4469) 2017-12-29 17:39:16 +00:00
Florent Vilmart
bad217911c Adds ability to login with email when provided as username (#4420) 2017-12-12 08:49:45 -05:00
Florent Vilmart
1f22ee36e7 Release 2.7.1
(#4410)
* Adds failing test for 4409

* Adds fix

*  Release 2.7.1
2017-12-01 09:16:58 -05:00