Files
speckle-server/modules/core/graph/schemas/streams.graphql
T
izzy lyseggen ee532b2b96 refactor(streams): use directives for auth
comment out any auth logic within the streams resolvers and add auth
directives to the graphql schema instead

test:server all pass for me with this, so hoping everything is ok here!!
2020-08-14 15:32:06 +01:00

115 lines
2.9 KiB
GraphQL

extend type Query {
stream( id: String! ): Stream
@isAuthorizedForStream(role: "stream:reviewer")
@hasScope(scope: "streams:read")
"""
All the streams of the current user, pass in the `query` parameter to seach by name, description or ID.
"""
streams( query: String!, limit: Int! = 25, cursor: String ): StreamCollection
@hasScope(scope: "streams:read")
}
type Stream {
id: String!
name: String!
description: String
isPublic: Boolean!
createdAt: String!
updatedAt: String!
collaborators: [ StreamCollaborator ]!
}
extend type User {
"""
All the streams that a user has access to.
"""
streams( limit: Int! = 25, cursor: String ): StreamCollection
}
type StreamCollaborator {
id: String!
name: String!
role: String!
}
type StreamCollection {
totalCount: Int!
cursor: String
items: [ Stream ]
}
extend type Mutation {
"""
Creates a new stream.
"""
streamCreate( stream: StreamCreateInput! ): String
@hasScope(scope: "streams:write")
@hasRole(role: "server:user")
"""
Updates an existing stream.
"""
streamUpdate( stream: StreamUpdateInput! ): Boolean!
@isAuthorizedForStream(role: "stream:owner")
@hasScope(scope: "streams:write")
@hasRole(role: "server:user")
"""
Deletes an existing stream.
"""
streamDelete( id: String! ): Boolean!
@isAuthorizedForStream(role: "stream:owner")
@hasScope(scope: "streams:write")
@hasRole(role: "server:user")
"""
Grants permissions to a user on a given stream.
"""
streamGrantPermission( streamId: String!, userId: String!, role: String! ): Boolean
@isAuthorizedForStream(role: "stream:owner")
@hasScope(scope: "streams:write")
@hasRole(role: "server:user")
"""
Revokes the permissions of a user on a given stream.
"""
streamRevokePermission( streamId: String!, userId: String! ): Boolean
@isAuthorizedForStream(role: "stream:owner")
@hasScope(scope: "streams:write")
@hasRole(role: "server:user")
}
extend type Subscription {
"""
Subscribes to new stream created event.
"""
streamCreated( ownerId: String! ): JSONObject
@isAuthorizedForStream(role: "stream:reviewer")
"""
Subscribes to stream updated event.
"""
streamUpdated( streamId: String! ): JSONObject
@isAuthorizedForStream(role: "stream:reviewer")
"""
Subscribes to stream deleted event. (do we want this for streamId?)
"""
streamDeleted( ownerId: String! ): JSONObject
# @isAuthorizedForStream(role: "stream:reviewer") ah this doesn't work b/c deleted before auth gets checked
"""
Subscribes to stream permission granted event.
"""
streamPermissionGranted( userId: String! ): JSONObject
@isAuthorizedForStream(role: "stream:reviewer")
}
input StreamCreateInput {
name: String
description: String
isPublic: Boolean
}
input StreamUpdateInput {
id: String!
name: String
description: String
isPublic: Boolean
}