Setup Circle CI, add brakeman config (#13)
* Add circle ci config * Change config to fix tests * Update config * Fix eslint command, add brakeman
This commit is contained in:
@@ -17,7 +17,7 @@ export default {
|
||||
name: 'inbox_dashboard',
|
||||
roles: ['administrator', 'agent'],
|
||||
component: ConversationView,
|
||||
props: (route) => {
|
||||
props: route => {
|
||||
return { inboxId: route.params.inbox_id };
|
||||
},
|
||||
},
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
name: 'inbox_conversation',
|
||||
roles: ['administrator', 'agent'],
|
||||
component: ConversationView,
|
||||
props: (route) => {
|
||||
props: route => {
|
||||
return { conversationId: route.params.conversation_id };
|
||||
},
|
||||
},
|
||||
|
||||
@@ -7,10 +7,7 @@ export default {
|
||||
{
|
||||
path: '/u/',
|
||||
component: AppContainer,
|
||||
children: [
|
||||
...conversation.routes,
|
||||
...settings.routes,
|
||||
],
|
||||
children: [...conversation.routes, ...settings.routes],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -16,9 +16,7 @@ export default {
|
||||
headerTitle: 'INBOX_MGMT.HEADER',
|
||||
headerButtonText: 'SETTINGS.INBOXES.NEW_INBOX',
|
||||
icon: 'ion-archive',
|
||||
newButtonRoutes: [
|
||||
'settings_inbox_list',
|
||||
],
|
||||
newButtonRoutes: ['settings_inbox_list'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
@@ -53,7 +51,7 @@ export default {
|
||||
name: 'settings_inboxes_page_channel',
|
||||
component: channelFactory.create(),
|
||||
roles: ['administrator'],
|
||||
props: (route) => {
|
||||
props: route => {
|
||||
return { channel_name: route.params.sub_page };
|
||||
},
|
||||
},
|
||||
|
||||
@@ -23,13 +23,13 @@ window.roleWiseRoutes = {
|
||||
};
|
||||
|
||||
// generateRoleWiseRoute - updates window object with agent/admin route
|
||||
const generateRoleWiseRoute = (route) => {
|
||||
route.forEach((element) => {
|
||||
const generateRoleWiseRoute = route => {
|
||||
route.forEach(element => {
|
||||
if (element.children) {
|
||||
generateRoleWiseRoute(element.children);
|
||||
}
|
||||
if (element.roles) {
|
||||
element.roles.forEach((roleEl) => {
|
||||
element.roles.forEach(roleEl => {
|
||||
window.roleWiseRoutes[roleEl].push(element.name);
|
||||
});
|
||||
}
|
||||
@@ -45,11 +45,7 @@ const router = new VueRouter({
|
||||
routes, // short for routes: routes
|
||||
});
|
||||
|
||||
const unProtectedRoutes = [
|
||||
'login',
|
||||
'auth_signup',
|
||||
'auth_reset_password',
|
||||
];
|
||||
const unProtectedRoutes = ['login', 'auth_signup', 'auth_reset_password'];
|
||||
|
||||
const authIgnoreRoutes = [
|
||||
'auth_confirmation',
|
||||
@@ -57,7 +53,6 @@ const authIgnoreRoutes = [
|
||||
'auth_password_edit',
|
||||
];
|
||||
|
||||
|
||||
const redirectUser = (to, from, next) => {
|
||||
// If auth ignore go to page
|
||||
if (authIgnoreRoutes.indexOf(to.name) > -1) {
|
||||
@@ -68,7 +63,8 @@ const redirectUser = (to, from, next) => {
|
||||
const currentUser = auth.getCurrentUser();
|
||||
if (isLoggedIn) {
|
||||
// Check if next route is accessible by given role
|
||||
const isAccessible = window.roleWiseRoutes[currentUser.role].indexOf(to.name) > -1;
|
||||
const isAccessible =
|
||||
window.roleWiseRoutes[currentUser.role].indexOf(to.name) > -1;
|
||||
if (!isAccessible) {
|
||||
return next('/u/dashboard');
|
||||
}
|
||||
@@ -76,7 +72,8 @@ const redirectUser = (to, from, next) => {
|
||||
// If unprotected and loggedIn -> redirect
|
||||
if (unProtectedRoutes.indexOf(to.name) !== -1 && isLoggedIn) {
|
||||
return next('/u/dashboard');
|
||||
} else if (unProtectedRoutes.indexOf(to.name) === -1 && !isLoggedIn) {
|
||||
}
|
||||
if (unProtectedRoutes.indexOf(to.name) === -1 && !isLoggedIn) {
|
||||
return next('/u/login');
|
||||
}
|
||||
return next();
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import Login from './Login';
|
||||
|
||||
export default {
|
||||
routes: [{
|
||||
path: '/u/login', name: 'login', component: Login,
|
||||
}],
|
||||
routes: [
|
||||
{
|
||||
path: '/u/login',
|
||||
name: 'login',
|
||||
component: Login,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user