Skip to content

Instantly share code, notes, and snippets.

@guidolodetti
guidolodetti / gist:48ba1b061b7bfcf4a7fd4e2264adce47
Created September 19, 2018 20:17
GraphQL nested authorization
enum ROLES {
USER
USER_OWNER
}
type User {
id: ID! # This field is public
name: String @requires(role: USER) # This field is available to all registered users
privateField: String @requires(role: USER_OWNER) # From here I can just compare the object id with the context user id
nestedField: AnotherObject
@guidolodetti
guidolodetti / SimpleFileReader.java
Last active May 17, 2017 21:24
Simple file reader for Android. Just add this file to your project!
// PUT YOUR PACKAGE HERE
// package com.mycompany.myproduct;
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;