Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ACL operations using the admin GraphQL API #4760

Merged
merged 30 commits into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1369ca8
Add new acl predicates
animesh2049 Jan 31, 2020
47a6ffe
Add test and fix typos
animesh2049 Feb 3, 2020
37519c9
Use new ACL schema in acl tool
animesh2049 Feb 3, 2020
734439b
Fix tests
animesh2049 Feb 4, 2020
44c40e9
Minor typo fixes
animesh2049 Feb 4, 2020
9ab121c
Fix test
animesh2049 Feb 4, 2020
5d0e0a6
Remove debugging statements
animesh2049 Feb 6, 2020
37d81a1
Change acl predicate names
animesh2049 Feb 6, 2020
4d0a39e
Delete rule if permission is negative
animesh2049 Feb 6, 2020
dfd71b1
Add test for rule deletion
animesh2049 Feb 6, 2020
aa82224
Delete updateACL function and its tests
animesh2049 Feb 6, 2020
62a3145
Merge branch 'animesh2049/acl-schema-change' into pawanrawal/graphql-acl
pawanrawal Feb 7, 2020
a6be087
Add the ACL schema to admin GraphQL schema. Atleast it doesn't panic …
pawanrawal Feb 7, 2020
8cb1bf5
Update the schema and add resolvers for the query. We are able to que…
pawanrawal Feb 7, 2020
9b111dc
Add some TODOs.
pawanrawal Feb 7, 2020
0339fcb
Modify Admin schema to make addUser kind of work. Its still got a bug…
pawanrawal Feb 7, 2020
1f12f15
Change permission to an Int for now to make it work. Also test that a…
pawanrawal Feb 10, 2020
157d132
deleteGroup and deleteUser also kind of work but don't delete the lin…
pawanrawal Feb 10, 2020
4964517
Fix test CreateAndDeleteUsers
pawanrawal Feb 11, 2020
c691cfb
Write a function for addGroup and adding user to group.
pawanrawal Feb 11, 2020
0a65ad6
Start using the API for adding rules to groups.
pawanrawal Feb 11, 2020
7df639c
Fixed all but one ACL tests to use the new API.
pawanrawal Feb 11, 2020
02d8532
Merge branch 'pawanrawal/graphql-acl' into pawanrawal/acl-on-graphql
pawanrawal Feb 11, 2020
c106576
Fix bad merge
pawanrawal Feb 11, 2020
d3bbef5
Remove a comment which isn't useful anymore.
pawanrawal Feb 11, 2020
893de2d
Separate out ACL and backup schema into another file that is only inc…
pawanrawal Feb 11, 2020
18ea855
Add Login to the GraphQL Admin API as well
pawanrawal Feb 12, 2020
77758c5
Refactor ACL tests.
pawanrawal Feb 13, 2020
89dc923
Change login test to call the GraphQL endpoint as well.
pawanrawal Feb 13, 2020
4e73929
Fix cmd alpha tests.
pawanrawal Feb 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dgraph/cmd/alpha/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func runGzipWithRetry(contentType, url string, buf io.Reader, gzReq, gzResp bool
resp, err = client.Do(req)
if err != nil && strings.Contains(err.Error(), "Token is expired") {
grootAccessJwt, grootRefreshJwt, err = testutil.HttpLogin(&testutil.LoginParams{
Endpoint: addr + "/login",
Endpoint: addr + "/admin",
RefreshJwt: grootRefreshJwt,
})

Expand Down Expand Up @@ -270,7 +270,7 @@ func runWithRetries(method, contentType, url string, body string) (
qr, respBody, err := runRequest(req)
if err != nil && strings.Contains(err.Error(), "Token is expired") {
grootAccessJwt, grootRefreshJwt, err = testutil.HttpLogin(&testutil.LoginParams{
Endpoint: addr + "/login",
Endpoint: addr + "/admin",
RefreshJwt: grootRefreshJwt,
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/alpha/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ func TestMain(m *testing.M) {
if _, err := zc.AssignUids(context.Background(), &pb.Num{Val: 1e6}); err != nil {
log.Fatal(err)
}
grootAccessJwt, grootRefreshJwt = testutil.GrootHttpLogin(addr + "/login")
grootAccessJwt, grootRefreshJwt = testutil.GrootHttpLogin(addr + "/admin")

r := m.Run()
os.Exit(r)
Expand Down
10 changes: 5 additions & 5 deletions ee/acl/acl_curl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/require"
)

var loginEndpoint = "http://" + testutil.SockAddrHttp + "/login"
var adminEndpoint = "http://" + testutil.SockAddrHttp + "/admin"

func TestCurlAuthorization(t *testing.T) {
if testing.Short() {
Expand All @@ -38,7 +38,7 @@ func TestCurlAuthorization(t *testing.T) {

// test query through curl
accessJwt, refreshJwt, err := testutil.HttpLogin(&testutil.LoginParams{
Endpoint: loginEndpoint,
Endpoint: adminEndpoint,
UserID: userid,
Passwd: userpassword,
})
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestCurlAuthorization(t *testing.T) {
})
// login again using the refreshJwt
accessJwt, refreshJwt, err = testutil.HttpLogin(&testutil.LoginParams{
Endpoint: loginEndpoint,
Endpoint: adminEndpoint,
RefreshJwt: refreshJwt,
})
require.NoError(t, err, fmt.Sprintf("login through refresh token failed: %v", err))
Expand All @@ -112,7 +112,7 @@ func TestCurlAuthorization(t *testing.T) {
})
// refresh the jwts again
accessJwt, refreshJwt, err = testutil.HttpLogin(&testutil.LoginParams{
Endpoint: loginEndpoint,
Endpoint: adminEndpoint,
RefreshJwt: refreshJwt,
})
require.NoError(t, err, fmt.Sprintf("login through refresh token failed: %v", err))
Expand All @@ -135,7 +135,7 @@ func TestCurlAuthorization(t *testing.T) {
time.Sleep(6 * time.Second)
// refresh the jwts again
accessJwt, _, err = testutil.HttpLogin(&testutil.LoginParams{
Endpoint: loginEndpoint,
Endpoint: adminEndpoint,
RefreshJwt: refreshJwt,
})
require.NoError(t, err, fmt.Sprintf("login through refresh token failed: %v", err))
Expand Down
Loading