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

Allow unactivated users to query Me() graphql #344

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading