Commit 5fd576fc authored by Mo Firouz's avatar Mo Firouz Committed by Andrei Mihu
Browse files

Add ability to delete or export user info for compliance purposes. #182

parent 447c07cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -392,6 +392,6 @@
[solve-meta]
  analyzer-name = "dep"
  analyzer-version = 1
  inputs-digest = "c9cf37873849b7c9ea30ef66151a1540afde6e0a518de051f8aef425e2e92f77"
  inputs-digest = "92727e62a718744c1d17c1a4e2c19e4979ccc4d50296bb91c11f5f40b28a6e34"
  solver-name = "gps-cdcl"
  solver-version = 1
+68 −37
Original line number Diff line number Diff line
@@ -44,8 +44,14 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AccountExport struct {
	// The user's account details.
	Account *nakama_api.Account `protobuf:"bytes,1,opt,name=account" json:"account,omitempty"`
	// The user's storage.
	Objects []*nakama_api.StorageObject `protobuf:"bytes,2,rep,name=objects" json:"objects,omitempty"`
	// The user's friends.
	Friends []*nakama_api.Friend `protobuf:"bytes,3,rep,name=friends" json:"friends,omitempty"`
	// The user's groups.
	Groups []*nakama_api.Group `protobuf:"bytes,2,rep,name=groups" json:"groups,omitempty"`
	Groups []*nakama_api.Group `protobuf:"bytes,4,rep,name=groups" json:"groups,omitempty"`
	// The user's notifications.
	Notifications []*nakama_api.Notification `protobuf:"bytes,5,rep,name=notifications" json:"notifications,omitempty"`
}

func (m *AccountExport) Reset()                    { *m = AccountExport{} }
@@ -60,6 +66,20 @@ func (m *AccountExport) GetAccount() *nakama_api.Account {
	return nil
}

func (m *AccountExport) GetObjects() []*nakama_api.StorageObject {
	if m != nil {
		return m.Objects
	}
	return nil
}

func (m *AccountExport) GetFriends() []*nakama_api.Friend {
	if m != nil {
		return m.Friends
	}
	return nil
}

