diff --git a/app.js b/app.js index f8bad1bf..bbceeceb 100644 --- a/app.js +++ b/app.js @@ -42,6 +42,7 @@ const grapejs = require('./routes/grapejs'); const mosaico = require('./routes/mosaico'); const reports = require('./routes/reports'); const reportsTemplates = require('./routes/report-templates'); +const namespaces = require('./routes/namespaces'); const app = express(); @@ -213,6 +214,7 @@ app.use('/api', api); app.use('/editorapi', editorapi); app.use('/grapejs', grapejs); app.use('/mosaico', mosaico); +app.use('/namespaces', namespaces); if (config.reports && config.reports.enabled === true) { app.use('/reports', reports); diff --git a/config/default.toml b/config/default.toml index 64d45fbe..19067c6f 100644 --- a/config/default.toml +++ b/config/default.toml @@ -177,3 +177,18 @@ templates=[["demo", "Demo Template"]] # The bottom line is that if people who are creating report templates or have write access to the DB cannot be trusted, # then it's safer to switch off the reporting functionality below. enabled=false + + +[shares.list.master] +name="Master" +description="All permissions" +permissions=["view"] + + +[shares.namespace.master] +name="Master" +description="All permissions" + +[shares.namespace.master.permissions] +list=["view"] +namespace=["view", "edit", "create", "delete", "create list"] \ No newline at end of file diff --git a/lib/knex.js b/lib/knex.js new file mode 100644 index 00000000..4a542c42 --- /dev/null +++ b/lib/knex.js @@ -0,0 +1,15 @@ +'use strict'; + +const config = require('config'); + +const knex = require('knex')({ + client: 'mysql', + connection: config.mysql, + migrations: { + directory: __dirname + '/../setup/knex/migrations' + } +}); + +knex.migrate.latest(); + +module.exports = knex; diff --git a/lib/models/namespaces.js b/lib/models/namespaces.js new file mode 100644 index 00000000..51a59005 --- /dev/null +++ b/lib/models/namespaces.js @@ -0,0 +1,8 @@ +'use strict'; + +const config = require('config'); +const knex = require('../knex'); + +module.exports.list = () => { + return knex('namespaces'); +}; diff --git a/package.json b/package.json index 7d82f7cd..20d6140a 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "jquery-file-upload-middleware": "^0.1.8", "jsdom": "^9.12.0", "juice": "^4.0.2", + "knex": "^0.13.0", "libmime": "^3.1.0", "marked": "^0.3.6", "memory-cache": "^0.1.6", diff --git a/public/fancytree/jquery.fancytree-all.min.js b/public/fancytree/jquery.fancytree-all.min.js new file mode 100644 index 00000000..14f7192e --- /dev/null +++ b/public/fancytree/jquery.fancytree-all.min.js @@ -0,0 +1,50 @@ +/*! jQuery Fancytree Plugin - 2.22.4 - 2017-05-06T06:26:23Z + * https://github.com/mar10/fancytree + * Copyright (c) 2017 Martin Wendt; Licensed MIT */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + define( [ "jquery" ], factory ); + } else { + factory( jQuery ); + } +}(function( $ ) { + +!function(a,b,c,d){"use strict";function e(b,c){b||(c=c?": "+c:"",a.error("Fancytree assertion failed"+c))}function f(a,c){var d,e,f=b.console?b.console[a]:null;if(f)try{f.apply(b.console,c)}catch(g){for(e="",d=0;dh;return!0}function i(a,b,c,d,e){var f=function(){var c=b[a],f=d[a],g=b.ext[e],h=function(){return c.apply(b,arguments)},i=function(a){return c.apply(b,a)};return function(){var a=b._local,c=b._super,d=b._superApply;try{return b._local=g,b._super=h,b._superApply=i,f.apply(b,arguments)}finally{b._local=a,b._super=c,b._superApply=d}}}();return f}function j(b,c,d,e){for(var f in d)"function"==typeof d[f]?"function"==typeof b[f]?b[f]=i(f,b,c,d,e):"_"===f.charAt(0)?b.ext[e][f]=i(f,b,c,d,e):a.error("Could not override tree."+f+". Use prefix '_' to create tree."+e+"._"+f):"options"!==f&&(b.ext[e][f]=d[f])}function k(b,c){return b===d?a.Deferred(function(){this.resolve()}).promise():a.Deferred(function(){this.resolveWith(b,c)}).promise()}function l(b,c){return b===d?a.Deferred(function(){this.reject()}).promise():a.Deferred(function(){this.rejectWith(b,c)}).promise()}function m(a,b){return function(){a.resolveWith(b)}}function n(b){var c=a.extend({},b.data()),d=c.json;return delete c.fancytree,delete c.uiFancytree,d&&(delete c.json,c=a.extend(c,d)),c}function o(a){return(""+a).replace(y,function(a){return B[a]})}function p(a){return(""+a).replace(z,function(a){return B[a]})}function q(a){return a=a.toLowerCase(),function(b){return b.title.toLowerCase().indexOf(a)>=0}}function r(a){var b=new RegExp("^"+a,"i");return function(a){return b.test(a.title)}}function s(b,c){var d,f,g,h;for(this.parent=b,this.tree=b.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},d=0,f=H.length;dul.fancytree-container").remove();var c,e={tree:this};this.rootNode=new s(e,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,c=a("