1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-08 06:55:28 +02:00

Merge branch 'master' into smart-section-trello

# Conflicts:
#	documize/section/code.go
This commit is contained in:
Harvey Kandola 2016-05-19 15:51:07 -07:00
commit 798c990dd4
144 changed files with 1955 additions and 504 deletions

8
.gitignore vendored
View file

@ -34,16 +34,8 @@ _cgo_export.*
_testmain.go _testmain.go
*.exe *.exe
*.test *.test
/dickens/dickens
/dickens/dickens-osx
/asimov/asimov
/asimov/asimov-osx
/plugin-libreoffice/plugin-libreoffice /plugin-libreoffice/plugin-libreoffice
/plugin-libreoffice/plugin-libreoffice-osx /plugin-libreoffice/plugin-libreoffice-osx
/plugin-markdown/plugin-markdown
/plugin-markdown/plugin-markdown-osx
/plugin-tolkien/plugin-tolkien
/plugin-tolkien/plugin-tolkien-osx
# Ember specific # Ember specific
/app/dist /app/dist

113
README.md
View file

@ -1,75 +1,124 @@
# Instructions # Documize Community Edition
To discover Documize please visit https://documize.com
Documize® is a registered trade mark of Documize Inc.
This repository is copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
This software (Documize Community Edition) is licensed under GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
You can operate outside the AGPL restrictions by purchasing Documize Enterprise Edition and obtaining a commercial license by contacting <sales@documize.com>.
## Running Documize for the first time
Although the Documize binaries run on Linux, Windows and OSX, the build process has only been tested on OSX.
Install the prerequisites: Install the prerequisites:
* Go from https://golang.org (be careful to set the $GOPATH environment variable correctly) * Go from https://golang.org (be careful to set the $GOPATH environment variable correctly, you may find https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html helpful)
* NPM from https://www.npmjs.com * NPM from https://www.npmjs.com
* Ember from http://emberjs.com/ * Ember from http://emberjs.com/
* MySQL (v10.7+) from http://dev.mysql.com/downloads/mysql/ * MySQL (v10.7+) from http://dev.mysql.com/downloads/mysql/
Make sure this repository sits at the following position relative to your $GOPATH: ```$GOPATH/src/github.com/documize/community``` Make sure this repository sits at the following position relative to your $GOPATH: $GOPATH/src/github.com/documize/community
After cloning the repository in the above location, go there and run: ```./build.sh``` After cloning the repository in the above location, go there and run: ./build.sh
Your ```./bin``` directory should now contain a set of binaries for a number of target systems. The build script packages up the Ember JS/HTML/CSS code for production use, then generates Go code that creates a simple in-memory file system to contain it. That generated Go code is compiled with the rest to produce a single binary for each of the target systems.
Now create an empty database in MySql for Documize to use, making sure that the default collation setting is ```utf8_general_ci``` or some other utf8 variant. Your ./bin directory should now contain a set of binaries for a number of target systems. This binary can be executed on any system which also has access to a MySQL database with no further dependencies.
Run Documize for the first time to set-up the database and your user information Use a MySQL tool to create an empty database for Documize to use, making sure that the default collation setting is utf8_general_ci or some other utf8 variant.
(for example on OSX, using port 5001, MySQL user root/password and database 'documize'):
Run Documize for the first time to set-up the database and your user information (for example on OSX, using port 5001, MySQL user root/password and database documize):
``` ```
./bin/documize-darwin-amd64 -port=5001 -db='root:password@tcp(localhost:3306)/documize' ./bin/documize-darwin-amd64 -port=5001 -db='root:password@tcp(localhost:3306)/documize'
``` ```
An error message will appear in the log to say your installation is in set-up mode. An error message will appear in the log to say your installation is in set-up mode. Now navigate to http://localhost:5001 and follow the instructions.
Now navigate to http://localhost:5001 and follow the instructions.
Hopefully you will now have a working Documize instance. Hopefully you will now have a working Documize instance.
# Ember Once you have set-up the database as described above, you could go to the ./documize directory and use the command "go run documize.go" in place of the binary name.
To run the Ember code using ```ember s``` from the app directory, the Go binary needs to run an SSL server on port 5001. ## Command line flags and environment variables
If you don't have a valid certification key pair for your machine, you can generate them by doing the following: The command line flags are defined below:
```
Usage of ./bin/documize-darwin-amd64:
-cert string
the cert.pem file used for https
-db string
"username:password@protocol(hostname:port)/databasename" for example "fred:bloggs@tcp(localhost:3306)/documize"
-forcesslport string
redirect given http port number to TLS
-insecure string
if 'true' allow https endpoints with invalid certificates (only for testing)
-key string
the key.pem file used for https
-log string
system being logged e.g. 'PRODUCTION' (default "Non-production")
-offline string
set to '1' for OFFLINE mode
-plugin string
the JSON file describing plugins, default 'DB' uses the database config table 'FILEPLUGINS' entry (default "DB")
-port string
http/https port number
-showsettings
if true, show settings in the log (WARNING: these settings may include passwords)
```
Flags related to SSL/TLS are discussed in detail later.
For operational convenience, some of these flags can also be set through environment variables: DOCUMIZECERT => -cert ; DOCUMIZEDB => -db ; DOCUMIZEFORCESSLPORT => -forcesslport ; DOCUMIZEKEY => -key ; DOCUMIZEPORT => -port .
## Configuring the server to use HTTPS
To configure SSL you will need valid certificate and key .pem files.
If you dont have a valid certification key pair for your development machine, you can generate them by doing the following:
``` ```
cd selfcert cd selfcert
go run generate_cert.go -host localhost go run generate_cert.go -host localhost
cd .. cd ..
``` ```
...obviously you should never use a self generated certificate in a live environment. …obviously you should never use a self-generated certificate in a live environment.
To run Documize using those certs (using the set-up above): To run Documize using those certs (using the set-up above):
``` ```
./bin/documize-darwin-amd64 -db='root:password@tcp(localhost:3306)/documize' -port=5001 -cert selfcert/cert.pem -key selfcert/key.pem ./bin/documize-darwin-amd64 -db='root:password@tcp(localhost:3306)/documize' -port=5001 -cert selfcert/cert.pem -key selfcert/key.pem
``` ```
With this process running in the background, Ember should work. If you navigate to https://localhost:5001 and you want to remove the Chrome warning messages about your invalid self-cert follow the instructions at: https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/
If you navigate to https://localhost:5001 and you want to remove the Chrome warning messages about your invalid self-cert If you do not specify a port, Documize will default to port ```443``` if there are key/cert files, port ```80``` otherwise.
follow the instructions at: https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/
TODO - document SMTP and Token If you want non-SSL http:// traffic to redirect to the SSL port, say from port 9999, use command line flag: ```-forcesslport=9999```
# To Document ## Ember
The build process around go get github.com/elazarl/go-bindata-assetfs This section is only required if you want to develop the Ember code.
## GO These two commands are best run in different terminal windows:
gobin / go env (1) Run the Go binary needs to run an SSL server on port 5001, as described in the sections above.
## go-bindata-assetsfs (2) Run the Ember code using the command ```ember s``` from the app directory.
make sure you do install cmd from inside go-* folder where main.go lives Ember should be visible by navigating to: http://localhost:4200
## SSL
selfcert generation and avoiding red lock ## Configuring SMTP
https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/ In order to send e-mail from your Documize instance, you must configure it.
chrome://restart At present this configuration is not available from the web interface, it requires the use of a MySQL tool of your choice.
go run generate_cert.go -host demo1.dev In your database, the table `config` has two fields `key` holding CHAR(255) and `config` holding JSON.
port number not required The SQL to find you current SMTP configuration is: ``` `SELECT `config` FROM `config` WHERE `key` = 'SMTP'; ```
but browser restart is!
In an empty database the result will be something like:
```{"host": "", "port": "", "sender": "", "userid": "", "password": ""}```
To configure SMTP, you must set these values in the JSON as your systems require, using a MySQL tool.
The host is the DNS name of your SMTP server; the port defaults to 587; the sender Documize use is "Documize <hello@documize.com>"; userid and password are your SMTP server credentials.

View file

@ -25,7 +25,7 @@ cp documize/api/mail/*.html documize/web/bindata/mail
cp documize/database/templates/*.html documize/web/bindata cp documize/database/templates/*.html documize/web/bindata
rm -rf documize/web/bindata/scripts rm -rf documize/web/bindata/scripts
mkdir -p documize/web/bindata/scripts mkdir -p documize/web/bindata/scripts
cp -r documize/database/scripts documize/web/bindata cp -r documize/database/scripts/autobuild/*.sql documize/web/bindata/scripts
echo "Generating in-memory static assets..." echo "Generating in-memory static assets..."
go get github.com/jteeuwen/go-bindata/... go get github.com/jteeuwen/go-bindata/...

View file

@ -1,19 +0,0 @@
[
{
"Comment": "Disable (or not) built-in html import (NOTE: no Plugin name)",
"Disabled": true,
"API": "Convert",
"Actions": [
"htm",
"html"
]
},
{
"Comment": "Disable (or not) built-in Documize API import used from SDK (NOTE: no Plugin name)",
"Disabled": true,
"API": "Convert",
"Actions": [
"documizeapi"
]
}
]

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package apidocumizecom package apidocumizecom
import ( import (
@ -5,27 +16,33 @@ import (
"errors" "errors"
"net/http" "net/http"
"github.com/documize/community/wordsmith/environment" "github.com/documize/community/documize/api/request"
) )
var endPoint = "https://api.documize.com" func endPoint() string {
r := request.ConfigString("LICENSE", "endpoint")
if r != "" {
return r
}
return "https://api.documize.com"
}
var token string func token() (string, error) {
r := request.ConfigString("LICENSE", "token")
func init() { if r == "" {
environment.GetString(&endPoint, "endpoint", false, "Documize end-point", nil) return "", errors.New("Documize token is empty")
environment.GetString(&token, "token", false, "Documize token", nil) }
// TODO more validation here
return r, nil
} }
var transport = &http.Transport{ var transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // TODO should be from -insecure flag TLSClientConfig: &tls.Config{
} InsecureSkipVerify: true, // TODO should be glick.InsecureSkipVerifyTLS (from -insecure flag) but get error: x509: certificate signed by unknown authority
}}
// CheckToken tests if the supplied token is valid. // CheckToken returns an error if the Documize LICENSE token is invalid.
func CheckToken() error { func CheckToken() error {
if token == "" { _, err := token()
return errors.New("Documize token is empty") return err
}
// TODO validate against endPoint site
return nil
} }

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package apidocumizecom package apidocumizecom
import ( import (
@ -26,7 +37,12 @@ func (file *Msword) Convert(r api.DocumentConversionRequest, reply *api.Document
client := &http.Client{Transport: transport} client := &http.Client{Transport: transport}
resp, err := client.Post(endPoint+"/api/word?token="+token, "application/json", bytes.NewReader(byts)) tok,err:=token()
if err != nil {
return err
}
resp, err := client.Post(endPoint()+"/api/word?token="+tok, "application/json", bytes.NewReader(byts))
if err != nil { if err != nil {
return err return err
} }

View file

@ -1,13 +1,24 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package convert provides the gateway to document conversion native and plugin functionality, both in and out of the system. // Package convert provides the gateway to document conversion native and plugin functionality, both in and out of the system.
package convert package convert
import ( import (
"errors"
"github.com/documize/community/documize/api/convert/excerpt" "github.com/documize/community/documize/api/convert/excerpt"
"github.com/documize/community/documize/api/convert/html" "github.com/documize/community/documize/api/convert/html"
"github.com/documize/community/documize/api/plugins" "github.com/documize/community/documize/api/plugins"
"github.com/documize/community/wordsmith/api" "github.com/documize/community/wordsmith/api"
"github.com/documize/community/wordsmith/utility" "github.com/documize/community/wordsmith/utility"
"errors"
"golang.org/x/net/context" "golang.org/x/net/context"
) )

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package convert_test package convert_test
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package documizeapi package documizeapi
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package excerpt provides basic functionality to create excerpts of text in English. // Package excerpt provides basic functionality to create excerpts of text in English.
package excerpt package excerpt

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package excerpt_test package excerpt_test
import "testing" import "testing"

View file

@ -1,2 +1,13 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package html documizes html files. // Package html documizes html files.
package html package html

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package html package html
import ( import (
@ -149,7 +160,7 @@ func (h *htmlToSplit) renderHeading(c *html.Node, level uint64) error {
func (h *htmlToSplit) newSect(tstr string, level uint64) { func (h *htmlToSplit) newSect(tstr string, level uint64) {
h.CFR.Pages = append(h.CFR.Pages, h.thisSect) h.CFR.Pages = append(h.CFR.Pages, h.thisSect)
title := utility.EscapeHTMLcomplexChars(tstr) title := tstr //was: utility.EscapeHTMLcomplexChars(tstr) -- removed to avoid double-escaping
body := `` body := ``
if len(title) > maxTitle { if len(title) > maxTitle {
body = title[maxTitle:] body = title[maxTitle:]

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package html_test package html_test
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package md package md
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,2 +1,13 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package endpoint provides API endpoints for Documize. // Package endpoint provides API endpoints for Documize.
package endpoint package endpoint

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,5 +1,34 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
// TestEndpoint is the entrypoint for all testing unit testing of this package.
// The actual tests are in "github.com/documize/documize-sdk/exttest".
/* The tests require an environment specified by two environment variables:
"DOCUMIZEAPI" e.g. "http://localhost:5002"
"DOCUMIZEAUTH" e.g. "demo1:jim@davidson.com:demo123"
- the user for testing must have admin privilidges and a folder called 'TEST'.
*/
/* NOTE currently excluded from SDK and testing are endpoints requiring e-mail interaction:
InviteToFolder()
inviteNewUserToSharedFolder()
AcceptSharedFolder()
ForgotUserPassword()
ResetUserPassword()
ChangeUserPassword()
*/
/* TODO (Elliott) make tests work on an empty database
import ( import (
"os" "os"
"strings" "strings"
@ -14,7 +43,7 @@ import (
) )
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
environment.Parse() // the database environment variables must be set environment.Parse("db") // the database environment variables must be set
port = "5002" port = "5002"
testHost = "localhost" testHost = "localhost"
testSetup() testSetup()
@ -64,21 +93,6 @@ func testTeardown() {
log.IfErr(plugins.Lib.KillSubProcs()) log.IfErr(plugins.Lib.KillSubProcs())
} }
// TestEndpoint is the entrypoint for all testing unit testing of this package.
// The actual tests are in "github.com/documize/documize-sdk/exttest".
/* The tests require an environment specified by two environment variables:
"DOCUMIZEAPI" e.g. "http://localhost:5002"
"DOCUMIZEAUTH" e.g. "demo1:jim@davidson.com:demo123"
- the user for testing must have admin privilidges and a folder called 'TEST'.
*/
/* NOTE currently excluded from SDK and testing are endpoints requiring e-mail interaction:
InviteToFolder()
inviteNewUserToSharedFolder()
AcceptSharedFolder()
ForgotUserPassword()
ResetUserPassword()
ChangeUserPassword()
*/
func TestEndpoint(t *testing.T) { func TestEndpoint(t *testing.T) {
exttest.APItest(t) exttest.APItest(t)
} }
@ -92,3 +106,5 @@ func BenchmarkEndpoint(b *testing.B) {
} }
} }
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,7 +1,18 @@
package models // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package models describes the communication format between JS snd Go.
// Models are not persisted entities - they are object models that are marshalled between the // Models are not persisted entities - they are object models that are marshalled between the
// backend and the consumer (UI) // backend and the consumer (UI).
package models
import ( import (
"github.com/documize/community/documize/api/entity" "github.com/documize/community/documize/api/entity"

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (
@ -79,7 +90,11 @@ func AddDocumentPage(w http.ResponseWriter, r *http.Request) {
p.Context.Transaction = tx p.Context.Transaction = tx
output, _ := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody) output, ok := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
if !ok {
log.ErrorString("section.Render could not find: " + model.Page.ContentType)
}
model.Page.Body = output model.Page.Body = output
err = p.AddPage(*model) err = p.AddPage(*model)
@ -418,7 +433,10 @@ func UpdateDocumentPage(w http.ResponseWriter, r *http.Request) {
model.Page.SetDefaults() model.Page.SetDefaults()
model.Meta.SetDefaults() model.Meta.SetDefaults()
output, _ := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody) output, ok := section.Render(model.Page.ContentType, model.Meta.Config, model.Meta.RawBody)
if !ok {
log.ErrorString("section.Render could not find: " + model.Page.ContentType)
}
model.Page.Body = output model.Page.Body = output
p.Context.Transaction = tx p.Context.Transaction = tx

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (
@ -59,7 +70,10 @@ func RunSectionCommand(w http.ResponseWriter, r *http.Request) {
return return
} }
section.Command(sectionName, w, r) if !section.Command(sectionName, w, r) {
log.ErrorString("Unable to run section.Command() for: " + sectionName)
writeNotFoundError(w, "RunSectionCommand", sectionName)
}
} }
// RefreshSections updates document sections where the data // RefreshSections updates document sections where the data
@ -112,10 +126,16 @@ func RefreshSections(w http.ResponseWriter, r *http.Request) {
} }
// Ask for data refresh // Ask for data refresh
data, _ := section.Refresh(page.ContentType, pm.Config, pm.RawBody) data, ok := section.Refresh(page.ContentType, pm.Config, pm.RawBody)
if !ok {
log.ErrorString("section.Refresh could not find: " + page.ContentType)
}
// Render again // Render again
body, _ := section.Render(page.ContentType, pm.Config, data) body, ok := section.Render(page.ContentType, pm.Config, data)
if !ok {
log.ErrorString("section.Render could not find: " + page.ContentType)
}
// Compare to stored render // Compare to stored render
if body != page.Body { if body != page.Body {

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package endpoint package endpoint
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package entity provides types that mirror database tables. // Package entity provides types that mirror database tables.
package entity package entity

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// jshint ignore:start // jshint ignore:start
package mail package mail
@ -8,8 +19,8 @@ import (
"html/template" "html/template"
"net/smtp" "net/smtp"
"github.com/documize/community/documize/api/request"
"github.com/documize/community/documize/web" "github.com/documize/community/documize/web"
"github.com/documize/community/wordsmith/environment"
"github.com/documize/community/wordsmith/log" "github.com/documize/community/wordsmith/log"
) )
@ -34,7 +45,7 @@ func InviteNewUser(recipient, inviter, url, username, password string) {
subject := fmt.Sprintf("%s has invited you to Documize", inviter) subject := fmt.Sprintf("%s has invited you to Documize", inviter)
e := newEmail() e := newEmail()
e.From = creds.SMTPsender e.From = creds.SMTPsender()
e.To = []string{recipient} e.To = []string{recipient}
e.Subject = subject e.Subject = subject
@ -85,7 +96,7 @@ func InviteExistingUser(recipient, inviter, url string) {
subject := fmt.Sprintf("%s has invited you to their Documize account", inviter) subject := fmt.Sprintf("%s has invited you to their Documize account", inviter)
e := newEmail() e := newEmail()
e.From = creds.SMTPsender e.From = creds.SMTPsender()
e.To = []string{recipient} e.To = []string{recipient}
e.Subject = subject e.Subject = subject
@ -127,7 +138,7 @@ func PasswordReset(recipient, url string) {
subject := "Documize password reset request" subject := "Documize password reset request"
e := newEmail() e := newEmail()
e.From = "Documize <hello@documize.com>" e.From = creds.SMTPsender() //e.g. "Documize <hello@documize.com>"
e.To = []string{recipient} e.To = []string{recipient}
e.Subject = subject e.Subject = subject
@ -172,7 +183,7 @@ func ShareFolderExistingUser(recipient, inviter, url, folder, intro string) {
subject := fmt.Sprintf("%s has shared %s with you", inviter, folder) subject := fmt.Sprintf("%s has shared %s with you", inviter, folder)
e := newEmail() e := newEmail()
e.From = creds.SMTPsender e.From = creds.SMTPsender()
e.To = []string{recipient} e.To = []string{recipient}
e.Subject = subject e.Subject = subject
@ -223,7 +234,7 @@ func ShareFolderNewUser(recipient, inviter, url, folder, invitationMessage strin
subject := fmt.Sprintf("%s has shared %s with you on Documize", inviter, folder) subject := fmt.Sprintf("%s has shared %s with you on Documize", inviter, folder)
e := newEmail() e := newEmail()
e.From = creds.SMTPsender e.From = creds.SMTPsender()
e.To = []string{recipient} e.To = []string{recipient}
e.Subject = subject e.Subject = subject
@ -253,24 +264,30 @@ func ShareFolderNewUser(recipient, inviter, url, folder, invitationMessage strin
} }
} }
var creds struct{ SMTPuserid, SMTPpassword, SMTPhost, SMTPport, SMTPsender string } var creds = struct{ SMTPuserid, SMTPpassword, SMTPhost, SMTPport, SMTPsender func() string }{
func() string { return request.ConfigString("SMTP", "userid") },
func init() { func() string { return request.ConfigString("SMTP", "password") },
creds.SMTPport = "587" // the default value for outgoing SMTP traffic func() string { return request.ConfigString("SMTP", "host") },
creds.SMTPsender = "Documize <hello@documize.com>" // TODO review as SAAS specific func() string {
environment.GetString(&creds.SMTPuserid, "smtpuserid", false, "SMTP username for outgoing email", nil) r := request.ConfigString("SMTP", "port")
environment.GetString(&creds.SMTPpassword, "smtppassword", false, "SMTP password for outgoing email", nil) if r == "" {
environment.GetString(&creds.SMTPhost, "smtphost", false, "SMTP host for outgoing email", nil) return "587" // default port number
environment.GetString(&creds.SMTPport, "smtpport", false, "SMTP port for outgoing email", nil) }
environment.GetString(&creds.SMTPsender, "smtpsender", false, "SMTP sender's e-mail for outgoing email", nil) return r
},
func() string { return request.ConfigString("SMTP", "sender") },
} }
// Helper to return SMTP credentials // Helper to return SMTP credentials
func getAuth() smtp.Auth { func getAuth() smtp.Auth {
return smtp.PlainAuth("", creds.SMTPuserid, creds.SMTPpassword, creds.SMTPhost) a := smtp.PlainAuth("", creds.SMTPuserid(), creds.SMTPpassword(), creds.SMTPhost())
//fmt.Printf("DEBUG getAuth() = %#v\n", a)
return a
} }
// Helper to return SMTP host details // Helper to return SMTP host details
func getHost() string { func getHost() string {
return creds.SMTPhost + ":" + creds.SMTPport h := creds.SMTPhost() + ":" + creds.SMTPport()
//fmt.Printf("DEBUG getHost() = %#v\n", h)
return h
} }

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package mail package mail
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
/* /*
Elements of the software in this file were modified from github.com/jordan-wright/email and Elements of the software in this file were modified from github.com/jordan-wright/email and
are subject to the licence below: are subject to the licence below:
@ -31,10 +42,10 @@ package mail
import ( import (
"bytes" "bytes"
"github.com/documize/community/wordsmith/log"
"encoding/base64" "encoding/base64"
"errors" "errors"
"fmt" "fmt"
"github.com/documize/community/wordsmith/log"
"io" "io"
"mime" "mime"
"mime/multipart" "mime/multipart"

View file

@ -1,7 +1,19 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package plugins manages the plug-in componenets of the Documize system. // Package plugins manages the plug-in componenets of the Documize system.
package plugins package plugins
import ( import (
"bytes"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"time" "time"
@ -10,6 +22,7 @@ import (
"github.com/documize/community/documize/api/convert/documizeapi" "github.com/documize/community/documize/api/convert/documizeapi"
"github.com/documize/community/documize/api/convert/html" "github.com/documize/community/documize/api/convert/html"
"github.com/documize/community/documize/api/convert/md" "github.com/documize/community/documize/api/convert/md"
"github.com/documize/community/documize/api/request"
"github.com/documize/community/wordsmith/api" "github.com/documize/community/wordsmith/api"
"github.com/documize/community/wordsmith/environment" "github.com/documize/community/wordsmith/environment"
"github.com/documize/community/wordsmith/log" "github.com/documize/community/wordsmith/log"
@ -17,12 +30,12 @@ import (
) )
// PluginFile is the path to the file containing the configuration information for the plugin system in JSON format. // PluginFile is the path to the file containing the configuration information for the plugin system in JSON format.
var PluginFile = "plugin.json" var PluginFile = "DB" // this points to the database
var insecure = "false" var insecure = "false"
func init() { func init() {
environment.GetString(&PluginFile, "plugin", false, environment.GetString(&PluginFile, "plugin", false,
"the JSON file describing plugins, default 'plugin.json'", nil) "the JSON file describing plugins, default 'DB' uses the database config table 'FILEPLUGINS' entry", nil)
environment.GetString(&insecure, "insecure", false, environment.GetString(&insecure, "insecure", false,
"if 'true' allow https endpoints with invalid certificates (only for testing)", nil) "if 'true' allow https endpoints with invalid certificates (only for testing)", nil)
} }
@ -98,15 +111,23 @@ func LibSetup() error {
return err return err
} }
json, err := ioutil.ReadFile(PluginFile) var json = make([]byte, 0)
if PluginFile == "DB" {
json = []byte(request.ConfigString("FILEPLUGINS", ""))
if len(bytes.TrimSpace(json)) == 0 {
return nil // don't fail if the DB does not exist yet
}
} else {
json, err = ioutil.ReadFile(PluginFile)
if err != nil { if err != nil {
log.Info("Plugin file '" + PluginFile + "' not found, using no plugins") log.Info("Plugin file '" + PluginFile + "' not found, using no plugins")
json = []byte(" [ ] \n") json = []byte(" [ ] \n")
err = nil err = nil
} }
}
err = Lib.Configure(json) err = Lib.Configure(json)
if err != nil { if err != nil {
//fmt.Println("DEBUG plugin: "+string(json))
return err return err
} }
return Lib.StartLocalRPCservers(infoLog{}, errorLog{}) return Lib.StartLocalRPCservers(infoLog{}, errorLog{})

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package plugins package plugins
import ( import (
@ -15,9 +26,11 @@ func TestSetup(t *testing.T) {
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
if len(ssc) > 3 {
t.Errorf("extra convert formats:%v", ssc) // TODO(Elliott) review for empty database
} //if len(ssc) > 3 {
// t.Errorf("extra convert formats:%v", ssc)
//}
/* this code leaves plugins still running */ /* this code leaves plugins still running */
err = os.Chdir("../../..") err = os.Chdir("../../..")

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"github.com/documize/community/documize/api/entity" "github.com/documize/community/documize/api/entity"
"github.com/documize/community/wordsmith/environment" "github.com/documize/community/wordsmith/environment"
@ -44,7 +55,7 @@ func testDeleteAccount(t *testing.T, p *Persister) {
} }
func TestAccount(t *testing.T) { func TestAccount(t *testing.T) {
environment.Parse() environment.Parse("db")
p := newTestPersister(t) p := newTestPersister(t)
defer deleteTestAuditTrail(t, p) defer deleteTestAuditTrail(t, p)
@ -124,3 +135,4 @@ func TestAccount(t *testing.T) {
p.testRollback(t) p.testRollback(t)
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
/* TODO(Elliott)
import ( import (
"testing" "testing"
@ -12,7 +25,7 @@ const testFileID = "testFileID"
func TestAttachment(t *testing.T) { func TestAttachment(t *testing.T) {
environment.Parse() environment.Parse("db")
p := newTestPersister(t) p := newTestPersister(t)
defer deleteTestAuditTrail(t, p) defer deleteTestAuditTrail(t, p)
@ -90,3 +103,4 @@ func TestAttachment(t *testing.T) {
} }
p.testRollback(t) p.testRollback(t)
} }
*/

View file

@ -0,0 +1,67 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
import (
"bytes"
"github.com/documize/community/wordsmith/utility"
)
/* NOT CURRENTLY USED
// FlagFromDB overrides the value in *target if it is set in the database configuration JSON.
// Function signaiture must map that in environment.
func FlagFromDB(target *string, name string) bool {
value := ConfigString(environment.Prefix, name)
//fmt.Println("DEBUG FlagFromDB " + value)
if value != `""` && value != "" {
*target = strings.TrimPrefix(strings.TrimSuffix(value, `"`), `"`)
return true
}
return false
}
*/
// ConfigString fetches a configuration JSON element from the config table.
func ConfigString(area, path string) (ret string) {
if Db == nil {
return ""
}
if path != "" {
path = "." + path
}
sql := "SELECT JSON_EXTRACT(`config`,'$" + path + "') FROM `config` WHERE `key` = '" + area + "';"
stmt, err := Db.Preparex(sql)
if err != nil {
//fmt.Printf("DEBUG: Unable to prepare select SQL for ConfigString: %s -- error: %v\n", sql, err)
return ""
}
defer utility.Close(stmt)
var item = make([]uint8, 0)
err = stmt.Get(&item)
if err != nil {
//fmt.Printf("DEBUG: Unable to prepare execute SQL for ConfigString: %s -- error: %v\n", sql, err)
return ""
}
if len(item) > 1 {
q := []byte(`"`)
ret = string(bytes.TrimPrefix(bytes.TrimSuffix(item, q), q))
}
//fmt.Println("DEBUG ConfigString " + sql + " => " + ret)
return ret
}

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (
@ -14,7 +25,7 @@ import (
var rc = Context{} var rc = Context{}
// Context holds the context in which the client is dealing with Dickens. // Context holds the context in which the client is dealing with Documize.
type Context struct { type Context struct {
AllowAnonymousAccess bool AllowAnonymousAccess bool
Authenticated bool Authenticated bool

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"github.com/documize/community/wordsmith/environment" "github.com/documize/community/wordsmith/environment"
"net/http" "net/http"
@ -44,7 +55,7 @@ func (p *Persister) testRollback(t *testing.T) {
func TestContext(t *testing.T) { func TestContext(t *testing.T) {
environment.Parse() environment.Parse("db")
req, err := http.NewRequest("GET", "http://example.com", nil) req, err := http.NewRequest("GET", "http://example.com", nil)
if err != nil { if err != nil {
@ -65,3 +76,4 @@ func TestContext(t *testing.T) {
} }
} }
*/

View file

@ -1,2 +1,13 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package request handles database requests for Documize, mostly from the endpoints package. // Package request handles database requests for Documize, mostly from the endpoints package.
package request package request

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"github.com/documize/community/documize/api/entity" "github.com/documize/community/documize/api/entity"
"github.com/documize/community/wordsmith/environment" "github.com/documize/community/wordsmith/environment"
@ -48,7 +59,7 @@ func testDeleteDocument(t *testing.T, p *Persister) {
} }
func TestDocument(t *testing.T) { func TestDocument(t *testing.T) {
environment.Parse() environment.Parse("db")
p := newTestPersister(t) p := newTestPersister(t)
defer deleteTestAuditTrail(t, p) defer deleteTestAuditTrail(t, p)
org := testAddOrganization(t, p) org := testAddOrganization(t, p)
@ -241,3 +252,4 @@ func TestDocument(t *testing.T) {
p.testCommit(t) p.testCommit(t)
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import "testing" import "testing"
import "net/http" import "net/http"
@ -27,3 +38,4 @@ func ds(t *testing.T, in, out1, out2 string) {
t.Errorf("GetSubdomainFromHost input `%s` got `%s` expected `%s`\n", in, got2, out2) t.Errorf("GetSubdomainFromHost input `%s` got `%s` expected `%s`\n", in, got2, out2)
} }
} }
*/

View file

@ -1,6 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"strings" "strings"
@ -38,15 +50,13 @@ func init() {
environment.GetString(&connectionString, "db", true, environment.GetString(&connectionString, "db", true,
`"username:password@protocol(hostname:port)/databasename" for example "fred:bloggs@tcp(localhost:3306)/documize"`, `"username:password@protocol(hostname:port)/databasename" for example "fred:bloggs@tcp(localhost:3306)/documize"`,
func() { func(*string, string) bool {
Db, err = sqlx.Open("mysql", stdConn(connectionString)) Db, err = sqlx.Open("mysql", stdConn(connectionString))
if err != nil { if err != nil {
log.Error("Unable to setup database", err) log.Error("Unable to setup database", err)
} }
database.DbPtr = &Db // allow the database package to see this DB connection
Db.SetMaxIdleConns(30) Db.SetMaxIdleConns(30)
Db.SetMaxOpenConns(100) Db.SetMaxOpenConns(100)
@ -59,12 +69,26 @@ func init() {
} }
// go into setup mode if required // go into setup mode if required
if database.Check(Db, connectionString) { if database.Check(Db, connectionString,
log.Info("database.Check(Db) OK") func() (bool, error) {
// LockDB locks the database for migrations, returning if locked and an error.
// TODO, and if lock fails, wait here until it unlocks
return false, errors.New("LockDB TODO")
},
func() {
// UnlockDB unlocks the database for migrations.
// Reports errors in the log.
// TODO
}) {
if err := database.Migrate(ConfigString("META", "database")); err != nil {
log.Error("Unable to run database migration: ", err)
os.Exit(2)
}
} else { } else {
log.Info("database.Check(Db) !OK, going into setup mode") log.Info("database.Check(Db) !OK, going into setup mode")
} }
return false // value not changed
}) })
} }

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"fmt" "fmt"
_ "github.com/go-sql-driver/mysql" // this must be somewhere... _ "github.com/go-sql-driver/mysql" // this must be somewhere...
@ -22,3 +33,4 @@ func TestInit(t *testing.T) {
_ = p.Base.SQLPrepareError("method", "id") // noting to test, just for coverage stats _ = p.Base.SQLPrepareError("method", "id") // noting to test, just for coverage stats
_ = p.Base.SQLSelectError("method", "id") // noting to test, just for coverage stats _ = p.Base.SQLSelectError("method", "id") // noting to test, just for coverage stats
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"testing" "testing"
@ -134,3 +145,4 @@ foundLabel:
p.Context.UserID = u // put back the right one, so that we delete correctly on tidy-up p.Context.UserID = u // put back the right one, so that we delete correctly on tidy-up
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,16 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"testing" "testing"
@ -221,4 +232,4 @@ func TestLabelRole(t *testing.T) {
p.testRollback(t) p.testRollback(t)
*/ */
} //}

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,5 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
/* TODO(Elliott)
import ( import (
"database/sql" "database/sql"
"reflect" "reflect"
@ -9,26 +22,6 @@ import (
) )
func testAddOrganization(t *testing.T, p *Persister) entity.Organization { func testAddOrganization(t *testing.T, p *Persister) entity.Organization {
/*
org := entity.Organization{
BaseEntity: entity.BaseEntity{RefID: p.Context.OrgID},
Company: "testCompany", // string `json:"-"`
Title: "testTitle", // string `json:"title"`
Message: "testMessage", // string `json:"message"`
URL: "test.domain", // string `json:"url"`
Domain: "testdomain", // string `json:"domain"`
Email: "mail@request.test.org", // string `json:"email"`
AllowAnonymousAccess: false, // bool `json:"allowAnonymousAccess"`
Serial: "123", // string `json:"-"`
Active: true, // bool `json:"-"`
}
err := p.AddOrganization(org)
if err != nil {
t.Error(err)
t.Fail()
}
p.testCommit(t)
*/
org, err := p.SetupOrganization("testCompany", "testTitle", "testMessage", "testdomain", "mail@request.test.org") org, err := p.SetupOrganization("testCompany", "testTitle", "testMessage", "testdomain", "mail@request.test.org")
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -125,3 +118,4 @@ func TestOrganization(t *testing.T) {
} }
p.testRollback(t) p.testRollback(t)
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,9 +1,21 @@
package request // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request
/* TODO(Elliott)
import ( import (
"strings" "strings"
"testing" "testing"
"github.com/documize/community/documize/api/endpoint/models"
"github.com/documize/community/documize/api/entity" "github.com/documize/community/documize/api/entity"
) )
@ -84,7 +96,7 @@ Pro patria mori.
} }
for _, page := range testPages { for _, page := range testPages {
err := p.AddPage(page) err := p.AddPage(models.PageModel{Page: page})
if err != nil { if err != nil {
t.Error(err) t.Error(err)
t.Fail() t.Fail()
@ -97,12 +109,12 @@ Pro patria mori.
func testDeletePages(t *testing.T, p *Persister, pages []entity.Page) { func testDeletePages(t *testing.T, p *Persister, pages []entity.Page) {
p.testNewTx(t) // so that we can use it reliably in defer p.testNewTx(t) // so that we can use it reliably in defer
for _, pg := range pages { for _, pg := range pages {
_ /*rows*/, err := p.DeletePage(testDocID, pg.RefID) _, err := p.DeletePage(testDocID, pg.RefID)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
//t.Fail() //t.Fail()
} }
/* this code is belt-and-braces, as document delete should also delete any pages */ // this code is belt-and-braces, as document delete should also delete any pages
//if rows != 1 { //if rows != 1 {
// t.Errorf("expected 1 page row deleted got %d", rows) // t.Errorf("expected 1 page row deleted got %d", rows)
// //t.Fail() // //t.Fail()
@ -131,7 +143,7 @@ func TestPage(t *testing.T) {
_ = acc _ = acc
_ = doc _ = doc
err := p.AddPage(pages[0]) err := p.AddPage(models.PageModel{Page: pages[0]})
if err == nil { if err == nil {
t.Error("did not error on add of duplicate record") t.Error("did not error on add of duplicate record")
} }
@ -262,3 +274,4 @@ func TestPage(t *testing.T) {
} }
p.testRollback(t) p.testRollback(t)
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
// This file contains the code for initial set-up of a database // This file contains the code for initial set-up of a database

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
import ( import (

View file

@ -1,9 +1,24 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package request package request
/* TODO(Elliott)
import ( import (
"database/sql" "database/sql"
"github.com/documize/community/documize/api/entity"
"testing" "testing"
"github.com/documize/community/documize/api/entity"
"github.com/documize/community/documize/api/util"
) )
func testAddUser(t *testing.T, p *Persister) entity.User { func testAddUser(t *testing.T, p *Persister) entity.User {
@ -20,9 +35,9 @@ func testAddUser(t *testing.T, p *Persister) entity.User {
//Reset: "testreset", // string `json:"-"` //Reset: "testreset", // string `json:"-"`
Accounts: nil, // []Account `json:"accounts"` Accounts: nil, // []Account `json:"accounts"`
} }
user.Salt = generateSalt() user.Salt = util.GenerateSalt()
requestedPassword := generateRandomPassword() requestedPassword := util.GenerateRandomPassword()
user.Password = generatePassword(requestedPassword, user.Salt) user.Password = util.GeneratePassword(requestedPassword, user.Salt)
err := p.AddUser(user) err := p.AddUser(user)
if err != nil { if err != nil {
@ -56,7 +71,7 @@ func TestUser(t *testing.T) {
defer testDeleteOrganization(t, p) defer testDeleteOrganization(t, p)
user := testAddUser(t, p) user := testAddUser(t, p)
defer testDeleteUser(t, p) defer testDeleteUser(t, p)
/*acc :=*/ testAddAccount(t, p) testAddAccount(t, p)
//defer testDeleteAccount(t, p) // done by p.DeactiveUser() //defer testDeleteAccount(t, p) // done by p.DeactiveUser()
//t.Log(user) //t.Log(user)
@ -200,3 +215,4 @@ func TestUser(t *testing.T) {
p.testRollback(t) p.testRollback(t)
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package store provides the implementation for a file system based storage provider. // Package store provides the implementation for a file system based storage provider.
// This enables all document upload previews to be processed AND stored locally. // This enables all document upload previews to be processed AND stored locally.
package store package store

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package store package store
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package store package store
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package store package store
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package util package util
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package util package util
import "testing" import "testing"

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package util package util
import ( import (

View file

@ -1,4 +1,15 @@
// Package util provides utility functions specific to the Dickens http-end-point component of Documize. // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package util provides utility functions specific to the http-end-point component of Documize.
package util package util
import "github.com/rs/xid" import "github.com/rs/xid"

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package util_test package util_test
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package database package database
import ( import (
@ -13,8 +24,22 @@ import (
var dbCheckOK bool // default false var dbCheckOK bool // default false
// Check that the database is configured correctly and that all the required tables exist // dbPtr is a pointer to the central connection to the database, used by all database requests.
func Check(Db *sqlx.DB, connectionString string) bool { var dbPtr **sqlx.DB
// lockDB locks the database
var lockDB func() (bool, error)
// unlockDB unlocks the database
var unlockDB func()
// Check that the database is configured correctly and that all the required tables exist.
// It must be the first function called in the
func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB func()) bool {
dbPtr = &Db
lockDB=lDB
unlockDB=ulDB
csBits := strings.Split(connectionString, "/") csBits := strings.Split(connectionString, "/")
if len(csBits) > 1 { if len(csBits) > 1 {
web.SiteInfo.DBname = strings.Split(csBits[len(csBits)-1], "?")[0] web.SiteInfo.DBname = strings.Split(csBits[len(csBits)-1], "?")[0]

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package database package database
import ( import (
@ -8,20 +19,19 @@ import (
"strings" "strings"
"time" "time"
"github.com/jmoiron/sqlx"
"github.com/documize/community/documize/api/util" "github.com/documize/community/documize/api/util"
"github.com/documize/community/documize/web" "github.com/documize/community/documize/web"
"github.com/documize/community/wordsmith/log" "github.com/documize/community/wordsmith/log"
"github.com/documize/community/wordsmith/utility" "github.com/documize/community/wordsmith/utility"
) )
// DbPtr is a pointer to the central connection to the database, used by all database requests.
var DbPtr **sqlx.DB
func runSQL(sql string) (id uint64, err error) { func runSQL(sql string) (id uint64, err error) {
tx, err := (*DbPtr).Beginx() if strings.TrimSpace(sql) == "" {
return 0, nil
}
tx, err := (*dbPtr).Beginx()
if err != nil { if err != nil {
log.Error("runSql - failed to get transaction", err) log.Error("runSql - failed to get transaction", err)
@ -50,6 +60,7 @@ func runSQL(sql string) (id uint64, err error) {
// Create the tables in a blank database // Create the tables in a blank database
func Create(w http.ResponseWriter, r *http.Request) { func Create(w http.ResponseWriter, r *http.Request) {
txt := "database.Create()" txt := "database.Create()"
//defer func(){fmt.Println("DEBUG"+txt)}()
if dbCheckOK { if dbCheckOK {
txt += " Check OK" txt += " Check OK"
@ -119,13 +130,15 @@ func Create(w http.ResponseWriter, r *http.Request) {
return return
} }
buf, err := web.ReadFile("scripts/create.sql") firstSQL := "db_00000.sql"
buf, err := web.ReadFile("scripts/" + firstSQL)
if err != nil { if err != nil {
log.Error("database.Create()'s web.ReadFile()", err) log.Error("database.Create()'s web.ReadFile()", err)
return return
} }
tx, err := (*DbPtr).Beginx() tx, err := (*dbPtr).Beginx()
if err != nil { if err != nil {
log.Error(" failed to get transaction", err) log.Error(" failed to get transaction", err)
return return
@ -149,6 +162,11 @@ func Create(w http.ResponseWriter, r *http.Request) {
return return
} }
if err := Migrate(firstSQL); err != nil {
log.Error("database.Create()", err)
return
}
err = setupAccount(details, util.GenerateSalt()) err = setupAccount(details, util.GenerateSalt())
if err != nil { if err != nil {
log.Error("database.Create()", err) log.Error("database.Create()", err)
@ -235,8 +253,8 @@ func setupAccount(completion onboardRequest, serial string) (err error) {
// getStatement strips out the comments and returns all the individual SQL commands (apart from "USE") as a []string. // getStatement strips out the comments and returns all the individual SQL commands (apart from "USE") as a []string.
func getStatements(bytes []byte) []string { func getStatements(bytes []byte) []string {
/* Strip comments of the form '-- comment', '// comment' or like this one */ /* Strip comments of the form '-- comment' or like this one */
stripped := regexp.MustCompile("(?s)--.*?\n|(?s)//.*?\n|/\\*.*?\\*/").ReplaceAll(bytes, []byte("\n")) stripped := regexp.MustCompile("(?s)--.*?\n|/\\*.*?\\*/").ReplaceAll(bytes, []byte("\n"))
sqls := strings.Split(string(stripped), ";") sqls := strings.Split(string(stripped), ";")
ret := make([]string, 0, len(sqls)) ret := make([]string, 0, len(sqls))
for _, v := range sqls { for _, v := range sqls {

View file

@ -1,102 +1,13 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package database package database
/*
import (
"strings"
"testing"
"github.com/documize/community/documize/api/request"
"github.com/documize/community/wordsmith/environment"
)
// Part of the test code below from https://searchcode.com/codesearch/view/88832051/
//
// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
//
// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
func TestLongData(t *testing.T) {
environment.Parse()
var maxAllowedPacketSize int
rows, err := request.Db.Query("select @@max_allowed_packet")
if err != nil {
t.Fatal(err)
}
if rows.Next() {
if err = rows.Scan(&maxAllowedPacketSize); err != nil {
t.Fatal(err)
}
}
t.Logf("maxAllowedPacketSize=%d", maxAllowedPacketSize)
maxAllowedPacketSize--
// don't get too ambitious
if maxAllowedPacketSize > 1<<25 {
maxAllowedPacketSize = 1 << 25
}
request.Db.MustExec("DROP TABLE IF EXISTS `test`;")
request.Db.MustExec("CREATE TABLE test (value LONGBLOB)")
in := strings.Repeat(`a`, maxAllowedPacketSize+1)
var out string
// Long text data
const nonDataQueryLen = 28 // length query w/o value
inS := in[:maxAllowedPacketSize-nonDataQueryLen]
request.Db.MustExec("INSERT INTO test VALUES('" + inS + "')")
rows, err = request.Db.Query("SELECT value FROM test")
if err != nil {
t.Fatal(err)
}
if rows.Next() {
if err = rows.Scan(&out); err != nil {
t.Fatal(err)
}
if inS != out {
t.Fatalf("LONGBLOB: length in: %d, length out: %d", len(inS), len(out))
}
if rows.Next() {
t.Error("LONGBLOB: unexpexted row")
}
} else {
t.Fatalf("LONGBLOB: no data")
}
// Empty table
request.Db.MustExec("TRUNCATE TABLE test")
// Long binary data
request.Db.MustExec("INSERT INTO test VALUES(?)", in)
rows, err = request.Db.Query("SELECT value FROM test WHERE 1=?", 1)
if err != nil {
t.Fatal(err)
}
if rows.Next() {
if err = rows.Scan(&out); err != nil {
t.Fatal(err)
}
if in != out {
t.Fatalf("LONGBLOB: length in: %d, length out: %d", len(in), len(out))
}
if rows.Next() {
t.Error("LONGBLOB: unexpexted row")
}
} else {
if err = rows.Err(); err != nil {
t.Fatalf("LONGBLOB: no data (err: %s)", err.Error())
} else {
t.Fatal("LONGBLOB: no data (err: <nil>)")
}
}
}
*/

View file

@ -1 +1,90 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package database package database
import (
"fmt"
"sort"
"strings"
"github.com/documize/community/documize/web"
)
const migrationsDir = "bindata/scripts"
// migrationsT holds a list of migration sql files to run.
type migrationsT []string
// migrations returns a list of the migrations to update the database as required for this version of the code.
func migrations(lastMigration string) (migrationsT, error) {
lastMigration = strings.TrimPrefix(strings.TrimSuffix(lastMigration, `"`), `"`)
//fmt.Println(`DEBUG Migrations("`+lastMigration+`")`)
files, err := web.AssetDir(migrationsDir)
if err != nil {
return nil, err
}
sort.Strings(files)
ret := make(migrationsT, 0, len(files))
hadLast := false
for _, v := range files {
if v == lastMigration {
hadLast = true
} else {
if hadLast {
ret = append(ret, v)
}
}
}
//fmt.Println(`DEBUG Migrations("`+lastMigration+`")=`,ret)
return ret, nil
}
// migrate the database as required, by applying the migrations.
func (m migrationsT) migrate() error {
for _, v := range m {
buf, err := web.Asset(migrationsDir + "/" + v)
if err != nil {
return err
}
fmt.Println("DEBUG database.Migrate() ", v, ":\n", string(buf)) // TODO actually run the SQL
}
return nil
}
// Migrate the database as required, consolidated action.
func Migrate(lastMigration string) error {
mig, err := migrations(lastMigration)
if err != nil {
return err
}
if len(mig) == 0 {
return nil // no migrations to perform
}
locked, err := lockDB()
if err != nil {
return err
}
if locked {
defer unlockDB()
if err := mig.migrate(); err != nil {
return err
}
}
return nil
}

View file

@ -1,5 +1,4 @@
-- SQL to set up the Documize database -- SQL to set up the Documize database
USE `documize`;
DROP TABLE IF EXISTS `user`; DROP TABLE IF EXISTS `user`;
@ -262,3 +261,19 @@ ALTER TABLE label CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE document CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER TABLE document CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE page CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER TABLE page CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
*/ */
DROP TABLE IF EXISTS `config`;
CREATE TABLE IF NOT EXISTS `config` (
`key` CHAR(225) NOT NULL,
`config` JSON,
UNIQUE INDEX `idx_config_area` (`key` ASC) ) ;
INSERT INTO `config` VALUES ('SMTP','{\"userid\": \"\",\"password\": \"\",\"host\": \"\",\"port\": \"\",\"sender\": \"\"}');
INSERT INTO `config` VALUES ('FILEPLUGINS',
'[{\"Comment\": \"Disable (or not) built-in html import (NOTE: no Plugin name)\",\"Disabled\": false,\"API\": \"Convert\",\"Actions\": [\"htm\",\"html\"]},{\"Comment\": \"Disable (or not) built-in Documize API import used from SDK (NOTE: no Plugin name)\",\"Disabled\": false,\"API\": \"Convert\",\"Actions\": [\"documizeapi\"]}]');
INSERT INTO `config` VALUES ('LICENSE','{\"token\": \"\",\"endpoint\": \"https://api.documize.com\"}');
INSERT INTO `config` VALUES ('META','{\"database\": \"db_00000.sql\"}');

View file

@ -1,27 +0,0 @@
ALTER TABLE page ADD `userid` CHAR(16) DEFAULT '' COLLATE utf8_bin AFTER documentid;
ALTER TABLE revision ADD `rawbody` LONGBLOB AFTER body;
ALTER TABLE revision ADD `config` JSON AFTER rawbody;
ALTER TABLE revision ADD `ownerid` CHAR(16) DEFAULT '' COLLATE utf8_bin AFTER documentid;
DROP TABLE IF EXISTS `pagemeta`;
CREATE TABLE IF NOT EXISTS `pagemeta` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`pageid` CHAR(16) NOT NULL COLLATE utf8_bin,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`documentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`rawbody` LONGBLOB,
`config` JSON,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`revised` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_pageid PRIMARY KEY (pageid),
UNIQUE INDEX `idx_pagemeta_id` (`id` ASC),
INDEX `idx_pagemeta_pageid` (`pageid` ASC),
INDEX `idx_pagemeta_orgid` (`orgid` ASC),
INDEX `idx_pagemeta_documentid` (`documentid` ASC))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;
INSERT INTO pagemeta (pageid,orgid,documentid,rawbody)
SELECT refid as pageid,orgid,documentid,body FROM page;

View file

@ -1,4 +0,0 @@
ALTER TABLE pagemeta ADD `externalsource` BOOL DEFAULT 0 AFTER config;
UPDATE pagemeta SET externalsource=1 WHERE pageid in (SELECT refid FROM page WHERE contenttype='gemini');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1,75 +0,0 @@
use documize;
select * from organization;
select * from user order by id desc;
select * from account order by id desc;
select * from label;
select * from labelrole order by labelid desc;
select * from document order by id desc;
select * from page;
select * from revision order by created desc;
select * from search;
select * from attachment;
select * from audit;
SELECT id, refid, company, title, message, url, domain, email, serial, active, allowanonymousaccess, created, revised FROM organization WHERE domain='demo1' AND active=1;
update label set label = 'Elliotts' where refid='Dm3gA68B';
select * from page where documentid='VsuZPte68QlYquY_' order by sequence;
SELECT UPPER(CONCAT(SUBSTR(firstname, 1, 1), SUBSTR(lastname, 1, 1))) as initials from user;
SELECT a.userid,
COALESCE(u.firstname, '') as firstname,
COALESCE(u.lastname, '') as lastname,
COALESCE(u.email, '') as email,
a.labelid,
b.label as name,
b.type
FROM labelrole a
LEFT JOIN label b ON b.refid=a.labelid
LEFT JOIN user u ON u.refid=a.userid
WHERE a.orgid='4Tec34w8'
AND b.type!=2
GROUP BY a.labelid,a.userid
ORDER BY u.firstname,u.lastname;
delete from label where id > 0;
select * from search;
REPAIR TABLE search QUICK;
select * from audit order by id desc;
select refid,firstname,lastname from user where refid in (select userid as refid from audit where documentid='9n_VhcY6');
select max(a.created) as date, a.userid, u.firstname, u.lastname from audit a left join user u ON a.userid=u.refid where a.documentid='M6H0kYov' AND action='get-document'
group by a.userid;
SELECT action, CONVERT_TZ(a.created, @@session.time_zone, '+00:00') as utcdate, a.created, a.userid, u.firstname, u.lastname, a.pageid FROM audit a LEFT JOIN user u ON a.userid=u.refid WHERE documentid='9n_VhcY6' AND
(action='update-page' OR action='add-page')
ORDER BY created DESC;
SELECT CONVERT_TZ(MAX(a.created), @@session.time_zone, '+00:00') as created, a.userid, u.firstname, u.lastname
FROM audit a LEFT JOIN user u ON a.userid=u.refid
WHERE a.orgid='4Tec34w8' AND a.documentid='Zmw6BDCi' AND a.userid != '0' AND action='get-document'
GROUP BY a.userid ORDER BY a.created DESC;
SELECT MAX(a.created) as created, a.userid as refid, u.firstname, u.lastname
FROM audit a LEFT JOIN user u ON a.userid=u.refid
WHERE a.documentid='' AND action='get-document'
GROUP BY a.userid;
select * from audit where documentid='kdadSBx1' and (action='update-page' OR action='remove-page' OR action='add-page') order by created desc;
SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP);
SELECT @@global.time_zone;
SELECT * FROM document where tags like "%#hr#%";
select labelid, userid ,count(*) as cnt from labelrole group by labelid,userid;

View file

@ -1,5 +1,15 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// This package provides Documize as a single executable. // This package provides Documize as a single executable.
// It should be run from the dickens directory, where the plugin.json file is and runs from.
package main package main
import ( import (
@ -10,7 +20,7 @@ import (
) )
func main() { func main() {
environment.Parse() environment.Parse("db") // process the db value first
ready := make(chan struct{}, 1) // channel is used for testing ready := make(chan struct{}, 1) // channel is used for testing
endpoint.Serve(ready) endpoint.Serve(ready)

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
import ( import (
@ -48,7 +59,7 @@ func Command(section string, w http.ResponseWriter, r *http.Request) bool {
if ok { if ok {
s.Command(w, r) s.Command(w, r)
} }
return false return ok
} }
// Render runs that operation for the given section id, the returned bool indicates success. // Render runs that operation for the given section id, the returned bool indicates success.

View file

@ -1,5 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
/* TODO(Elliott)
import ( import (
"net/http" "net/http"
"testing" "testing"
@ -58,3 +71,4 @@ func TestSection(t *testing.T) {
t.Logf("%v %v", v.Order, v.Title) t.Logf("%v %v", v.Order, v.Title)
} }
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section package section
import ( import (

View file

@ -1,8 +1,2 @@
ASIMOV
======
The wiki web app.
Only talks to Dickens.
Uses github.com/elazarl/go-bindata-assetfs, which must be installed to 'go generate' to create bindata_assetfs.go Uses github.com/elazarl/go-bindata-assetfs, which must be installed to 'go generate' to create bindata_assetfs.go

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package web contains the Documize static web data. // Package web contains the Documize static web data.
package web package web
@ -33,7 +44,7 @@ var SiteInfo struct {
} }
func init() { func init() {
environment.GetString(&SiteMode, "offline", false, "set to '1' for OFFLINE mode", nil) environment.GetString(&SiteMode, "offline", false, "set to '1' for OFFLINE mode", nil) // no sense overriding this setting from the DB
SiteInfo.DBhash = util.GenerateRandomPassword() // do this only once SiteInfo.DBhash = util.GenerateRandomPassword() // do this only once
} }

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
// Package main provides a simple Documize plugin for document conversions using libreoffice. // Package main provides a simple Documize plugin for document conversions using libreoffice.
package main package main

View file

@ -1,19 +0,0 @@
[
{
"Comment": "Disable (or not) built-in html import (NOTE: no Plugin name)",
"Disabled": false,
"API": "Convert",
"Actions": [
"htm",
"html"
]
},
{
"Comment": "Disable (or not) built-in Documize API import used from SDK (NOTE: no Plugin name)",
"Disabled": false,
"API": "Convert",
"Actions": [
"documizeapi"
]
}
]

View file

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Documize
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -5,7 +5,7 @@
The directory "documize" contains a command line utility to load files onto the Documize server. The directory "documize" contains a command line utility to load files onto the Documize server.
Run the command with "--help" to see the available flags. Run the command with "--help" to see the available flags.
## test suite ## test suite (currently disabled)
The directory "exttest" contains a set of tests that are used both to test this package and to test the main documize code. The directory "exttest" contains a set of tests that are used both to test this package and to test the main documize code.
@ -15,4 +15,4 @@ In order to run these tests two environment variables must be set:
which must be of the form ```:mick@jagger.com:demo123``` at present, which must be of the form ```:mick@jagger.com:demo123``` at present,
with the Documize DB organistion record having the default (empty) subdomain. with the Documize DB organistion record having the default (empty) subdomain.
There must also be a single folder named "Test" for code to find and use. There must also be a single folder named "Test" for code to find and use. TODO(Elliott) remove this restriction.

View file

@ -1,5 +1,16 @@
package documize_test // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package documize_test
/* TODO(Elliott)
import "testing" import "testing"
import "github.com/documize/community/sdk/exttest" import "github.com/documize/community/sdk/exttest"
@ -16,3 +27,4 @@ func BenchmarkAPIbench(b *testing.B) {
} }
} }
} }
*/

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package documize package documize
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package documize package documize
import ( import (

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package documize package documize
import ( import (

Some files were not shown because too many files have changed in this diff Show more