Commit 6231fd60 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

Merge branch 'bugfix/auth-on-reload' into develop

parents 0401d281 3af06e50
......@@ -54,7 +54,8 @@ export default {
}
}
},
mounted () {
created () {
console.log("auth::init");
this.$store.dispatch('auth/oidcInit')
},
methods: {
......
......@@ -94,20 +94,25 @@ export default {
// Right after this component is set up, we want to fetch all available shows
// and the arrays for the show meta info from the AuRa steering module.
created () {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug})
this.$refs.showSelector.updateInputSelector()
this.$store.watch(
(state) => state.auth.user.steeringUser,
() => {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug})
this.$refs.showSelector.updateInputSelector()
}
})
this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'fundingcategories', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'categories'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'topics'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'musicfocus'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'languages'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'hosts'})
if (this.isSuperuser) { this.$store.dispatch('auth/fetchUsers') }
}
})
this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'fundingcategories', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'categories'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'topics'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'musicfocus'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'languages'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'hosts'})
if (this.isSuperuser) { this.$store.dispatch('auth/fetchUsers') }
);
},
methods: {
......
......@@ -98,7 +98,10 @@ export default {
},
computed: {
isSuperuser () { return this.$store.state.auth.user.steeringUser.is_superuser },
isSuperuser () {
const user = this.$store.state.auth.user.steeringUser;
return user && user.is_superuser;
},
loaded () {
return {
shows: this.$store.state.shows.loaded.shows,
......
......@@ -186,7 +186,6 @@ const actions = {
this.$log.debug(err)
alert('Error: could not fetch OIDC user object. See console for details.')
})
},
signinRedirect () {
......
......@@ -157,10 +157,11 @@ const mutations = {
const actions = {
fetchShows (ctx, data) {
const user = ctx.rootState.auth.user.steeringUser;
ctx.commit('loading', 'shows')
let uri = process.env.VUE_APP_API_STEERING + 'shows'
// normal users should only see their own shows, only superusers see all shows
if (!ctx.rootState.auth.user.steeringUser.is_superuser) {
if (user && !user.is_superuser) {
uri += '?owner=' + ctx.rootState.auth.user.steeringUser.id
}
axios.get(uri, {
......
Markdown is supported
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