Beispiel #1
0
func validateOperation(req *models.Ping, context *apimodels.Context) error {
	// realtime doc id
	if req.FileId == "" {
		return errors.New("fileId not set")
	}

	// only logged in users can send a ping
	if !context.IsLoggedIn() {
		return errors.New("not logged in")
	}

	// override the account id and set created at
	req.AccountId = context.Client.Account.Id // if client is logged in, those values are all set
	req.CreatedAt = time.Now().UTC()

	return collaboration.CanOpen(req)
}