mirror of
https://github.com/documize/community.git
synced 2025-07-22 14:49:42 +02:00
Merge branch 'master' into core-restructure
# Conflicts: # documize/api/endpoint/router.go
This commit is contained in:
commit
3445994160
25 changed files with 677 additions and 602 deletions
|
@ -8,6 +8,12 @@ Documentation that integrates and snapshots data from the tools you use.
|
||||||
|
|
||||||
v0.15.0
|
v0.15.0
|
||||||
|
|
||||||
|
## OS Support
|
||||||
|
|
||||||
|
* Windows
|
||||||
|
* Linux
|
||||||
|
* OSX
|
||||||
|
|
||||||
## Tech stack
|
## Tech stack
|
||||||
|
|
||||||
* EmberJS v2.5.1
|
* EmberJS v2.5.1
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default Ember.Component.extend({
|
||||||
targetOffset: "10px 0",
|
targetOffset: "10px 0",
|
||||||
constrainToWindow: true,
|
constrainToWindow: true,
|
||||||
constrainToScrollParent: true,
|
constrainToScrollParent: true,
|
||||||
|
tether: Ember.inject.service(),
|
||||||
|
|
||||||
hasSecondButton: Ember.computed('button2', 'color2', function () {
|
hasSecondButton: Ember.computed('button2', 'color2', function () {
|
||||||
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
|
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
|
||||||
|
@ -43,9 +44,10 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
// TODO: refactor to eliminate self
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let drop = new Drop({
|
let drop = this.get('tether').createDrop({
|
||||||
target: document.getElementById(self.get('target')),
|
target: document.getElementById(self.get('target')),
|
||||||
content: self.$(".dropdown-dialog")[0],
|
content: self.$(".dropdown-dialog")[0],
|
||||||
classes: 'drop-theme-basic',
|
classes: 'drop-theme-basic',
|
||||||
|
@ -65,8 +67,7 @@ export default Ember.Component.extend({
|
||||||
remove: true
|
remove: true
|
||||||
});
|
});
|
||||||
|
|
||||||
self.set('drop', drop);
|
if (drop) {
|
||||||
|
|
||||||
drop.on('open', function () {
|
drop.on('open', function () {
|
||||||
if (is.not.null(self.get("focusOn"))) {
|
if (is.not.null(self.get("focusOn"))) {
|
||||||
document.getElementById(self.get("focusOn")).focus();
|
document.getElementById(self.get("focusOn")).focus();
|
||||||
|
@ -80,15 +81,24 @@ export default Ember.Component.extend({
|
||||||
self.attrs.onOpenCallback(drop);
|
self.attrs.onOpenCallback(drop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
self.set('drop', drop);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this.get('drop').destroy();
|
let drop = this.get('drop');
|
||||||
|
if (drop) {
|
||||||
|
drop.destroy();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.get('drop').close();
|
let drop = this.get('drop');
|
||||||
|
if (drop) {
|
||||||
|
drop.close();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onAction() {
|
onAction() {
|
||||||
|
@ -98,8 +108,9 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
let close = this.attrs.onAction();
|
let close = this.attrs.onAction();
|
||||||
|
|
||||||
if (close) {
|
let drop = this.get('drop');
|
||||||
this.get('drop').close();
|
if (close && drop) {
|
||||||
|
drop.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -110,8 +121,9 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
let close = this.attrs.onAction2();
|
let close = this.attrs.onAction2();
|
||||||
|
|
||||||
if (close) {
|
let drop = this.get('drop');
|
||||||
this.get('drop').close();
|
if (close && drop) {
|
||||||
|
drop.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ export default Ember.Component.extend({
|
||||||
position: 'bottom right',
|
position: 'bottom right',
|
||||||
contentId: "",
|
contentId: "",
|
||||||
drop: null,
|
drop: null,
|
||||||
|
tether: Ember.inject.service(),
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
|
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
|
||||||
|
@ -31,7 +32,7 @@ export default Ember.Component.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let drop = new Drop({
|
let drop = this.get('tether').createDrop({
|
||||||
target: document.getElementById(self.get('target')),
|
target: document.getElementById(self.get('target')),
|
||||||
content: self.$(".dropdown-menu")[0],
|
content: self.$(".dropdown-menu")[0],
|
||||||
classes: 'drop-theme-menu',
|
classes: 'drop-theme-menu',
|
||||||
|
@ -47,6 +48,9 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this.get('drop').destroy();
|
let drop = this.get('drop');
|
||||||
|
if (drop) {
|
||||||
|
drop.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -14,7 +14,8 @@ import netUtil from '../utils/net';
|
||||||
import config from '../config/environment';
|
import config from '../config/environment';
|
||||||
|
|
||||||
export default Ember.Service.extend({
|
export default Ember.Service.extend({
|
||||||
sessionService: Ember.inject.service('session'),
|
session: Ember.inject.service('session'),
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
ready: false,
|
ready: false,
|
||||||
enabled: config.APP.auditEnabled,
|
enabled: config.APP.auditEnabled,
|
||||||
appId: config.APP.intercomKey,
|
appId: config.APP.intercomKey,
|
||||||
|
@ -45,9 +46,10 @@ export default Ember.Service.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
let session = this.get('sessionService');
|
let self = this;
|
||||||
|
let user = this.get('session.user');
|
||||||
|
|
||||||
if (this.get('appId') === "" || !this.get('enabled') || !session.authenticated || this.get('ready')) {
|
if (is.undefined(user) || this.get('appId') === "" || !this.get('enabled') || !this.get('session.authenticated') || this.get('ready')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,19 +57,19 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
window.intercomSettings = {
|
window.intercomSettings = {
|
||||||
app_id: this.get('appId'),
|
app_id: this.get('appId'),
|
||||||
name: session.user.firstname + " " + session.user.lastname,
|
name: user.fullname,
|
||||||
email: session.user.email,
|
email: user.email,
|
||||||
user_id: session.user.id,
|
user_id: user.id,
|
||||||
"administrator": session.user.admin,
|
"administrator": user.admin,
|
||||||
company: {
|
company: {
|
||||||
id: session.get('appMeta.orgId'),
|
id: self.get('appMeta.orgId'),
|
||||||
name: session.get('appMeta.title').string,
|
name: self.get('appMeta.title').string,
|
||||||
"domain": netUtil.getSubdomain(),
|
"domain": netUtil.getSubdomain(),
|
||||||
"version": session.get('appMeta.version')
|
"version": self.get('appMeta.version')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!session.get('isMobile')) {
|
if (!this.get('session.isMobile')) {
|
||||||
window.intercomSettings.widget = {
|
window.intercomSettings.widget = {
|
||||||
activator: "#IntercomDefaultWidget"
|
activator: "#IntercomDefaultWidget"
|
||||||
};
|
};
|
||||||
|
|
33
app/app/services/tether.js
Normal file
33
app/app/services/tether.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a work around problems that tether introduces into testing.
|
||||||
|
* TODO: remove this code and refactor in favour of ember-tether
|
||||||
|
*/
|
||||||
|
export default Ember.Service.extend({
|
||||||
|
createDrop() {
|
||||||
|
if (Ember.testing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Drop(...arguments);
|
||||||
|
},
|
||||||
|
createTooltip() {
|
||||||
|
if (Ember.testing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Tooltip(...arguments);
|
||||||
|
}
|
||||||
|
});
|
|
@ -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
|
||||||
|
|
||||||
import Mirage from 'ember-cli-mirage';
|
import Mirage from 'ember-cli-mirage';
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
@ -13,48 +24,6 @@ export default function () {
|
||||||
return schema.db.meta[0];
|
return schema.db.meta[0];
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/public/validate', function (schema, request) {
|
|
||||||
let serverToken = request.queryParams.token;
|
|
||||||
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
|
||||||
|
|
||||||
if (token = serverToken) {
|
|
||||||
return {
|
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/users/0/permissions', function () {
|
|
||||||
return [{
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "",
|
|
||||||
"canView": true,
|
|
||||||
"canEdit": false
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/templates', function () {
|
this.get('/templates', function () {
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
@ -63,55 +32,231 @@ export default function () {
|
||||||
let folder_id = request.queryParams.folder;
|
let folder_id = request.queryParams.folder;
|
||||||
|
|
||||||
if (folder_id = "VzMuyEw_3WqiafcG") {
|
if (folder_id = "VzMuyEw_3WqiafcG") {
|
||||||
|
return schema.db.documents.where({ folderId: folder_id });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (folder_id = 'V0Vy5Uw_3QeDAMW9') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id', function (schema, request) {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.documents.where({ id: `${id}` })[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/pages', function () {
|
||||||
return [{
|
return [{
|
||||||
"id": "VzMwX0w_3WrtFztd",
|
"id": "VzMzBUw_3WrtFztw",
|
||||||
"created": "2016-05-11T13:15:11Z",
|
"created": "2016-05-11T13:26:29Z",
|
||||||
"revised": "2016-05-11T13:22:16Z",
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 1,
|
||||||
|
"sequence": 1024,
|
||||||
|
"title": "README",
|
||||||
|
"body": "",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFztx",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 2048,
|
||||||
|
"title": "To Document / Instructions ",
|
||||||
|
"body": "\n\n\u003cp\u003eThe build process around go get github.com/elazarl/go-bindata-assetfs\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzty",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 3072,
|
||||||
|
"title": "GO ",
|
||||||
|
"body": "\n\n\u003cp\u003egobin / go env\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFztz",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 4096,
|
||||||
|
"title": "go-bindata-assetsfs ",
|
||||||
|
"body": "\n\n\u003cp\u003emake sure you do install cmd from inside go-* folder where main.go lives\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzt0",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 5120,
|
||||||
|
"title": "SSL ",
|
||||||
|
"body": "\n\n\u003cp\u003eselfcert generation and avoiding red lock\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\"\u003ehttps://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003echrome://restart\u003c/p\u003e\n\n\u003cp\u003ego run generate_cert.go -host demo1.dev\u003c/p\u003e\n\n\u003cp\u003eport number not required\nbut browser restart is!\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzt1",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 6144,
|
||||||
|
"title": "after clone ",
|
||||||
|
"body": "\n\n\u003cul\u003e\n\u003cli\u003ecd app\u003c/li\u003e\n\u003cli\u003enpm install\u003c/li\u003e\n\u003cli\u003ebower install\u003c/li\u003e\n\u003cli\u003ecd ..\u003c/li\u003e\n\u003cli\u003e./build.sh\u003c/li\u003e\n\u003c/ul\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "V1qnNUw_3QRDs13j",
|
||||||
|
"created": "2016-06-10T11:40:37Z",
|
||||||
|
"revised": "2016-06-10T11:40:37Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "github",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 12288,
|
||||||
|
"title": "GitHub Section",
|
||||||
|
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "V1qqJkw_3RXs3w1D",
|
||||||
|
"created": "2016-06-10T11:53:10Z",
|
||||||
|
"revised": "2016-06-10T11:53:10Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "github",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 24576,
|
||||||
|
"title": "GitHub Section",
|
||||||
|
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.post('/templates/0/folder/VzMuyEw_3WqiafcG', function (schema, request) {
|
||||||
|
let type = request.queryParams.type;
|
||||||
|
if (type === 'saved') {
|
||||||
|
return schema.db.documents.insert({
|
||||||
|
"id": "V4y7jkw_3QvCDSeS",
|
||||||
|
"created": "2016-07-18T11:20:47Z",
|
||||||
|
"revised": "2016-07-18T11:20:47Z",
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
"job": "",
|
"job": "",
|
||||||
"location": "template-0",
|
"location": "template-0",
|
||||||
"name": "Empty Document",
|
"name": "New Document",
|
||||||
"excerpt": "My test document",
|
"excerpt": "A new document",
|
||||||
"tags": "",
|
"tags": "",
|
||||||
"template": false
|
"template": false
|
||||||
}, {
|
});
|
||||||
"id": "VzMvJEw_3WqiafcI",
|
|
||||||
"created": "2016-05-11T13:09:56Z",
|
|
||||||
"revised": "2016-05-11T13:09:56Z",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"job": "0bf9b076-cb74-4e8e-75be-8ee2d24a8171",
|
|
||||||
"location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/0bf9b076-cb74-4e8e-75be-8ee2d24a8171/README.md",
|
|
||||||
"name": "README",
|
|
||||||
"excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
|
|
||||||
"tags": "",
|
|
||||||
"template": false
|
|
||||||
}];
|
|
||||||
} else if (folder_id = "VzMygEw_3WrtFzto") {
|
|
||||||
return {
|
|
||||||
"id": "VzMygEw_3WrtFzto",
|
|
||||||
"created": "2016-05-11T13:24:17Z",
|
|
||||||
"revised": "2016-05-11T13:25:51Z",
|
|
||||||
"name": "Test",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"folderType": 1
|
|
||||||
};
|
|
||||||
} else if (folder_id = 'V0Vy5Uw_3QeDAMW9') {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.delete('/documents/:id', function (schema, request) {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.documents.remove(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/attachments', function () {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/meta', function () {
|
||||||
|
return {
|
||||||
|
"viewers": [{
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"created": "2016-07-14T13:46:24Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}],
|
||||||
|
"editors": [{
|
||||||
|
"pageId": "V1qqJkw_3RXs3w1D",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-06-10T11:53:10Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "V1qnNUw_3QRDs13j",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-06-10T11:40:37Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztw",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztx",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzty",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztz",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzt0",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzt1",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
this.get('/folders', function (schema) {
|
this.get('/folders', function (schema) {
|
||||||
return schema.db.folders;
|
return schema.db.folders;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/folders', function (schema, request) {
|
this.post('/folders', function (schema, request) {
|
||||||
var name = JSON.parse(request.requestBody).name;
|
var name = JSON.parse(request.requestBody).name;
|
||||||
let newFolder = {
|
let folder = {
|
||||||
"id": "V0Vy5Uw_3QeDAMW9",
|
"id": "V0Vy5Uw_3QeDAMW9",
|
||||||
"created": "2016-05-25T09:39:49Z",
|
"created": "2016-05-25T09:39:49Z",
|
||||||
"revised": "2016-05-25T09:39:49Z",
|
"revised": "2016-05-25T09:39:49Z",
|
||||||
|
@ -121,43 +266,19 @@ export default function () {
|
||||||
"folderType": 2
|
"folderType": 2
|
||||||
};
|
};
|
||||||
|
|
||||||
let folder = schema.db.folders.insert(newFolder);
|
return schema.db.folders.insert(folder);
|
||||||
return folder;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/public/authenticate', (schema, request) => {
|
this.post('/public/authenticate', (schema, request) => {
|
||||||
let authorization = request.requestHeaders.Authorization;
|
let authorization = request.requestHeaders.Authorization;
|
||||||
let expectedAuthorization = "Basic OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==";
|
let expectedAuthorization = "Basic OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==";
|
||||||
|
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
||||||
|
let user = schema.db.users.where({ id: "VzMuyEw_3WqiafcE" });
|
||||||
|
|
||||||
if (expectedAuthorization === authorization) {
|
if (expectedAuthorization === authorization) {
|
||||||
console.log("SSO login success");
|
|
||||||
return {
|
return {
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
"token": `${token}`,
|
||||||
"user": {
|
"user": user[0]
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,78 +287,49 @@ export default function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
"token": `${token}`,
|
||||||
"user": {
|
"user": user[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users/:id/permissions', (schema, request) => {
|
||||||
|
let userId = request.params.id;
|
||||||
|
return schema.db.permissions.where({ userId: `${userId}` });
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/folders/:id/permissions', (schema, request) => {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.folderPermissions.where({ id: `${id}` });
|
||||||
|
});
|
||||||
|
|
||||||
|
this.put('/folders/:id/permissions', () => {
|
||||||
|
// let id = request.params.id;
|
||||||
|
// let attrs = JSON.parse(request.requestBody).Roles;
|
||||||
|
// return schema.db.folderPermissions.update('VzMygEw_3WrtFzto', attrs[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users/folder/:id', () => {
|
||||||
|
return [{
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
"id": "VzMuyEw_3WqiafcE",
|
||||||
"created": "2016-05-11T15:08:24Z",
|
"created": "2016-05-11T15:08:24Z",
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
"revised": "2016-07-04T10:24:41Z",
|
||||||
"firstname": "Lennex",
|
"firstname": "Lennex",
|
||||||
"lastname": "Zinyando",
|
"lastname": "Zinyando",
|
||||||
"email": "brizdigital@gmail.com",
|
"email": "brizdigital@gmail.com",
|
||||||
"initials": "LZ",
|
"initials": "LZ",
|
||||||
"active": true,
|
"active": true,
|
||||||
"editor": true,
|
"editor": false,
|
||||||
"admin": true,
|
"admin": false,
|
||||||
"accounts": [{
|
"accounts": null
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
}];
|
||||||
"created": "2016-05-11T15:08:24Z",
|
});
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
this.get('/sections/refresh', (schema, request) => {
|
||||||
"editor": true,
|
let documentID = request.queryParams.documentID;
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
if (documentID) {
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
return {};
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/users/VzMuyEw_3WqiafcE/permissions', (schema) => {
|
|
||||||
return schema.db.permissions;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG/permissions', () => {
|
|
||||||
return [{
|
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"canView": true,
|
|
||||||
"canEdit": true
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.put('/folders/VzMygEw_3WrtFzto/permissions', () => {
|
|
||||||
return [{
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "",
|
|
||||||
"canEdit": true,
|
|
||||||
"canView": true
|
|
||||||
}, {
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMyp0w_3WrtFztq",
|
|
||||||
"canEdit": false,
|
|
||||||
"canView": false
|
|
||||||
}, {
|
|
||||||
"orgId": "",
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"canEdit": true,
|
|
||||||
"canView": true
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMygEw_3WrtFzto/permissions', () => {
|
|
||||||
return [{
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"canView": true,
|
|
||||||
"canEdit": true
|
|
||||||
}];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/folders/:id', (schema, request) => {
|
this.put('/folders/:id', (schema, request) => {
|
||||||
|
@ -264,18 +356,8 @@ export default function () {
|
||||||
return schema.db.folders.find(id);
|
return schema.db.folders.find(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/organizations/VzMuyEw_3WqiafcD', () => {
|
this.get('/organizations/VzMuyEw_3WqiafcD', (schema) => {
|
||||||
return {
|
return schema.db.organizations[0];
|
||||||
"id": "VzMuyEw_3WqiafcD",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-23T11:23:20Z",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"url": "",
|
|
||||||
"domain": "",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"allowAnonymousAccess": false
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/organizations/VzMuyEw_3WqiafcD', (schema, request) => {
|
this.put('/organizations/VzMuyEw_3WqiafcD', (schema, request) => {
|
||||||
|
@ -283,69 +365,15 @@ export default function () {
|
||||||
let message = JSON.parse(request.requestBody).title;
|
let message = JSON.parse(request.requestBody).title;
|
||||||
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
||||||
|
|
||||||
return {
|
return schema.db.organizations.update('VzMuyEw_3WqiafcD', {
|
||||||
"id": "VzMuyEw_3WqiafcD",
|
title: `${title}`,
|
||||||
"created": "2016-05-11T15:08:24Z",
|
message: `${message}`,
|
||||||
"revised": "2016-05-23T11:23:20Z",
|
allowAnonymousAccess: `${allowAnonymousAccess}`
|
||||||
"title": `${title}`,
|
});
|
||||||
"message": `${message}`,
|
|
||||||
"url": "",
|
|
||||||
"domain": "",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"allowAnonymousAccess": `${allowAnonymousAccess}`
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/users', () => {
|
this.get('/users', (schema) => {
|
||||||
return [{
|
return schema.db.users;
|
||||||
"id": "VzMyp0w_3WrtFztq",
|
|
||||||
"created": "2016-05-11T13:24:55Z",
|
|
||||||
"revised": "2016-05-11T13:33:47Z",
|
|
||||||
"firstname": "Len",
|
|
||||||
"lastname": "Random",
|
|
||||||
"email": "zinyando@gmail.com",
|
|
||||||
"initials": "LR",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": false,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMyp0w_3WrtFztr",
|
|
||||||
"created": "2016-05-11T13:24:55Z",
|
|
||||||
"revised": "2016-05-11T13:24:55Z",
|
|
||||||
"admin": false,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMyp0w_3WrtFztq",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/users', (schema, request) => {
|
this.post('/users', (schema, request) => {
|
||||||
|
@ -353,7 +381,7 @@ export default function () {
|
||||||
let lastname = JSON.parse(request.requestBody).lastname;
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
let email = JSON.parse(request.requestBody).email;
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
return {
|
let user = {
|
||||||
"id": "V0RmtUw_3QeDAMW7",
|
"id": "V0RmtUw_3QeDAMW7",
|
||||||
"created": "2016-05-24T14:35:33Z",
|
"created": "2016-05-24T14:35:33Z",
|
||||||
"revised": "2016-05-24T14:35:33Z",
|
"revised": "2016-05-24T14:35:33Z",
|
||||||
|
@ -378,35 +406,14 @@ export default function () {
|
||||||
"domain": ""
|
"domain": ""
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return schema.db.users.insert(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/users/VzMuyEw_3WqiafcE', () => {
|
this.get('/users/:id', (schema, request) => {
|
||||||
|
let id = request.params.id;
|
||||||
return {
|
let user = schema.db.users.where({ id: `${id}` });
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
return user[0];
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/users/VzMuyEw_3WqiafcE', (schema, request) => {
|
this.put('/users/VzMuyEw_3WqiafcE', (schema, request) => {
|
||||||
|
@ -414,31 +421,11 @@ export default function () {
|
||||||
let lastname = JSON.parse(request.requestBody).lastname;
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
let email = JSON.parse(request.requestBody).email;
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
return {
|
return schema.db.users.update('VzMuyEw_3WqiafcE', {
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
firstname: `${firstname}`,
|
||||||
"created": "2016-05-11T15:08:24Z",
|
lastname: `${lastname}`,
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
email: `${email}`
|
||||||
"firstname": `${firstname}`,
|
});
|
||||||
"lastname": `${lastname}`,
|
|
||||||
"email": `${email}`,
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/folders/VzMuyEw_3WqiafcG/invitation', () => {
|
this.post('/folders/VzMuyEw_3WqiafcG/invitation', () => {
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is an example factory definition.
|
This is an example factory definition.
|
||||||
|
|
||||||
|
|
27
app/mirage/factories/document.js
Normal file
27
app/mirage/factories/document.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
import { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": faker.list.cycle("VzMwX0w_3WrtFztd", "VzMvJEw_3WqiafcI", "VzMzBUw_3WrtFztv"),
|
||||||
|
"created": "2016-05-11T13:15:11Z",
|
||||||
|
"revised": "2016-05-11T13:22:16Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"job": faker.list.cycle("", "0bf9b076-cb74-4e8e-75be-8ee2d24a8171", "3004c449-b053-49a6-4abc-72688136184d"),
|
||||||
|
"location": faker.list.cycle("template-0", "/var/folders/README.md", "/var/folders/d6/3004c449-b053-49a6-4abc-72688136184d/README.md"),
|
||||||
|
"name": faker.list.cycle("Empty Document", "README", "README"),
|
||||||
|
"excerpt": faker.list.cycle("My test document", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL."),
|
||||||
|
"tags": "",
|
||||||
|
"template": false
|
||||||
|
});
|
19
app/mirage/factories/folder-permission.js
Normal file
19
app/mirage/factories/folder-permission.js
Normal file
|
@ -0,0 +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
|
||||||
|
|
||||||
|
import { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"folderId": faker.list.cycle("VzMuyEw_3WqiafcG", "VzMygEw_3WrtFzto"),
|
||||||
|
"userId": faker.list.cycle("VzMuyEw_3WqiafcE", "VzMuyEw_3WqiafcE"),
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": true
|
||||||
|
});
|
24
app/mirage/factories/organization.js
Normal file
24
app/mirage/factories/organization.js
Normal file
|
@ -0,0 +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
|
||||||
|
|
||||||
|
import { Factory } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": "VzMuyEw_3WqiafcD",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-23T11:23:20Z",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"url": "",
|
||||||
|
"domain": "",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"allowAnonymousAccess": false
|
||||||
|
});
|
|
@ -12,8 +12,8 @@
|
||||||
import Mirage, { faker } from 'ember-cli-mirage';
|
import Mirage, { faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
export default Mirage.Factory.extend({
|
export default Mirage.Factory.extend({
|
||||||
"folderId": faker.list.cycle('V0Vy5Uw_3QeDAMW9', 'VzMuyEw_3WqiafcG', 'VzMygEw_3WrtFzto', 'VzMygEw_3WrtFzto'),
|
"folderId": faker.list.cycle('V0Vy5Uw_3QeDAMW9', 'VzMuyEw_3WqiafcG', 'VzMygEw_3WrtFzto', 'VzMygEw_3WrtFzto', "VzMygEw_3WrtFzto"),
|
||||||
"userId": faker.list.cycle('VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', ''),
|
"userId": faker.list.cycle('VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', '', 0),
|
||||||
"canView": true,
|
"canView": true,
|
||||||
"canEdit": faker.list.cycle(true, true, true, false)
|
"canEdit": faker.list.cycle(true, true, true, false, false)
|
||||||
});
|
});
|
38
app/mirage/factories/user.js
Normal file
38
app/mirage/factories/user.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
import { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": faker.list.cycle("VzMyp0w_3WrtFztq", "VzMuyEw_3WqiafcE"),
|
||||||
|
"created": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"revised": faker.list.cycle("2016-05-11T13:33:47Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"firstname": faker.list.cycle("Len", "Lennex"),
|
||||||
|
"lastname": faker.list.cycle("Random", "Zinyando"),
|
||||||
|
"email": faker.list.cycle("zinyando@gmail.com", "brizdigital@gmail.com"),
|
||||||
|
"initials": faker.list.cycle("LR", "LZ"),
|
||||||
|
"active": true,
|
||||||
|
"editor": true,
|
||||||
|
"admin": faker.list.cycle(false, true),
|
||||||
|
"accounts": [{
|
||||||
|
"id": faker.list.cycle("VzMyp0w_3WrtFztr", "VzMuyEw_3WqiafcF"),
|
||||||
|
"created": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"revised": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"admin": faker.list.cycle(false, true),
|
||||||
|
"editor": faker.list.cycle(true, true),
|
||||||
|
"userId": faker.list.cycle("VzMyp0w_3WrtFztq", "VzMuyEw_3WqiafcE"),
|
||||||
|
"orgId": faker.list.cycle("VzMuyEw_3WqiafcD", "VzMuyEw_3WqiafcD"),
|
||||||
|
"company": "EmberSherpa",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"domain": ""
|
||||||
|
}]
|
||||||
|
});
|
|
@ -32,7 +32,8 @@
|
||||||
"waitToAppear",
|
"waitToAppear",
|
||||||
"stubUserNotification",
|
"stubUserNotification",
|
||||||
"is",
|
"is",
|
||||||
"authenticateUser"
|
"authenticateUser",
|
||||||
|
"localStorage"
|
||||||
],
|
],
|
||||||
"node": false,
|
"node": false,
|
||||||
"browser": false,
|
"browser": false,
|
||||||
|
|
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access disabled');
|
||||||
|
|
||||||
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function (assert) {
|
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
|
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access enabled');
|
||||||
|
|
||||||
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function (assert) {
|
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: true });
|
server.create('meta', { allowAnonymousAccess: true });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
@ -28,7 +27,6 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: true }
|
||||||
|
|
||||||
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: true });
|
server.create('meta', { allowAnonymousAccess: true });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
|
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Authentication');
|
||||||
|
|
||||||
test('visiting /auth/login and logging in', function (assert) {
|
test('visiting /auth/login and logging in', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/auth/login');
|
visit('/auth/login');
|
||||||
|
|
||||||
fillIn('#authEmail', 'brizdigital@gmail.com');
|
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||||
|
@ -30,10 +29,8 @@ test('visiting /auth/login and logging in', function (assert) {
|
||||||
|
|
||||||
test('logging out a user', function (assert) {
|
test('logging out a user', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
userLogin();
|
userLogin();
|
||||||
|
click('.dropdown-menu a:contains(Logout)');
|
||||||
visit('/auth/logout');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
|
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
|
||||||
|
@ -42,7 +39,6 @@ test('logging out a user', function (assert) {
|
||||||
|
|
||||||
test('successful sso login authenticates redirects to dashboard', function (assert) {
|
test('successful sso login authenticates redirects to dashboard', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
|
|
||||||
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
||||||
|
|
||||||
|
@ -53,7 +49,6 @@ test('successful sso login authenticates redirects to dashboard', function (asse
|
||||||
|
|
||||||
test('sso login with bad token should redirect to login', function (assert) {
|
test('sso login with bad token should redirect to login', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
|
|
||||||
visit('/auth/sso/randomToken1234567890');
|
visit('/auth/sso/randomToken1234567890');
|
||||||
|
|
||||||
|
|
|
@ -9,39 +9,38 @@
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { test, skip } from 'qunit';
|
import { test } from 'qunit';
|
||||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | Documents space');
|
moduleForAcceptance('Acceptance | Documents space');
|
||||||
|
|
||||||
skip('Adding a new folder space', function (assert) {
|
test('Adding a new folder space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let personalSpaces = find('.section div:contains(PERSONAL)').length;
|
let personalSpaces = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#add-folder-button');
|
click('#add-folder-button');
|
||||||
|
|
||||||
fillIn('#new-folder-name', 'body', 'Test Folder');
|
fillIn('#new-folder-name', 'Test Folder');
|
||||||
|
|
||||||
click('.actions div:contains(Add)', 'body');
|
click('.actions div:contains(Add)');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
let folderCount = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||||
|
assert.equal(folderCount, 2, 'New folder has been added');
|
||||||
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
skip('Adding a document to a space', function (assert) {
|
test('Adding a document to a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -52,20 +51,22 @@ skip('Adding a document to a space', function (assert) {
|
||||||
assert.equal(numberOfDocuments, 2, '2 documents listed');
|
assert.equal(numberOfDocuments, 2, '2 documents listed');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#start-document-button');
|
click('.actions div:contains(Start) .flat-green');
|
||||||
click('.actions div:contains(Add)', 'body');
|
|
||||||
|
andThen(function () {
|
||||||
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/d/V4y7jkw_3QvCDSeS/new-document', 'New document displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('a div:contains(My Project) .space-name');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfDocuments = find('.documents-list li').length;
|
let numberOfDocuments = find('.documents-list li').length;
|
||||||
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('visiting space settings page', function (assert) {
|
test('visiting space settings page', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -80,8 +81,6 @@ test('visiting space settings page', function (assert) {
|
||||||
|
|
||||||
test('changing space name', function (assert) {
|
test('changing space name', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -100,8 +99,6 @@ test('changing space name', function (assert) {
|
||||||
|
|
||||||
test('sharing a space', function (assert) {
|
test('sharing a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -117,11 +114,8 @@ test('sharing a space', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Test will pass after moving to factories
|
|
||||||
test('changing space permissions', function (assert) {
|
test('changing space permissions', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
|
|
||||||
visit('/s/VzMygEw_3WrtFzto/test');
|
visit('/s/VzMygEw_3WrtFzto/test');
|
||||||
|
@ -150,8 +144,6 @@ test('changing space permissions', function (assert) {
|
||||||
|
|
||||||
test('deleting a space', function (assert) {
|
test('deleting a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -165,10 +157,8 @@ test('deleting a space', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
skip('deleting a document', function (assert) {
|
test('deleting a document', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -186,10 +176,7 @@ skip('deleting a document', function (assert) {
|
||||||
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#delete-documents-button');
|
click('.actions div:contains(Delete) .flat-red');
|
||||||
|
|
||||||
waitToAppear('.drop-content');
|
|
||||||
click('.actions div:contains(Delete)', 'body');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfDocuments = find('.documents-list li');
|
let numberOfDocuments = find('.documents-list li');
|
||||||
|
@ -197,6 +184,28 @@ skip('deleting a document', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('clicking a document title displays the document', function (assert) {
|
||||||
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
authenticateUser();
|
||||||
|
visit('/s/VzMygEw_3WrtFzto/test');
|
||||||
|
|
||||||
|
click('a .title:contains(README)');
|
||||||
|
|
||||||
|
andThen(function () {
|
||||||
|
findWithAssert('#add-section-button');
|
||||||
|
findWithAssert('#delete-document-button');
|
||||||
|
findWithAssert('#print-document-button');
|
||||||
|
findWithAssert('#save-template-button');
|
||||||
|
findWithAssert('#attachment-button');
|
||||||
|
findWithAssert('#set-meta-button');
|
||||||
|
findWithAssert('.name.space-name');
|
||||||
|
findWithAssert('.document-sidebar');
|
||||||
|
let title = find('.zone-header .title').text().trim();
|
||||||
|
assert.equal(title, 'README', 'document displayed correctly');
|
||||||
|
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test/d/VzMvJEw_3WqiafcI/readme');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function checkForCommonAsserts() {
|
function checkForCommonAsserts() {
|
||||||
findWithAssert('.sidebar-menu');
|
findWithAssert('.sidebar-menu');
|
||||||
findWithAssert('.options li:contains(General)');
|
findWithAssert('.options li:contains(General)');
|
||||||
|
|
|
@ -15,7 +15,6 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
moduleForAcceptance('Acceptance | user profile');
|
moduleForAcceptance('Acceptance | user profile');
|
||||||
|
|
||||||
test('visiting /profile', function (assert) {
|
test('visiting /profile', function (assert) {
|
||||||
server.createList('folder', 2);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
@ -28,7 +27,6 @@ test('visiting /profile', function (assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('changing user details and email ', function (assert) {
|
test('changing user details and email ', function (assert) {
|
||||||
server.createList('folder', 2);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
|
|
@ -91,9 +91,6 @@ test('add a new user', function (assert) {
|
||||||
fillIn('#newUserEmail', 'test.user@domain.com');
|
fillIn('#newUserEmail', 'test.user@domain.com');
|
||||||
click('.button-blue');
|
click('.button-blue');
|
||||||
|
|
||||||
// waitToAppear('.user-notification:contains(Added)');
|
|
||||||
// waitToDisappear('.user-notification:contains(Added)');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfUsers = find('.user-list tr').length;
|
let numberOfUsers = find('.user-list tr').length;
|
||||||
assert.equal(numberOfUsers, 4, '3 Users listed');
|
assert.equal(numberOfUsers, 4, '3 Users listed');
|
||||||
|
|
|
@ -6,8 +6,15 @@ export default function(name, options = {}) {
|
||||||
module(name, {
|
module(name, {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
this.application = startApp();
|
this.application = startApp();
|
||||||
|
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
|
||||||
stubAudit(this);
|
stubAudit(this);
|
||||||
stubUserNotification(this);
|
stubUserNotification(this);
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('user', 2);
|
||||||
|
server.createList('document', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
|
server.createList('folder-permission', 2);
|
||||||
|
server.createList('organization', 1);
|
||||||
|
|
||||||
if (options.beforeEach) {
|
if (options.beforeEach) {
|
||||||
options.beforeEach.apply(this, arguments);
|
options.beforeEach.apply(this, arguments);
|
||||||
|
|
|
@ -10,16 +10,15 @@
|
||||||
<meta property="dbname" content="{{.DBname}}" />
|
<meta property="dbname" content="{{.DBname}}" />
|
||||||
<meta property="dbhash" content="{{.DBhash}}" />
|
<meta property="dbhash" content="{{.DBhash}}" />
|
||||||
<meta name="author" content="Documize" />
|
<meta name="author" content="Documize" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#ember-testing-container, #ember-testing-container * {
|
#ember-testing {
|
||||||
|
zoom: 100% !important;
|
||||||
|
}
|
||||||
|
#ember-testing-container {
|
||||||
/* Set position static to short-circuit Hubspot Tether's positioning */
|
/* Set position static to short-circuit Hubspot Tether's positioning */
|
||||||
/* https://github.com/HubSpot/tether/pull/98/ */
|
/* https://github.com/HubSpot/tether/pull/98/ */
|
||||||
position: static !important;
|
position: static !important;
|
||||||
}
|
}
|
||||||
.tether-container * {
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{{content-for "head"}}
|
{{content-for "head"}}
|
||||||
|
|
|
@ -126,7 +126,10 @@ func buildRoutes(prefix string) *mux.Router {
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { // add Unsecure Routes
|
func init() {
|
||||||
|
|
||||||
|
// **** add Unsecure Routes
|
||||||
|
|
||||||
log.IfErr(Add(RoutePrefixPublic, "meta", []string{"GET", "OPTIONS"}, nil, GetMeta))
|
log.IfErr(Add(RoutePrefixPublic, "meta", []string{"GET", "OPTIONS"}, nil, GetMeta))
|
||||||
log.IfErr(Add(RoutePrefixPublic, "authenticate", []string{"POST", "OPTIONS"}, nil, Authenticate))
|
log.IfErr(Add(RoutePrefixPublic, "authenticate", []string{"POST", "OPTIONS"}, nil, Authenticate))
|
||||||
log.IfErr(Add(RoutePrefixPublic, "validate", []string{"GET", "OPTIONS"}, nil, ValidateAuthToken))
|
log.IfErr(Add(RoutePrefixPublic, "validate", []string{"GET", "OPTIONS"}, nil, ValidateAuthToken))
|
||||||
|
@ -135,26 +138,9 @@ func init() { // add Unsecure Routes
|
||||||
log.IfErr(Add(RoutePrefixPublic, "share/{folderID}", []string{"POST", "OPTIONS"}, nil, AcceptSharedFolder))
|
log.IfErr(Add(RoutePrefixPublic, "share/{folderID}", []string{"POST", "OPTIONS"}, nil, AcceptSharedFolder))
|
||||||
log.IfErr(Add(RoutePrefixPublic, "attachments/{orgID}/{job}/{fileID}", []string{"GET", "OPTIONS"}, nil, AttachmentDownload))
|
log.IfErr(Add(RoutePrefixPublic, "attachments/{orgID}/{job}/{fileID}", []string{"GET", "OPTIONS"}, nil, AttachmentDownload))
|
||||||
log.IfErr(Add(RoutePrefixPublic, "version", []string{"GET", "OPTIONS"}, nil, version))
|
log.IfErr(Add(RoutePrefixPublic, "version", []string{"GET", "OPTIONS"}, nil, version))
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// **** add secure routes
|
||||||
func buildUnsecureRoutes() *mux.Router {
|
|
||||||
router := mux.NewRouter()
|
|
||||||
|
|
||||||
router.HandleFunc("/api/public/meta", GetMeta).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/authenticate", Authenticate).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/validate", ValidateAuthToken).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/forgot", ForgotUserPassword).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/reset/{token}", ResetUserPassword).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/share/{folderID}", AcceptSharedFolder).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/attachments/{orgID}/{job}/{fileID}", AttachmentDownload).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/public/version", version).Methods("GET", "OPTIONS")
|
|
||||||
|
|
||||||
return router
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func init() { // add secure routes
|
|
||||||
// Import & Convert Document
|
// Import & Convert Document
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "import/folder/{folderID}", []string{"POST", "OPTIONS"}, nil, UploadConvertDocument))
|
log.IfErr(Add(RoutePrefixPrivate, "import/folder/{folderID}", []string{"POST", "OPTIONS"}, nil, UploadConvertDocument))
|
||||||
|
|
||||||
|
@ -183,7 +169,7 @@ func init() { // add secure routes
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/attachments/{attachmentID}", []string{"DELETE", "OPTIONS"}, nil, DeleteAttachment))
|
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/attachments/{attachmentID}", []string{"DELETE", "OPTIONS"}, nil, DeleteAttachment))
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/attachments", []string{"POST", "OPTIONS"}, nil, AddAttachments))
|
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/attachments", []string{"POST", "OPTIONS"}, nil, AddAttachments))
|
||||||
|
|
||||||
// Document Meta
|
// Document Page Meta
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/pages/{pageID}/meta", []string{"GET", "OPTIONS"}, nil, GetDocumentPageMeta))
|
log.IfErr(Add(RoutePrefixPrivate, "documents/{documentID}/pages/{pageID}/meta", []string{"GET", "OPTIONS"}, nil, GetDocumentPageMeta))
|
||||||
|
|
||||||
// Organization
|
// Organization
|
||||||
|
@ -225,110 +211,10 @@ func init() { // add secure routes
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "sections", []string{"GET", "OPTIONS"}, nil, GetSections))
|
log.IfErr(Add(RoutePrefixPrivate, "sections", []string{"GET", "OPTIONS"}, nil, GetSections))
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "sections", []string{"POST", "OPTIONS"}, nil, RunSectionCommand))
|
log.IfErr(Add(RoutePrefixPrivate, "sections", []string{"POST", "OPTIONS"}, nil, RunSectionCommand))
|
||||||
log.IfErr(Add(RoutePrefixPrivate, "sections/refresh", []string{"GET", "OPTIONS"}, nil, RefreshSections))
|
log.IfErr(Add(RoutePrefixPrivate, "sections/refresh", []string{"GET", "OPTIONS"}, nil, RefreshSections))
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// **** configure single page app handler.
|
||||||
func buildSecureRoutes() *mux.Router {
|
|
||||||
router := mux.NewRouter()
|
|
||||||
|
|
||||||
//if web.SiteMode == web.SiteModeSetup {
|
|
||||||
// router.HandleFunc("/api/setup", database.Create).Methods("POST", "OPTIONS")
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Import & Convert Document
|
|
||||||
router.HandleFunc("/api/import/folder/{folderID}", UploadConvertDocument).Methods("POST", "OPTIONS")
|
|
||||||
|
|
||||||
// Document
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/export", GetDocumentAsDocx).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents", GetDocumentsByTag).Methods("GET", "OPTIONS").Queries("filter", "tag")
|
|
||||||
router.HandleFunc("/api/documents", GetDocumentsByFolder).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}", GetDocument).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}", UpdateDocument).Methods("PUT", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}", DeleteDocument).Methods("DELETE", "OPTIONS")
|
|
||||||
|
|
||||||
// Document Meta
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/meta", GetDocumentMeta).Methods("GET", "OPTIONS")
|
|
||||||
|
|
||||||
// Document Page
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/level", ChangeDocumentPageLevel).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/sequence", ChangeDocumentPageSequence).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/batch", GetDocumentPagesBatch).Methods("POST", "OPTIONS")
|
|
||||||
// router.HandleFunc("/api/documents/{documentID}/pages/{pageID}/revisions", GetDocumentPageRevisions).Methods("GET", "OPTIONS")
|
|
||||||
// router.HandleFunc("/api/documents/{documentID}/pages/{pageID}/revisions/{revisionID}", GetDocumentPageDiff).Methods("GET", "OPTIONS")
|
|
||||||
// router.HandleFunc("/api/documents/{documentID}/pages/{pageID}/revisions/{revisionID}", RollbackDocumentPage).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages", GetDocumentPages).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/{pageID}", UpdateDocumentPage).Methods("PUT", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/{pageID}", DeleteDocumentPage).Methods("DELETE", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/{pageID}", DeleteDocumentPages).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/{pageID}", GetDocumentPage).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages", AddDocumentPage).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/attachments", GetAttachments).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/attachments/{attachmentID}", DeleteAttachment).Methods("DELETE", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/attachments", AddAttachments).Methods("POST", "OPTIONS")
|
|
||||||
|
|
||||||
// Document Meta
|
|
||||||
router.HandleFunc("/api/documents/{documentID}/pages/{pageID}/meta", GetDocumentPageMeta).Methods("GET", "OPTIONS")
|
|
||||||
|
|
||||||
// Organization
|
|
||||||
router.HandleFunc("/api/organizations/{orgID}", GetOrganization).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/organizations/{orgID}", UpdateOrganization).Methods("PUT", "OPTIONS")
|
|
||||||
|
|
||||||
// Folder
|
|
||||||
router.HandleFunc("/api/folders/{folderID}/move/{moveToId}", RemoveFolder).Methods("DELETE", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders/{folderID}/permissions", SetFolderPermissions).Methods("PUT", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders/{folderID}/permissions", GetFolderPermissions).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders/{folderID}/invitation", InviteToFolder).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders", GetFolderVisibility).Methods("GET", "OPTIONS").Queries("filter", "viewers")
|
|
||||||
router.HandleFunc("/api/folders", AddFolder).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders", GetFolders).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders/{folderID}", GetFolder).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/folders/{folderID}", UpdateFolder).Methods("PUT", "OPTIONS")
|
|
||||||
|
|
||||||
// Users
|
|
||||||
router.HandleFunc("/api/users/{userID}/password", ChangeUserPassword).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users/{userID}/permissions", GetUserFolderPermissions).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users", AddUser).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users/folder/{folderID}", GetFolderUsers).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users", GetOrganizationUsers).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users/{userID}", GetUser).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users/{userID}", UpdateUser).Methods("PUT", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/users/{userID}", DeleteUser).Methods("DELETE", "OPTIONS")
|
|
||||||
|
|
||||||
// Search
|
|
||||||
router.HandleFunc("/api/search", SearchDocuments).Methods("GET", "OPTIONS")
|
|
||||||
|
|
||||||
// Templates
|
|
||||||
router.HandleFunc("/api/templates", SaveAsTemplate).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/templates", GetSavedTemplates).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/templates/stock", GetStockTemplates).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/templates/{templateID}/folder/{folderID}", StartDocumentFromStockTemplate).Methods("POST", "OPTIONS").Queries("type", "stock")
|
|
||||||
router.HandleFunc("/api/templates/{templateID}/folder/{folderID}", StartDocumentFromSavedTemplate).Methods("POST", "OPTIONS").Queries("type", "saved")
|
|
||||||
|
|
||||||
// Sections
|
|
||||||
router.HandleFunc("/api/sections", GetSections).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/sections", RunSectionCommand).Methods("POST", "OPTIONS")
|
|
||||||
router.HandleFunc("/api/sections/refresh", RefreshSections).Methods("GET", "OPTIONS")
|
|
||||||
|
|
||||||
return router
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func init() { // configures single page app handler.
|
|
||||||
log.IfErr(Add(RoutePrefixRoot, "robots.txt", []string{"GET", "OPTIONS"}, nil, GetRobots))
|
log.IfErr(Add(RoutePrefixRoot, "robots.txt", []string{"GET", "OPTIONS"}, nil, GetRobots))
|
||||||
log.IfErr(Add(RoutePrefixRoot, "sitemap.xml", []string{"GET", "OPTIONS"}, nil, GetSitemap))
|
log.IfErr(Add(RoutePrefixRoot, "sitemap.xml", []string{"GET", "OPTIONS"}, nil, GetSitemap))
|
||||||
log.IfErr(Add(RoutePrefixRoot, "{rest:.*}", nil, nil, web.EmberHandler))
|
log.IfErr(Add(RoutePrefixRoot, "{rest:.*}", nil, nil, web.EmberHandler))
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// AppRouter configures single page app handler.
|
|
||||||
func AppRouter() *mux.Router {
|
|
||||||
|
|
||||||
router := mux.NewRouter()
|
|
||||||
|
|
||||||
router.HandleFunc("/robots.txt", GetRobots).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/sitemap.xml", GetSitemap).Methods("GET", "OPTIONS")
|
|
||||||
router.HandleFunc("/{rest:.*}", web.EmberHandler)
|
|
||||||
|
|
||||||
return router
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import (
|
||||||
const (
|
const (
|
||||||
// AppVersion does what it says
|
// AppVersion does what it says
|
||||||
// Note: versioning scheme is not http://semver.org
|
// Note: versioning scheme is not http://semver.org
|
||||||
AppVersion = "0.15.0"
|
AppVersion = "0.15.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var port, certFile, keyFile, forcePort2SSL string
|
var port, certFile, keyFile, forcePort2SSL string
|
||||||
|
|
23
core/api/util/gorilla.go
Normal file
23
core/api/util/gorilla.go
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Params returns the paramaters to a gorilla mux request.
|
||||||
|
func Params(r *http.Request) map[string]string {
|
||||||
|
return mux.Vars(r)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue