Skip to content

Commit

Permalink
Fixed response handling for missing/no permission profiles. (#24)
Browse files Browse the repository at this point in the history
Co-authored-by: weskubo-cgi <[email protected]>
  • Loading branch information
weskubo-cgi and weskubo-cgi authored Oct 25, 2023
1 parent c4c54e7 commit 8d748a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 86 deletions.
9 changes: 7 additions & 2 deletions backend/src/components/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const { UserProfileMappings, UserProfileOrganizationMappings, UserProfileFacilit
const { MappableObjectForFront } = require('../util/mapping/MappableObject')
const _ = require('lodash')

const USER_NOT_FOUND = 'User not found.'
const NO_PERMISSIONS = 'No permissions.'
const NO_PROFILE_FOUND = 'No profile found.'

async function getUserInfo(req, res) {
const userInfo = getSessionUser(req)
if (!userInfo || !userInfo.jwt || !userInfo._json) {
Expand Down Expand Up @@ -133,8 +137,9 @@ async function getUserProfile(userGuid, userName) {
return response.data
} catch (e) {
if (e.response?.status == '404') {
log.verbose('response ', e.response.data)
if (e.response?.data?.startsWith('User not found')) {
const data = e.response?.data
log.verbose('response ', data)
if (data?.startsWith(USER_NOT_FOUND) || data?.startsWith(NO_PERMISSIONS) || data?.startsWith(NO_PROFILE_FOUND)) {
return null
}
return {}
Expand Down
85 changes: 1 addition & 84 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<v-main class="align-start">
<TheModalIdle v-if="isAuthenticated" class="align-start px-8 mb-0" />
<v-navigation-drawer class="site-menu" :width="200" :model-value="showMenu" :scrim="false">
<v-navigation-drawer class="site-menu" :width="200" :model-value="showMenu" :scrim="false" v-if="isAuthenticated">
<TheMenu />
</v-navigation-drawer>
<router-view class="align-start pt-8 px-8 mb-0" />
Expand Down Expand Up @@ -141,87 +141,4 @@ export default {
width: 100%;
z-index: 1002;
}

#toTopBtn {
opacity: 0.5;
}

#toTopBtn:hover {
opacity: 1;
}
.v-alert.bootstrap-success {
color: #234720 !important;
background-color: #d9e7d8 !important;
border-color: #accbaa !important;
}

.v-alert.bootstrap-info {
color: #4e6478;
background-color: #eaf2fa !important;
border-color: #b8d4ee !important;
}

.v-alert.bootstrap-warning {
color: #81692c;
background-color: #fef4dd !important;
border-color: #fbdb8b !important;
}

.v-alert.bootstrap-error {
color: #712024;
background-color: #f7d8da !important;
border-color: #eeaaad !important;
}

.v-alert .v-icon {
padding-left: 0;
}

.full-height {
height: 100%;
}

.theme--light.application {
background: #f1f1f1;
}

.v-toolbar__title {
font-size: 1rem;
}

.v-btn {
text-transform: none !important;
}

.v-alert .v-icon {
padding-left: 0;
}

.v-alert.bootstrap-success {
color: #234720;
background-color: #d9e7d8 !important;
border-color: #accbaa !important;
}

.v-alert.bootstrap-info {
color: #4e6478;
background-color: #eaf2fa !important;
border-color: #b8d4ee !important;
}

.v-alert.bootstrap-warning {
color: #81692c;
background-color: #fef4dd !important;
border-color: #fbdb8b !important;
}

.v-alert.bootstrap-error {
color: #712024;
background-color: #f7d8da !important;
border-color: #eeaaad !important;
}

.theme--light.v-btn.v-btn--disabled:not(.v-btn--text):not(.v-btn--outlined) {
background-color: rgba(0, 0, 0, 0.12) !important;
}
</style>

0 comments on commit 8d748a2

Please sign in to comment.