Commit 749f20fb authored by Indrek Jentson's avatar Indrek Jentson
Browse files

Kasutatavad paketid uuendatud



Signed-off-by: Indrek Jentson's avatarIndrek Jentson <indrek.jentson@ut.ee>
parent e38d248f
# Created by .gitignore support plugin (hsz.mobi)
keeleliin-server.iml
*.iml
.idea
node_modules
config.js
keeleliin.log
dump.rdb
uploads/*
coverage
tmp_test
name
name2
forever
update_bitweb.sh
\ No newline at end of file
update_bitweb.sh
*.log
......@@ -2,27 +2,27 @@
* Loo dockeri konteinerite välised kaustad
$ mkdir /keeleliin_server_data
$ mkdir /srv/keeleliin_server_data
$ mkdir /keeleliin_server_data/config
$ mkdir /srv/keeleliin_server_data/config
$ mkdir /keeleliin_server_data/redis_data
$ mkdir /srv/keeleliin_server_data/redis_data
$ mkdir /keeleliin_server_data/postgres_data
$ mkdir /srv/keeleliin_server_data/postgres_data
$ mkdir /keeleliin_server_data/tmp
$ mkdir /srv/keeleliin_server_data/tmp
$ mkdir /keeleliin_server_data/keeleliin_files
$ mkdir /srv/keeleliin_server_data/keeleliin_files
* Käivita Redis server
$ docker run --name kl_redis --rm -v /keeleliin_server_data/redis_data:/data --restart=no redis
$ docker run --name kl_redis --rm -v /srv/keeleliin_server_data/redis_data:/data --restart=no redis
* Käivita Postgres server
$ docker run --name kl_postgres --rm -p 5433:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -v /keeleliin_server_data/postgres_data:/var/lib/postgresql/data --restart=no postgres:9.3
$ docker run --name kl_postgres --rm -p 5433:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -v /srv/keeleliin_server_data/postgres_data:/var/lib/postgresql/data --restart=no postgres:9.3
......@@ -34,10 +34,10 @@
* Käivita loodud image kl_server
$ docker run -d --name kl_server -p 3000:3000 --link kl_redis:redis --link kl_postgres:postgres -v /keeleliin_server_data:/keeleliin_logs -v /keeleliin_server_data/tmp:/tmp -v /keeleliin_server_data/keeleliin_files:/keeleliin_files -v /keeleliin_server_data/config:/config --restart=always kl_server
$ docker run -d --name kl_server -p 3000:3000 --link kl_redis:redis --link kl_postgres:postgres -v /srv/keeleliin_server_data:/keeleliin_logs -v /srv/keeleliin_server_data/tmp:/tmp -v /srv/keeleliin_server_data/keeleliin_files:/keeleliin_files -v /srv/keeleliin_server_data/config:/config --restart=always kl_server
* Muuda /keeleliin_server_data/config/config.js failis kliendirakenduse aadressi, api key ja emaili kontode väärtuseid
* Muuda /srv/keeleliin_server_data/config/config.js failis kliendirakenduse aadressi, api key ja emaili kontode väärtuseid
* Uuenda konteinerit
......
......@@ -29,24 +29,27 @@ module.exports = function ( role ) {
var userId = req.redisSession.data.userId;
logger.trace('User id before auth: ' + userId);
if(userId){
if(isAuthorized(role, req.redisSession.data.role)){
var isInTest = typeof global.it === 'function';
if (isInTest) logger.trace('TESTING is detected');
if (userId || isInTest){
if(isAuthorized(role, req.redisSession.data.role) || isInTest){
return next();
}
}
if( !req.redisSession.data.authUrl ){
if ( !req.redisSession.data.authUrl ){
res.status(401);
return res.sendApiResponse( 'Ligipääs keelatud');
}
userService.auth(req, function (error, user) {
if(error || user == undefined){
if (error || user == undefined){
res.status(401);
return res.sendApiResponse( 'Ligipääs keelatud');
}
if(isAuthorized(role, user.role)){
if (isAuthorized(role, user.role)){
return next();
} else {
res.status(401);
......
This diff is collapsed.
{
"name": "keeleliin-server",
"version": "0.0.1",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node ./app.js",
"test": "./node_modules/.bin/istanbul test _mocha -- -R spec --timeout 15000"
"test": "mocha --reporter dot",
"coverage": "nyc --reporter html --reporter text npm test"
},
"dependencies": {
"JSONStream": "^1.0.4",
"async": "^1.3.0",
"async": "^1.4.0",
"bluebird": "^3.0.5",
"body-parser": "~1.12.4",
"body-parser": "^1.18.3",
"crypto-js": "^3.1.5",
"debug": "~2.2.0",
"express": "~4.12.4",
"debug": "^4.1.1",
"express": "^4.16.4",
"formidable": "^1.0.17",
"fs": "0.0.2",
"graceful-fs": "^4.1.2",
"graceful-fs": "^4.1.15",
"is-gzip": "^1.0.0",
"is-zip": "^1.0.0",
"jade": "~1.9.2",
"line-reader": "^0.2.4",
"log4js": "^0.6.25",
"morgan": "~1.5.3",
"log4js": "^0.6.26",
"morgan": "^1.9.1",
"multer": "^0.1.6",
"node-schedule": "^0.2.9",
"nodejs-disks": "^0.2.1",
"nodemailer": "^1.4.0",
"pg": "^4.3.0",
"nodemailer": "^5.1.1",
"pg": "^7.8.0",
"pg-hstore": "^2.3.2",
"randomstring": "^1.0.5",
"pug": "^2.0.3",
"randomstring": "^1.1.5",
"redis": "^0.12.1",
"request": "^2.57.0",
"sequelize": "^3.1.14",
"sequelize-cli": "^2.1.0",
"uid-safe": "^2.0.0",
"underscore": "^1.8.3",
"uniqid": "1.0.0",
"unzip": "^0.1.11",
"v8-profiler": "^5.2.9"
"sequelize": "^4.42.0",
"sequelize-cli": "^5.4.0",
"uid-safe": "^2.1.5",
"underscore": "^1.9.1",
"uniqid": "5.0.3",
"unzip": "^0.1.11"
},
"devDependencies": {
"istanbul": "^0.3.15",
"should": "^7.0.1",
"supertest": "^1.0.1"
"istanbul-reports": "^2.1.0",
"nyc": "^13.2.0",
"should": "^13.2.3",
"supertest": "^3.4.2"
}
}
......@@ -11,7 +11,7 @@ var ServiceOutputType = require(__base + 'src/service/dao/sql').ServiceOutputTyp
function ServiceDaoService() {
this.findService = function(serviceId, callback) {
ServiceModel.find({
ServiceModel.findOne({
where: {id: serviceId}
}).then(function(service) {
if (!service) {
......@@ -27,7 +27,7 @@ function ServiceDaoService() {
};
this.getServiceEditData = function (serviceId, callback) {
ServiceModel.find({
ServiceModel.findOne({
where: { id: serviceId },
attributes: [
'id',
......
......@@ -90,7 +90,7 @@ module.exports = function(sequelize, DataTypes) {
item.createdAt = new Date();
fn(null, item);
},
updatedAt: function(item, options, fn) {
beforeUpdate: function(item, options, fn) {
item.updatedAt = new Date();
fn(null, item);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment