mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Fix login page and remove facebook from login.
Move admin and test password to environment variable for seed.
This commit is contained in:
parent
babc1c5e6c
commit
d7f415b3f7
5 changed files with 12 additions and 16 deletions
|
@ -14,7 +14,9 @@ import jsonpatch from 'fast-json-patch';
|
|||
import Project from './project.model';
|
||||
import config from '../../config/environment';
|
||||
const util = require('util');
|
||||
var ansibleTool = require('../../components/ansible/ansible_tool');
|
||||
const ansibleTool = require('../../components/ansible/ansible_tool');
|
||||
|
||||
const logger = require('../../components/logger/logger');
|
||||
|
||||
function respondWithResult(res, statusCode) {
|
||||
statusCode = statusCode || 200;
|
||||
|
@ -51,7 +53,6 @@ function removeEntity(res) {
|
|||
}
|
||||
|
||||
function handleEntityNotFound(res) {
|
||||
console.log("Entity Not Found");
|
||||
return function(entity) {
|
||||
if(!entity) {
|
||||
res.status(404).end();
|
||||
|
@ -64,23 +65,20 @@ function handleEntityNotFound(res) {
|
|||
function handleError(res, statusCode) {
|
||||
statusCode = statusCode || 500;
|
||||
return function(err) {
|
||||
console.log("ERror " + err);
|
||||
logger.error("Error = " + err);
|
||||
res.status(statusCode).send(err);
|
||||
};
|
||||
}
|
||||
|
||||
// Gets a list of Projects
|
||||
export function index(req, res) {
|
||||
console.log("Getting projects list");
|
||||
|
||||
let filter ={owner_id: req.user._id};
|
||||
|
||||
if(config.userRoles.indexOf(req.user.role) >= config.userRoles.indexOf('admin')){
|
||||
console.log("User is admin");
|
||||
filter = {}
|
||||
}
|
||||
|
||||
console.log("Filter =" + JSON.stringify(filter));
|
||||
logger.info("Get projects filter = %s", JSON.stringify(filter) );
|
||||
|
||||
return Project.find(filter).exec()
|
||||
.then(respondWithResult(res))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue