Carrucan

removed unnesesary coi from all controller endpoints

......@@ -31,6 +31,7 @@ node_modules
db/migration/knexfile.js
client/build
build
.DS_Store
......
module.exports = {
coi: {
client: 'mysql',
connection: {
database: 'coi',
user: 'root',
password: 'root'
}
},
pool: {
min: 2,
max: 20
}
};
......@@ -60,6 +60,7 @@
"multer": "1.2.0",
"mysql": "2.11.1",
"numeral": "1.5.3",
"passport-saml": "^0.15.0",
"pug": "2.0.0-beta6",
"react": "15.3.2",
"react-addons-update": "15.3.2",
......
......@@ -121,47 +121,47 @@ export function run() {
conditionallyLogRequests(app, logLevel);
app.use('/coi/new', express.static('newclient'));
app.use('/coi/new', express.static('client'));
app.use('/coi', express.static('client'));
app.use('/coi/build', (req, res) => { res.sendStatus(NOT_FOUND); }); // Static files that weren't found
app.use('/new', express.static('newclient'));
app.use('/new', express.static('client'));
app.use('/', express.static('client'));
app.use('/build', (req, res) => { res.sendStatus(NOT_FOUND); }); // Static files that weren't found
app.use('/api', noCache);
app.use(methodChecker);
app.use(cookieParser());
app.use('/coi/auth', renderView('auth'));
app.use('/auth', renderView('auth'));
app.use('/api/v1/coi/health', healthReport);
app.use('/coi/health', healthReport);
app.use('/health', healthReport);
app.use('/api', apiAuthentication);
app.use('/coi/new', authentication);
app.use('/coi/new$', renderView('new/index'));
app.use('/coi/new/$', renderView('new/index'));
app.use('/coi/new/readonly', renderView('new/index'));
app.use('/coi/new/archiveview', renderView('new/index'));
app.use('/coi/new/dashboard', renderView('new/index'));
app.use('/coi/new/disclosure', renderView('new/index'));
app.use('/coi/new/travelLog', renderView('new/index'));
app.use('/coi/new/revise', renderView('new/index'));
app.use('/coi/new/about', renderView('new/about'));
app.use('/coi/new/admin', adminCheck, renderView('new/admin/admin'));
app.use('/coi/new/config', configCheck, renderView('new/admin/config'));
app.use('/coi', authentication);
app.use('/coi$', renderView('index'));
app.use('/coi/$', renderView('index'));
app.use('/coi/readonly', renderView('index'));
app.use('/coi/archiveview', renderView('index'));
app.use('/coi/dashboard', renderView('index'));
app.use('/coi/disclosure', renderView('index'));
app.use('/coi/travelLog', renderView('index'));
app.use('/coi/revise', renderView('index'));
app.use('/coi/about', renderView('about'));
app.use('/coi/admin', adminCheck, renderView('admin/admin'));
app.use('/coi/config', configCheck, renderView('admin/config'));
app.use('/coi/features', configCheck, renderView('admin/features'));
app.use('/coi/notifications', configCheck, renderView('admin/notifications'));
app.use('/coi', unauthorized);
app.use('/new', authentication);
app.use('/new$', renderView('new/index'));
app.use('/new/$', renderView('new/index'));
app.use('/new/readonly', renderView('new/index'));
app.use('/new/archiveview', renderView('new/index'));
app.use('/new/dashboard', renderView('new/index'));
app.use('/new/disclosure', renderView('new/index'));
app.use('/new/travelLog', renderView('new/index'));
app.use('/new/revise', renderView('new/index'));
app.use('/new/about', renderView('new/about'));
app.use('/new/admin', adminCheck, renderView('new/admin/admin'));
app.use('/new/config', configCheck, renderView('new/admin/config'));
app.use('/', authentication);
app.use('/$', renderView('index'));
app.use('/$', renderView('index'));
app.use('/readonly', renderView('index'));
app.use('/archiveview', renderView('index'));
app.use('/dashboard', renderView('index'));
app.use('/disclosure', renderView('index'));
app.use('/travelLog', renderView('index'));
app.use('/revise', renderView('index'));
app.use('/about', renderView('about'));
app.use('/admin', adminCheck, renderView('admin/admin'));
app.use('/config', configCheck, renderView('admin/config'));
app.use('/features', configCheck, renderView('admin/features'));
app.use('/notifications', configCheck, renderView('admin/notifications'));
app.use('/', unauthorized);
app.use(bodyParser.json());
app.use(impersonationLogger);
......
......@@ -27,7 +27,7 @@ if (process.env.DB_PACKAGE === 'mysql') {
connectionOptions = {
host: process.env.DB_HOST || 'localhost',
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || '',
password: process.env.DB_PASSWORD || 'root',
database: process.env.DB_NAME || 'coi',
charset: 'utf8'
};
......@@ -36,7 +36,7 @@ else {
connectionOptions = {
host: process.env.DB_HOST || 'localhost',
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || '',
password: process.env.DB_PASSWORD || 'root',
database: process.env.DB_NAME || 'coi'
};
if (process.env.DB_PORT) {
......
......@@ -106,7 +106,7 @@ export async function getUserInfosByQuery(dbInfo, hostname, authToken, queryValu
export function getAuthLink(req) {
const returnToValue = encodeURIComponent(req.originalUrl);
return `/coi/auth?return_to=${returnToValue}`;
return `/auth?return_to=${returnToValue}`;
}
export function getAdmins(dbInfo, authToken) {//eslint-disable-line no-unused-vars
......
/*
The Conflict of Interest (COI) module of Kuali Research
Copyright © 2005-2016 Kuali, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
import {ROLES} from '../../../coi-constants';
import hashCode from '../../../hash';
var SamlStrategy = require('passport-saml').Strategy;
export function authView(req, res) {
res.sendFile('auth.html', {
root: 'views'
});
}
export function getUserInfo(dbInfo, hostname, token) {
return new Promise((resolve, reject) => { // eslint-disable-line no-unused-vars
if (!token) {
resolve();
}
let lowercaseToken = token.toLowerCase();
let impersonator;
if (lowercaseToken.startsWith('impersonating_')) {
const split = token.split('_');
impersonator = 'impersonator';
token = split[1]; // eslint-disable-line no-param-reassign
lowercaseToken = token.toLowerCase();
}
if (lowercaseToken.startsWith('a')) {
resolve({
id: hashCode(token),
name: `Admin ${token}`,
displayName: `Admin ${token}`,
username: token,
email: `${token}@email.com`,
createdAt: 1259218800,
updatedAt: 1259218800,
role: 'admin',
firstName: 'Admin',
lastName: token,
phone: '801-322-3323',
schoolId: hashCode(token),
coiRole: ROLES.ADMIN,
impersonatedBy: impersonator,
mock: true
});
}
else if (lowercaseToken.startsWith('reviewer')) {
resolve({
id: hashCode(token),
name: `Reviewer ${token}`,
displayName: `Reviewer ${token}`,
username: token,
email: `${token}@email.com`,
createdAt: 1259218800,
updatedAt: 1259218800,
role: 'admin',
firstName: 'Reviewer',
lastName: token,
phone: '801-322-3323',
schoolId: hashCode(token),
coiRole: ROLES.REVIEWER,
impersonatedBy: impersonator,
mock: true
});
} else {
resolve({
id: hashCode(token),
name: `User ${token}`,
displayName: `User ${token}`,
username: token,
email: `${token}@email.com`,
createdAt: 1259218800,
updatedAt: 1259218800,
role: 'user',
firstName: 'User',
lastName: token,
phone: '801-322-3323',
schoolId: hashCode(token),
coiRole: ROLES.USER,
impersonatedBy: impersonator,
mock: true
});
}
});
}
export async function getUserInfosByQuery(dbInfo, hostname, authToken, queryValue) {
const result = await getUserInfo(dbInfo, hostname, queryValue);
return [result];
}
export function getAuthLink(req) {
const returnToValue = encodeURIComponent(req.originalUrl);
return `/auth?return_to=${returnToValue}`;
}
export function getAdmins(dbInfo, authToken) {//eslint-disable-line no-unused-vars
return Promise.resolve([
{
userId: hashCode('admin1'),
displayName: 'Admin 1',
email: 'admin1@email.com'
},
{
userId: hashCode('admin2'),
displayName: 'Admin 2',
email: 'admin2@email.com'
}
]);
}
export function getReviewers(dbInfo, authToken) { //eslint-disable-line no-unused-vars
return Promise.resolve([
{
userId: hashCode('reviewer1'),
value: 'reviewer1',
email: 'reviewer1@email.com'
},
{
userId: hashCode('reviewer2'),
value: 'reviewer2',
email: 'reviewer2@email.com'
}
]);
}