func (m *AccountExport) GetGroups() []*nakama_api.Group {
	if m != nil {
		return m.Groups
@@ -67,6 +87,13 @@ func (m *AccountExport) GetGroups() []*nakama_api.Group {
	return nil
}

func (m *AccountExport) GetNotifications() []*nakama_api.Notification {
	if m != nil {
		return m.Notifications
	}
	return nil
}

// *
// The identifier for a user account.
type AccountIdRequest struct {
@@ -287,40 +314,44 @@ var _Console_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("console/console.proto", fileDescriptor0) }

var fileDescriptor0 = []byte{
	// 550 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xc1, 0x6e, 0xd4, 0x3c,
	0x10, 0x56, 0x52, 0xb5, 0xfb, 0xff, 0xae, 0x5a, 0x15, 0xb7, 0xa5, 0x4b, 0x4a, 0xd5, 0x90, 0x22,
	0x54, 0x56, 0x34, 0x46, 0xe1, 0xd6, 0x13, 0xdb, 0x52, 0xa1, 0x4a, 0x80, 0xd0, 0xc2, 0x89, 0x0b,
	0xf2, 0x26, 0x43, 0xe2, 0x36, 0xeb, 0x49, 0x6d, 0xa7, 0x05, 0xa1, 0x5e, 0x78, 0x04, 0x78, 0x2e,
	0x4e, 0xbc, 0x02, 0x27, 0x5e, 0x80, 0x2b, 0x4a, 0xec, 0x2d, 0xdb, 0x5d, 0x81, 0x38, 0x44, 0xd6,
	0xcc, 0xf7, 0xcd, 0x7c, 0x5f, 0x66, 0x6c, 0xb2, 0x9e, 0xa2, 0xd4, 0x58, 0x02, 0x73, 0x67, 0x5c,
	0x29, 0x34, 0x48, 0x97, 0x25, 0x3f, 0xe5, 0x23, 0x1e, 0xbb, 0x6c, 0xd0, 0xcb, 0x85, 0x29, 0xea,
	0x61, 0x9c, 0xe2, 0x88, 0x15, 0xa0, 0x50, 0xa4, 0x25, 0x1f, 0x6a, 0x66, 0x59, 0x8c, 0x57, 0xa2,
	0xf9, 0x6c, 0x6d, 0x70, 0x3b, 0x47, 0xcc, 0x4b, 0xb0, 0x59, 0x29, 0xd1, 0x70, 0x23, 0x50, 0x6a,
	0x87, 0x6e, 0x3a, 0xb4, 0x8d, 0x86, 0xf5, 0x3b, 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0x5f, 0x0a, 0xdd, 0x1c, 0xdb, 0xb9, 0x2e, 0xc5, 0x32, 0x4c, 0xf5, 0x9b,
	0x8e, 0xab, 0x19, 0x2e, 0xb4, 0x57, 0xe0, 0xd1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xff,
	0x13, 0xd0, 0x0d, 0x04, 0x00, 0x00,
	// 616 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x4f, 0xd4, 0x40,
	0x14, 0xc7, 0xb3, 0x45, 0x58, 0x1d, 0xb2, 0x04, 0x07, 0x90, 0xb2, 0x48, 0xa8, 0xc5, 0x18, 0xdc,
	0x40, 0xc7, 0x94, 0x1b, 0x07, 0xe3, 0x82, 0x68, 0x48, 0x14, 0x4d, 0xf1, 0xe4, 0xc5, 0x74, 0xdb,
	0x47, 0xb7, 0xd0, 0x9d, 0x57, 0x66, 0xa6, 0xa0, 0x31, 0x5c, 0x3c, 0x7b, 0xd2, 0xcf, 0xe5, 0xc9,
	0xaf, 0xe0, 0xc9, 0x2f, 0xe0, 0xd5, 0xb4, 0x33, 0xc5, 0xc2, 0x46, 0xe3, 0x61, 0xd3, 0xcc, 0xfc,
	0x7f, 0xff, 0xf7, 0xde, 0xcc, 0xfe, 0x87, 0x2c, 0x44, 0xc8, 0x25, 0x66, 0xc0, 0xcc, 0xd7, 0xcb,
	0x05, 0x2a, 0xa4, 0x33, 0x3c, 0x3c, 0x09, 0x47, 0xa1, 0x67, 0x76, 0xbb, 0xbd, 0x24, 0x55, 0xc3,
	0x62, 0xe0, 0x45, 0x38, 0x62, 0x43, 0x10, 0x98, 0x46, 0x59, 0x38, 0x90, 0x4c, 0x53, 0x2c, 0xcc,
	0xd3, 0xf2, 0xa7, 0xbd, 0xdd, 0xbb, 0x09, 0x62, 0x92, 0x81, 0xde, 0xe5, 0x1c, 0x55, 0xa8, 0x52,
	0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8c, 0x58,
	0xf6, 0x47, 0x21, 0x9d, 0x07, 0xce, 0x2e, 0x72, 0x25, 0xd2, 0x41, 0xa1, 0x50, 0x48, 0x7a, 0x7f,
	0xa8, 0x54, 0x2e, 0xb7, 0x19, 0xfb, 0xd7, 0xa3, 0xee, 0xce, 0x0f, 0x21, 0xcb, 0xf0, 0xc9, 0x1f,
	0xa1, 0xe4, 0xfc, 0x09, 0xdf, 0x7b, 0xd4, 0x6b, 0xb5, 0xfc, 0xd9, 0x30, 0xcf, 0x33, 0x13, 0x3d,
	0x76, 0x2c, 0x91, 0x6f, 0x8f, 0xed, 0x88, 0x1d, 0xb2, 0x66, 0x06, 0x91, 0x20, 0xce, 0x40, 0x5c,
	0x0e, 0x1b, 0x63, 0x54, 0x8c, 0x80, 0xeb, 0xd7, 0x4c, 0x97, 0xeb, 0x71, 0xae, 0xb6, 0x62, 0x31,
	0x46, 0xf2, 0x6d, 0xdb, 0x78, 0x06, 0x53, 0x55, 0x04, 0xb6, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff,
	0xba, 0xdd, 0x43, 0x43, 0xb1, 0x04, 0x00, 0x00,
}
+7 −1
Original line number Diff line number Diff line
@@ -74,8 +74,14 @@ service Console {
message AccountExport {
  // The user's account details.
  nakama.api.Account account = 1;
  // The user's storage.
  repeated nakama.api.StorageObject objects = 2;
  // The user's friends.
  repeated nakama.api.Friend friends = 3;
  // The user's groups.
  repeated nakama.api.Group groups = 2;
  repeated nakama.api.Group groups = 4;
  // The user's notifications.
  repeated nakama.api.Notification notifications = 5;
}

/**
+119 −0
Original line number Diff line number Diff line
@@ -142,6 +142,21 @@
      },
      "description": "Send a device to the server. Used with authenticate/link/unlink and user."
    },
    "apiFriend": {
      "type": "object",
      "properties": {
        "user": {
          "$ref": "#/definitions/apiUser",
          "description": "The user object."
        },
        "state": {
          "type": "integer",
          "format": "int32",
          "description": "The friend status."
        }
      },
      "description": "A friend of a user."
    },
    "apiGroup": {
      "type": "object",
      "properties": {
@@ -196,6 +211,89 @@
      },
      "description": "A group in the server."
    },
    "apiNotification": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the Notification."
        },
        "subject": {
          "type": "string",
          "description": "Subject of the notification."
        },
        "content": {
          "type": "string",
          "description": "Content of the notification in JSON."
        },
        "code": {
          "type": "integer",
          "format": "int32",
          "description": "Category code for this notification."
        },
        "sender_id": {
          "type": "string",
          "description": "ID of the sender, if a user. Otherwise 'null'."
        },
        "create_time": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the notification was created."
        },
        "persistent": {
          "type": "boolean",
          "format": "boolean",
          "description": "True if this notification was persisted to the database."
        }
      },
      "description": "A notification in the server."
    },
    "apiStorageObject": {
      "type": "object",
      "properties": {
        "collection": {
          "type": "string",
          "description": "The collection which stores the object."
        },
        "key": {
          "type": "string",
          "description": "The key of the object within the collection."
        },
        "user_id": {
          "type": "string",
          "description": "The user owner of the object."
        },
        "value": {
          "type": "string",
          "description": "The value of the object."
        },
        "version": {
          "type": "string",
          "description": "The version hash of the object."
        },
        "permission_read": {
          "type": "integer",
          "format": "int32",
          "description": "The read access permissions for the object."
        },
        "permission_write": {
          "type": "integer",
          "format": "int32",
          "description": "The write access permissions for the object."
        },
        "create_time": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the object was created."
        },
        "update_time": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the object was last updated."
        }
      },
      "description": "An object within the storage engine."
    },
    "apiUser": {
      "type": "object",
      "properties": {
@@ -277,12 +375,33 @@
          "$ref": "#/definitions/apiAccount",
          "description": "The user's account details."
        },
        "objects": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/apiStorageObject"
          },
          "description": "The user's storage."
        },
        "friends": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/apiFriend"
          },
          "description": "The user's friends."
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/apiGroup"
          },
          "description": "The user's groups."
        },
        "notifications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/apiNotification"
          },
          "description": "The user's notifications."
        }
      },
      "description": "*\nAn export of all information stored for a user account."
+6 −2
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ import (
	"syscall"
	"time"

	"io/ioutil"
	"path/filepath"

	"github.com/golang/protobuf/jsonpb"
	"github.com/heroiclabs/nakama/ga"
	"github.com/heroiclabs/nakama/migrate"
@@ -35,8 +38,6 @@ import (
	_ "github.com/lib/pq"
	"github.com/satori/go.uuid"
	"go.uber.org/zap"
	"io/ioutil"
	"path/filepath"
)

const cookieFilename = ".cookie"
@@ -115,6 +116,8 @@ func main() {
	runtimePool := server.NewRuntimePool(jsonLogger, multiLogger, db, config, socialClient, sessionRegistry, matchRegistry, tracker, router, stdLibs, modules, regCallbacks, once)
	pipeline := server.NewPipeline(config, db, jsonpbMarshaler, jsonpbUnmarshaler, sessionRegistry, matchRegistry, tracker, router, runtimePool)
	metrics := server.NewMetrics(multiLogger, config)

	consoleServer := server.StartConsoleServer(jsonLogger, multiLogger, config, db)
	apiServer := server.StartApiServer(jsonLogger, multiLogger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, socialClient, sessionRegistry, matchRegistry, tracker, router, pipeline, runtimePool)

	gaenabled := len(os.Getenv("NAKAMA_TELEMETRY")) < 1
@@ -136,6 +139,7 @@ func main() {

	// Gracefully stop server components.
	apiServer.Stop()
	consoleServer.Stop()
	metrics.Stop(jsonLogger)
	matchRegistry.Stop()
	tracker.Stop()
Loading