Commit 2c86e70e authored by Janis Streib's avatar Janis Streib 🦉

ADD: handle non-netdoc-user

parent 4bb6b80c
Pipeline #131956 passed with stages
in 5 minutes and 43 seconds
......@@ -56,9 +56,11 @@
<div class="font-italic text-center p-3">
<hr/>
Enter oder Such-Button klicken, um eine neue Suche auszulösen<br>
<code>s/&lt;regex&gt;</code> für RegEx-Suche<br>
<code>&lt;systemname&gt;:&lt;suche&gt;</code> für globale Suche im System (z.B.
<code>dnsvs:s/^kit.edu</code>)
<template v-if="$store.state.token">
<code>s/&lt;regex&gt;</code> für RegEx-Suche<br>
<code>&lt;systemname&gt;:&lt;suche&gt;</code> für globale Suche im System (z.B.
<code>dnsvs:s/^kit.edu</code>)
</template>
</div>
</div>
</b-popover>
......@@ -88,52 +90,59 @@ export default {
search_input: '',
search_has_focus: false,
bTimeout: null,
pages: [
{
name: 'DNSVS',
url: '/dnsvs/bcds'
},
{
name: 'Ihre BCDs',
url: '/dnsvs/bcds'
},
{
name: 'Ihre Domains',
url: '/dnsvs/fqdns'
},
{
name: 'Unterkonten & API-Tokens',
url: '/user/tokens'
},
keyboard_focus: -1
}
},
computed: {
pages() {
const pages = [
{
name: 'API-Browser (Swagger)',
url: '/swagger'
},
{
name: 'MACAuth',
url: '/macauth'
},
{
name: 'Orgranisationseinheiten (OE/OU)',
url: '/cntl/ou'
},
{
name: 'Macfinder',
url: '/tools/macfinder'
},
{
name: 'MAC-Vendor-Suche',
url: '/tools/oui_lookup'
},
{
name: 'Gruppen & Untergruppen',
url: '/cntl/groups'
}
],
keyboard_focus: -1
}
},
computed: {
]
if (this.$store.state.token !== null) {
pages.push(...[
{
name: 'DNSVS',
url: '/dnsvs/bcds'
},
{
name: 'Ihre BCDs',
url: '/dnsvs/bcds'
},
{
name: 'Ihre Domains',
url: '/dnsvs/fqdns'
},
{
name: 'Unterkonten & API-Tokens',
url: '/user/tokens'
},
{
name: 'MACAuth',
url: '/macauth'
},
{
name: 'Orgranisationseinheiten (OE/OU)',
url: '/cntl/ou'
},
{
name: 'Macfinder',
url: '/tools/macfinder'
},
{
name: 'Gruppen & Untergruppen',
url: '/cntl/groups'
}
])
}
return pages
},
suggestions() {
const suggestions = []
const search = this.cutDescriminator().trim()
......@@ -356,7 +365,9 @@ export default {
if (this.search_input === 'do a barrel roll') {
document.body.classList.add('barrel')
if (this.bTimeout) clearTimeout(this.bTimeout)
this.bTimeout = setTimeout(() => { document.body.classList.remove('barrel') }, 1000)
this.bTimeout = setTimeout(() => {
document.body.classList.remove('barrel')
}, 1000)
}
this.last_search = this.search_input
this.search_res = []
......@@ -364,26 +375,28 @@ export default {
const term = this.cutDescriminator().trim()
const termIsIP = ipaddress.isValid(term.split('/')[0])
const termIsNumeric = /^(0|[1-9][0-9]*)$/.test(term)
if (this.descriminator == null) { // Nur is_own, ohne regex
if (termIsNumeric) {
this.dispatch_search(SearchService.searchVlan(this.$store.state.netdb_axios_config, parseInt(term)), 'nd.vlan')
} else if (termIsIP) {
this.dispatch_search(SearchService.searchRRByIP(this.$store.state.netdb_axios_config, term, true), 'dns.record')
this.dispatch_search(SearchService.searchBCDSubnet(this.$store.state.netdb_axios_config, term, true), 'nd.ip_subnet')
} else {
this.dispatch_search(SearchService.searchBCDRegex(this.$store.state.netdb_axios_config, term, true), 'nd.bcd')
this.dispatch_search(SearchService.searchRecordRegex(this.$store.state.netdb_axios_config, term, true), 'dns.record')
}
} else if (this.descriminator === 'dnsvs') {
if (termIsNumeric) {
this.dispatch_search(SearchService.searchVlan(this.$store.state.netdb_axios_config, parseInt(term)), 'nd.vlan')
} else if (termIsIP) {
this.dispatch_search(SearchService.searchRRByIP(this.$store.state.netdb_axios_config, term, null), 'dns.record')
this.dispatch_search(SearchService.searchBCDSubnet(this.$store.state.netdb_axios_config, term, null), 'nd.ip_subnet')
} else {
this.dispatch_search(SearchService.searchBCDRegex(this.$store.state.netdb_axios_config, term, null), 'nd.bcd')
this.dispatch_search(SearchService.searchRecordRegex(this.$store.state.netdb_axios_config, term, null), 'dns.record')
this.dispatch_search(SearchService.searchRRDataRegex(this.$store.state.netdb_axios_config, term, null), 'dns.record')
if (this.$store.state.token) {
if (this.descriminator == null) { // Nur is_own, ohne regex
if (termIsNumeric) {
this.dispatch_search(SearchService.searchVlan(this.$store.state.netdb_axios_config, parseInt(term)), 'nd.vlan')
} else if (termIsIP) {
this.dispatch_search(SearchService.searchRRByIP(this.$store.state.netdb_axios_config, term, true), 'dns.record')
this.dispatch_search(SearchService.searchBCDSubnet(this.$store.state.netdb_axios_config, term, true), 'nd.ip_subnet')
} else {
this.dispatch_search(SearchService.searchBCDRegex(this.$store.state.netdb_axios_config, term, true), 'nd.bcd')
this.dispatch_search(SearchService.searchRecordRegex(this.$store.state.netdb_axios_config, term, true), 'dns.record')
}
} else if (this.descriminator === 'dnsvs') {
if (termIsNumeric) {
this.dispatch_search(SearchService.searchVlan(this.$store.state.netdb_axios_config, parseInt(term)), 'nd.vlan')
} else if (termIsIP) {
this.dispatch_search(SearchService.searchRRByIP(this.$store.state.netdb_axios_config, term, null), 'dns.record')
this.dispatch_search(SearchService.searchBCDSubnet(this.$store.state.netdb_axios_config, term, null), 'nd.ip_subnet')
} else {
this.dispatch_search(SearchService.searchBCDRegex(this.$store.state.netdb_axios_config, term, null), 'nd.bcd')
this.dispatch_search(SearchService.searchRecordRegex(this.$store.state.netdb_axios_config, term, null), 'dns.record')
this.dispatch_search(SearchService.searchRRDataRegex(this.$store.state.netdb_axios_config, term, null), 'dns.record')
}
}
}
this.descriminator = null
......
......@@ -13,17 +13,17 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<b-collapse is-nav id="navbarNavDropdown" ref="navdropdown">
<b-navbar-nav>
<b-nav-item v-if="$sysinfo_js_mods.includes('dnsvs')" to="/dnsvs/"
<b-nav-item v-if="$sysinfo_js_mods.includes('dnsvs') && $store.state.token" to="/dnsvs/"
:active="$route.path.startsWith('/dnsvs/')">DNSVS
</b-nav-item>
<b-nav-item v-if="$sysinfo_js_mods.includes('macauth')" to="/macauth/"
<b-nav-item v-if="$sysinfo_js_mods.includes('macauth') && $store.state.token" to="/macauth/"
:active="$route.path.startsWith('/macauth')">MACAuth
</b-nav-item>
<b-nav-item v-if="$sysinfo_mods_by_name['dhcp_leases']" to="/dhcp-leases/"
<b-nav-item v-if="$sysinfo_mods_by_name['dhcp_leases'] && $store.state.token" to="/dhcp-leases/"
:active="$route.path.startsWith('/dhcp-leases/')">DHCP-Leases
</b-nav-item>
<b-nav-item v-if="$sysinfo_js_mods.includes('usr_netdoc')" to="/usr_netdoc/"
:active="$route.path.startsWith('/usr_netdoc/')">
<b-nav-item v-if="$sysinfo_js_mods.includes('netdoc')" to="/netdoc/"
:active="$route.path.startsWith('/netdoc/')">
NETDOC
</b-nav-item>
<b-nav-item
......@@ -39,19 +39,19 @@
</b-navbar-nav>
<b-navbar-nav class="ml-auto">
<GlobalSearch v-if="$store.state.user"/>
<b-nav-item :active="$store.state.show_sidebar"
<b-nav-item :active="$store.state.show_sidebar" v-if="$store.state.token"
@click.stop="$store.commit('showSidebar', !$store.state.show_sidebar)">
<font-awesome-icon :icon="['fas', 'tasks']"/>
Geplante Aktionen
<b-badge variant="primary">{{ $store.state.ta_list ? $store.state.ta_list.length : 0 }}</b-badge>
</b-nav-item>
<b-nav-item-dropdown v-if="$store.state.user" right
<b-nav-item-dropdown right
:toggle-class="$route.path.startsWith('/tools/')?'active':''">
<template slot="button-content">
<font-awesome-icon icon="tools"/>
Werkzeuge
</template>
<b-dropdown-item to="/tools/macfinder" :active="$route.path === '/tools/macfinder'">
<b-dropdown-item to="/tools/macfinder" v-if="$store.token" :active="$route.path === '/tools/macfinder'">
<font-awesome-icon fixed-width icon="ethernet"/>
Macfinder
</b-dropdown-item>
......@@ -60,7 +60,7 @@
MAC-Vendor-Suche
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item-dropdown v-if="$store.state.user" right
<b-nav-item-dropdown v-if="$store.state.token" right
:toggle-class="$route.path.startsWith('/cntl/')?'active':''">
<template slot="button-content">
<font-awesome-icon :icon="['fas', 'users-cog']"></font-awesome-icon>
......@@ -82,11 +82,11 @@
<span v-if="$store.state.user"> {{ $store.state.user.login_name }}</span>
</template>
<template v-if="$store.state.user">
<b-dropdown-item to="/user/tokens" :active="$route.path === '/user/tokens'">
<b-dropdown-item v-if="$store.state.token" to="/user/tokens" :active="$route.path === '/user/tokens'">
<font-awesome-icon dixed-width :icon="['fas', 'code']"/>
Unterkonten & API-Tokens
</b-dropdown-item>
<b-dropdown-divider/>
<b-dropdown-divider v-if="$store.state.token" />
<b-dropdown-item @click="logout">
<font-awesome-icon fixed-width :icon="['fas', 'sign-out-alt']"/>
Abmelden
......
......@@ -124,10 +124,12 @@ async function init() {
const token = payload.token
state.user = user
state.token = token
state.netdb_axios_config = {
headers: {
Authorization: 'Bearer ' + token.token,
'Content-Type': 'application/json'
if (state.token !== null) {
state.netdb_axios_config = {
headers: {
Authorization: 'Bearer ' + token.token,
'Content-Type': 'application/json'
}
}
}
},
......
......@@ -8,7 +8,14 @@ export default new Router({
base: process.env.BASE_URL,
routes: [
{
path: '/', beforeEnter: (to, from, next) => next('/dnsvs')
path: '/',
name: 'Home',
component: () => import('./views/Home.vue'),
meta: {
resolveName: function () {
return 'Home'
}
}
},
{
path: '/swagger',
......
<template>
<div id="home">
<h1>Willkommen!</h1>
<p>Willkommen im Portal zur Selbstverwaltung der aktuell angebotenen Basisdienste für das
KITnet.</p>
<b-alert show variant="warning" v-if="!$store.state.token"><strong>Hinweis!</strong><br/>Ihr Nutzername ist nicht in der Netzdatenbank eingetragen. Daher stehen Ihnen nur eingeschränkte Funktionen zur Verfügung.</b-alert>
</div>
</template>
<template>
<div class="login">
<p>Willkommen auf der Eingangsseite zur Selbstverwaltung der aktuell angebotenen Basisdienste für das
<p>Willkommen auf der Anmeldeseite zur Selbstverwaltung der aktuell angebotenen Basisdienste für das
KITnet.</p>
<b-jumbotron>
<div class="pull-left">
......
......@@ -21,6 +21,9 @@ export default {
let redir = window.localStorage.getItem('oic_redir_after_login') || '/dnsvs/bcds'
if (redir === '/login' || redir === '/oic_login' || redir === '/') {
redir = '/dnsvs/bcds'
if (!this.$store.state.token) {
redir = '/'
}
}
window.localStorage.removeItem('oic_redir_after_login')
self.$router.push(redir)
......
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