Skip to content

fix(GraphQL): Make auth work with multi-tenancy and accept CORS in schema (GRAPHQL-1016)#7431

Merged
abhimanyusinghgaur merged 20 commits intomasterfrom
abhimanyu/remove-cors
Feb 16, 2021
Merged

fix(GraphQL): Make auth work with multi-tenancy and accept CORS in schema (GRAPHQL-1016)#7431
abhimanyusinghgaur merged 20 commits intomasterfrom
abhimanyu/remove-cors

Conversation

@abhimanyusinghgaur
Copy link
Copy Markdown
Contributor

@abhimanyusinghgaur abhimanyusinghgaur commented Feb 15, 2021

It is a continuation of #7400.
This PR does a bunch of things:

  • Makes @auth work with multi-tenancy
  • Removes dgraph.graphql.schema_history leftovers
  • Removes dgraph.cors as an internal predicate and any associated admin mutations
  • Accepts CORS allowed origins through # Dgraph.Allow-Origin in GraphQL schema
  • Makes subscriptions work with GraphQL schema lazy loading
  • Adds tests for all the above scenarios

This change is Reviewable

@github-actions github-actions Bot added area/enterprise Related to proprietary features area/graphql Issues related to GraphQL support on Dgraph. area/schema Issues related to the schema language and capabilities. area/testing Testing related issues labels Feb 15, 2021
@abhimanyusinghgaur abhimanyusinghgaur changed the title fix(GraphQL): Make auth work with multi-tenancy and accept CORS in schema fix(GraphQL): Make auth work with multi-tenancy and accept CORS in schema (GRAPHQL-1016) Feb 15, 2021
Copy link
Copy Markdown
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 38 of 44 files at r1, 14 of 14 files at r2, 3 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @abhimanyusinghgaur, @manishrjain, and @vvbalaji-dgraph)


graphql/e2e/common/common.go, line 528 at r2 (raw file):

func SafelyDropAllWithGroot(t *testing.T) {
	// first, make an initial probe to get the schema update counter
	oldCounter := RetryProbeGraphQL(t, Alpha1HTTP, nil).SchemaUpdateCounter

this and the function below can be combined into one which can take a boolean parameter and do things accordingly

Copy link
Copy Markdown
Contributor Author

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain, @pawanrawal, and @vvbalaji-dgraph)


graphql/e2e/common/common.go, line 528 at r2 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

this and the function below can be combined into one which can take a boolean parameter and do things accordingly

Done.

@abhimanyusinghgaur abhimanyusinghgaur merged commit 589bc54 into master Feb 16, 2021
@abhimanyusinghgaur abhimanyusinghgaur deleted the abhimanyu/remove-cors branch February 16, 2021 11:04
NamanJain8 added a commit that referenced this pull request Mar 17, 2021
…tes) change (#7486)

Some of the internal predicates have been removed in #7431 and #7451.
When restoring from a backup taken on a version older than 21.03, we should skip restoring them.
Also, its export will fail in data loading(bulk/live load).

Instead of polluting the backup code with the restore fixation logic, we will use the dgraph upgrade tool to do the migration.
When upgrading from version 20.11 to 21.03, the changes of this PR will be applied. It will update the graphql schema with CORS information and drop the depreciated predicates/types. It will also update the persisted query.

This PR also fixes the restored backup when a --upgrade is set to true in the export_backup command. Note that persisted query is not fixed in export_backup.
NamanJain8 added a commit that referenced this pull request Mar 18, 2021
…tes) change (#7486)

Some of the internal predicates have been removed in #7431 and #7451.
When restoring from a backup taken on a version older than 21.03, we should skip restoring them.
Also, its export will fail in data loading(bulk/live load).

Instead of polluting the backup code with the restore fixation logic, we will use the dgraph upgrade tool to do the migration.
When upgrading from version 20.11 to 21.03, the changes of this PR will be applied. It will update the graphql schema with CORS information and drop the depreciated predicates/types. It will also update the persisted query.

This PR also fixes the restored backup when a --upgrade is set to true in the export_backup command. Note that persisted query is not fixed in export_backup.

(cherry picked from commit 2d36978)
NamanJain8 added a commit that referenced this pull request Mar 18, 2021
…es) change (#7486) (#7606)

Some of the internal predicates have been removed in #7431 and #7451.
When restoring from a backup taken on a version older than 21.03, we should skip restoring them.
Also, its export will fail in data loading(bulk/live load).

Instead of polluting the backup code with the restore fixation logic, we will use the dgraph upgrade tool to do the migration.
When upgrading from version 20.11 to 21.03, the changes of this PR will be applied. It will update the graphql schema with CORS information and drop the depreciated predicates/types. It will also update the persisted query.

This PR also fixes the restored backup when a --upgrade is set to true in the export_backup command. Note that persisted query is not fixed in export_backup.

(cherry picked from commit 2d36978)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/enterprise Related to proprietary features area/graphql Issues related to GraphQL support on Dgraph. area/schema Issues related to the schema language and capabilities. area/testing Testing related issues

Development

Successfully merging this pull request may close these issues.

2 participants