Skip to content

Commit

Permalink
Add ability to delete or export user info for compliance purposes. he…
Browse files Browse the repository at this point in the history
  • Loading branch information
mofirouz authored and zyro committed Apr 22, 2018
1 parent 447c07c commit 5fd576f
Show file tree
Hide file tree
Showing 16 changed files with 599 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 68 additions & 37 deletions console/console.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion console/console.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
119 changes: 119 additions & 0 deletions console/console.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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."
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -136,6 +139,7 @@ func main() {

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

0 comments on commit 5fd576f

Please sign in to comment.