Skip to content

Commit

Permalink
Merge pull request #317 from joola/feature/#316
Browse files Browse the repository at this point in the history
#316 added new welcome page.
  • Loading branch information
itayw committed Mar 30, 2014
2 parents 8ad263d + 597d14e commit dd9c1f6
Show file tree
Hide file tree
Showing 47 changed files with 30,202 additions and 1,248 deletions.
6 changes: 3 additions & 3 deletions lib/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ auth.validateToken = function (req, token, APIToken, callback) {
var bypassUser = {
username: 'bypass',
_roles: ['root', 'user'],
workspace: 'joola'
workspace: 'root'
};
joola.logger.trace({category: 'security', req: req}, 'Applying bypass token for request [1].');
return auth.generateToken(bypassUser, callback);
Expand Down Expand Up @@ -621,10 +621,10 @@ auth.getUserByToken = function (token, callback) {
if (token == joola.config.authentication.bypassToken) {
var bypassUser = {
username: 'bypass',
workspace: 'joola',
workspace: 'root',
_roles: ['root', 'user']
};
joola.logger.trace({category: 'security', req: req}, 'Applying bypass token for request [2].');
joola.logger.trace({category: 'security'}, 'Applying bypass token for request [2].');
return callback(null, bypassUser);
}

Expand Down
3 changes: 2 additions & 1 deletion lib/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ common.uuid = function () {
};

common.stringify = function (obj, callback) {
return callback(null, stringify(obj));
callback = callback || emptyfunc;
return callback(null, stringify.stringify(obj));
/*
var errored = false;
if (!obj)
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatch/beacon.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ etl.verify = function (context, workspace, collection, documents, callback) {
return callback(err);

var match = equal(meta, _meta);

if (!match) {
meta.id = collection;
meta.name = collection;


joola.dispatch.collections.update(context, workspace, meta, function (err) {
joola.logger.debug('Updating collection [' + collection + '] due to meta change.');
return callback(null);
Expand Down
9 changes: 5 additions & 4 deletions lib/dispatch/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>. Some rights reserved. See LICENSE, AUTHORS
**/
var
ce = require('cloneextend'),
router = require('../webserver/routes/index'),
Proto = require('./prototypes/collection');

Expand Down Expand Up @@ -449,7 +450,7 @@ exports.mindate = {
key = null;
}
callback = callback || emptyfunc;

exports.get.run(context, workspace, id, function (err, value) {
if (err)
return callback(err);
Expand Down Expand Up @@ -492,7 +493,7 @@ exports.metadata = {
exports.get.run(context, workspace, collection, function (err, _collection) {
if (err)
return callback(err);

//clean nulls for proper deepEqual
var walkNulls = function (obj) {
Object.keys(obj).forEach(function (key) {
Expand All @@ -513,7 +514,7 @@ exports.metadata = {
delete _collection.name;

walkNulls(_collection);
return callback(null, _collection);
return callback(null, ce.clone(_collection));
});
}
else {
Expand Down Expand Up @@ -572,7 +573,7 @@ exports.metadata = {
};

walkObject(_shadow, document);
return callback(null, _shadow);
return callback(null, ce.clone(_shadow));
}
}
};
4 changes: 0 additions & 4 deletions lib/dispatch/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ exports.get = {
},
run: function (context, key, callback) {
callback = callback || emptyfunc;
if (key == '*') {
return callback(null, {});
}

joola.config.get(key, function (err, value) {
/* istanbul ignore if */
if (err)
Expand Down
18 changes: 17 additions & 1 deletion lib/dispatch/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,20 @@ exports.verifyAPIToken = {
return callback(new Error('API Token not found'));
});
}
};
};

exports.generateToken = {
name: "/api/users/generateToken",
description: "I generate tokens for users",
inputs: ['workspace', 'user'],
_outputExample: {},
_permission: ['access_system'],
_dispatch: {
message: 'users:generateToken'
},
run: function (context, workspace, user, callback) {
callback = callback || emptyfunc;

joola.auth.generateToken(user, callback);
}
};
4 changes: 2 additions & 2 deletions lib/webserver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ webserver.start = function (options, callback) {
secureOnly: false,
keyFile: path.join(__dirname, '../../config/certs/localhost.key'),
certFile: path.join(__dirname, '../../config/certs/localhost.csr'),
viewsPath: __dirname + '/views',
viewsPath: __dirname + '/views'
//sessionSecret: '491b8a10-573d-11e3-949a-0800200c9a66',
//sessionTimeout: new Date(Date.now() + 3600000)
};
self.options = joola.common._extend(self.options, options);

app.set('views', self.options.viewsPath);
app.set('view engine', 'jade');
app.use(express.favicon(__dirname + '/public/shared/ico/favicon.ico'));
app.use(express.favicon(__dirname + '/public/ico/favicon.ico'));
app.use(express.compress());
app.use(express.json());
app.use(express.urlencoded());
Expand Down
121 changes: 121 additions & 0 deletions lib/webserver/public/css/pretty.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/* Pretty printing styles. Used with prettify.js.
*
* This version is slight modified based on the original version.
*
* Name: Stanley Ng
* Email: stanleyhlng@googlegroups.com
*
* Reference:
* http://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.css
*/
.pln {
color: #48484C;
}

.str {
color: #DD1144;
}

.kwd {
color: #1E347B;
}

.com {
color: #93A1A1;
}

.typ {
color: teal;
}

.lit {
color: #195F91;
}

.pun {
color: #93A1A1;
}

.opn {
color: #93A1A1;
}

.clo {
color: #93A1A1;
}

.tag {
color: #008;
}

.atn {
color: teal;
}

.atv {
color: #DD1144;
}

.dec {
color: teal;
}

.var {
color: teal;
}

.fun {
color: #DC322F;
}

/* Put a border around prettyprinted code snippets. */
pre.prettyprint {
background-color: #F7F7F9;
padding: 10px;
border: 1px solid #E1E1E8;
}

pre.prettyprint.linenums {
box-shadow: 40px 0 0 #FBFBFC inset, 41px 0 0 #ECECF0 inset;
}

/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
color: #1E347B;
margin: 0 0 0 40px;
}

ol.linenums li {
color: #BEBEC5;
line-height: 18px;
padding-left: 12px;
text-shadow: 0 1px 0 #FFFFFF;
}

li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {
list-style-type: normal;
}

/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
background: #eee;
}

pre {
padding: 9px 14px;
margin-bottom: 14px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 4px;
}
Loading

0 comments on commit dd9c1f6

Please sign in to comment.