Skip to content
Snippets Groups Projects
Commit 4ede1383 authored by LouisGendron's avatar LouisGendron
Browse files

Added "owned_by_user" graphene field on DataFile and DataSet

parent b0d5f4e1
No related branches found
No related tags found
1 merge request!101Resolve "Dataset and datafile graphql queries should incidate if the user is the owner of the object"
......@@ -26,12 +26,22 @@ class DataFileType(DjangoObjectType):
model = DataFile
fields = "__all__"
owned_by_user = graphene.Boolean()
def resolve_owned_by_user(self, info):
return self.uploaded_by == info.context.user.profile
class DataSetType(DjangoObjectType):
class Meta:
model = DataSet
fields = "__all__"
owned_by_user = graphene.Boolean()
def resolve_owned_by_user(self, info):
return self.created_by == info.context.user.profile
class ProfileType(DjangoObjectType):
class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment