Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 
Allow unactivated users to query Me() graphql (#344)
  • Loading branch information
KCarretto authored Oct 30, 2023
1 parent ea2f1c1 commit d5a092c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion implants/lib/tavern/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,6 @@ extend type Query {
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
tomes(where: TomeWhereInput): [Tome!]! @requireRole(role: USER)
users(where: UserWhereInput): [User!]! @requireRole(role: USER)
me: User! @requireRole(role: USER)
me: User!
}
scalar Time
28 changes: 2 additions & 26 deletions tavern/internal/graphql/generated/ent.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tavern/internal/graphql/generated/root_.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tavern/internal/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,6 @@ extend type Query {
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
tomes(where: TomeWhereInput): [Tome!]! @requireRole(role: USER)
users(where: UserWhereInput): [User!]! @requireRole(role: USER)
me: User! @requireRole(role: USER)
me: User!
}
scalar Time
2 changes: 1 addition & 1 deletion tavern/internal/graphql/schema/query.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ extend type Query {
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
tomes(where: TomeWhereInput): [Tome!]! @requireRole(role: USER)
users(where: UserWhereInput): [User!]! @requireRole(role: USER)
me: User! @requireRole(role: USER)
me: User!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken",false,false);
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (6,"test_oauth_id2","https://photos.com","admin","otherToken",true,true);
query: |
query UnauthenticatedMe {
me {
id
}
}
expected_error: no authenticated user present in request context
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken",false,false);
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (6,"test_oauth_id2","https://photos.com","admin","otherToken",true,true);
requestor:
session_token: secretToken
query: |
query MeWithUnactivatedUser {
me {
id
isActivated
}
}
expected:
me:
id: "5"
isActivated: false
2 changes: 1 addition & 1 deletion tavern/internal/www/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,6 @@ extend type Query {
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
tomes(where: TomeWhereInput): [Tome!]! @requireRole(role: USER)
users(where: UserWhereInput): [User!]! @requireRole(role: USER)
me: User! @requireRole(role: USER)
me: User!
}
scalar Time

0 comments on commit d5a092c

Please sign in to comment.