fix(server): fixes stream get service when no role is present
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
<template>
|
||||
<span>
|
||||
<v-btn v-tooltip="'Copy to clipboard'" icon small @click="copy">
|
||||
<v-icon small>mdi-content-copy</v-icon>
|
||||
</v-btn>
|
||||
<input id="text-to-copy" type="hidden" :value="text" />
|
||||
<v-snackbar v-model="snackbar" :timeout="2000" :color="color" text>
|
||||
<div class="text-center">
|
||||
<span class="streamid">{{ text }}</span>
|
||||
{{ message }}
|
||||
</div>
|
||||
</v-snackbar>
|
||||
</span>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ["text"],
|
||||
data: () => ({
|
||||
snackbar: false,
|
||||
message: "StreamId copied successfully",
|
||||
color: "success"
|
||||
}),
|
||||
methods: {
|
||||
copy() {
|
||||
this.snackbar = true
|
||||
let textToCopy = document.querySelector("#text-to-copy")
|
||||
textToCopy.setAttribute("type", "text")
|
||||
textToCopy.select()
|
||||
|
||||
try {
|
||||
let result = document.execCommand("copy")
|
||||
this.message = ` copied ${result ? "" : "un"}successfully!`
|
||||
this.color = result ? "success" : "error"
|
||||
} catch (err) {
|
||||
this.message = "Oops, unable to copy!"
|
||||
this.color = "error"
|
||||
}
|
||||
|
||||
/* unselect the range */
|
||||
textToCopy.setAttribute("type", "hidden")
|
||||
window.getSelection().removeAllRanges()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,169 +0,0 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col xs="12">
|
||||
<v-form v-if="!success" ref="form" v-model="valid">
|
||||
<p class="text-grey">
|
||||
Since
|
||||
<b>you</b>
|
||||
have deployed this server,
|
||||
<b>you</b>
|
||||
need to register first. This will grant you admin rights (which will allow you to manage
|
||||
it properly, later on).
|
||||
</p>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<p class="text-grey">Have any questions? Let us know!</p>
|
||||
<v-text-field
|
||||
v-model="firstName"
|
||||
label="First Name"
|
||||
required
|
||||
:rules="nameRules"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="lastName"
|
||||
label="Last Name"
|
||||
required
|
||||
:rules="nameRules"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="email"
|
||||
label="Email"
|
||||
required
|
||||
type="email"
|
||||
:rules="emailRules"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="password"
|
||||
label="Password"
|
||||
required
|
||||
type="password"
|
||||
:rules="passwordRules"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
||||
@keydown="debouncedPwdTest"
|
||||
@click:append="showPassword = !showPassword"
|
||||
></v-text-field>
|
||||
<!-- <v-text-field label='Confirm Password' v-model="confirmPassword" required type='password' :rules="passwordRules"></v-text-field> -->
|
||||
<v-progress-linear
|
||||
v-if="passwordStrength !== 10 && passwordStrength <= 100"
|
||||
v-model="passwordStrength"
|
||||
class="mt-1 mb-0"
|
||||
:color="`${
|
||||
passwordStrength >= 75 ? 'green' : passwordStrength >= 50 ? 'orange' : 'red'
|
||||
}`"
|
||||
></v-progress-linear>
|
||||
<p class="caption">{{ pwdSuggestions }}</p>
|
||||
<v-btn block tile large color="primary" :loading="loading" @click="submit">Submit</v-btn>
|
||||
</v-form>
|
||||
<v-container v-else>
|
||||
<v-alert prominent type="success" text>
|
||||
<v-row align="center">
|
||||
<v-col class="grow">Great! You're all set.</v-col>
|
||||
<v-col class="shrink">
|
||||
<v-btn @click="$emit('completed')">Next</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-alert>
|
||||
</v-container>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-snackbar v-model="registrationError" multi-line>
|
||||
{{ errorMessage }}
|
||||
<v-btn color="red" text @click="registrationError = false">Close</v-btn>
|
||||
</v-snackbar>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import { onLogin } from '../vue-apollo'
|
||||
import debounce from 'lodash.debounce'
|
||||
|
||||
export default {
|
||||
apollo: {
|
||||
serverInfo: gql`
|
||||
query {
|
||||
serverInfo {
|
||||
name
|
||||
company
|
||||
roles {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
_: gql`
|
||||
query {
|
||||
_
|
||||
}
|
||||
`
|
||||
},
|
||||
methods: {
|
||||
debouncedPwdTest: debounce(async function () {
|
||||
let result = await this.$apollo.query({
|
||||
query: gql` query{ userPwdStrength(pwd:"${this.password}")}`
|
||||
})
|
||||
this.passwordStrength = result.data.userPwdStrength.score * 25
|
||||
// console.log( result.data.userPwdStrength )
|
||||
this.pwdSuggestions = result.data.userPwdStrength.feedback.suggestions[0]
|
||||
}, 1000),
|
||||
async submit() {
|
||||
let test = this.$refs.form.validate()
|
||||
if (!test) return
|
||||
|
||||
this.loading = true
|
||||
try {
|
||||
let result = await this.$apollo.mutate({
|
||||
mutation: gql`
|
||||
mutation($user: UserCreateInput!) {
|
||||
userCreateAdmin(user: $user)
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
user: {
|
||||
name: `${this.firstName} ${this.lastName}`,
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}
|
||||
}
|
||||
})
|
||||
this.loading = false
|
||||
onLogin(this.$apolloProvider.clients.defaultClient, `${result.data.userCreateAdmin}`)
|
||||
this.success = true
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
this.registrationError = true
|
||||
this.errorMessage = err.message
|
||||
}
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
success: false,
|
||||
registrationError: false,
|
||||
errorMessage: '',
|
||||
loading: false,
|
||||
serverInfo: null,
|
||||
_: null,
|
||||
valid: true,
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
passwordRules: [
|
||||
(v) => !!v || 'Password is required',
|
||||
(v) => (v && v.length >= 8) || 'Password must be at least 8 characters'
|
||||
],
|
||||
passwordStrength: 10,
|
||||
pwdSuggestions: '',
|
||||
showPassword: false,
|
||||
nameRules: [
|
||||
(v) => !!v || 'Name is required',
|
||||
(v) => (v && v.length <= 10) || 'Name must be less than 10 characters'
|
||||
],
|
||||
email: '',
|
||||
emailRules: [
|
||||
(v) => !!v || 'E-mail is required',
|
||||
(v) => /.+@.+\..+/.test(v) || 'E-mail must be valid'
|
||||
]
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -1,76 +0,0 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row align='center' justify='center'>
|
||||
<v-col xs='12'>
|
||||
<v-form ref="form" v-model="valid">
|
||||
<p class="mb-4">It's important to set these variables up, where relevant - the defaults are not that great.</p>
|
||||
<v-text-field label='server name' v-model='serverName' persistent-hint hint='A descriptive and memorable server name'></v-text-field>
|
||||
<v-text-field label='your company' v-model='company' persistent-hint hint='The company/team/project this server belongs to.'></v-text-field>
|
||||
<v-text-field label='contact details' v-model='contact' persistent-hint hint='Provide an email address or link that users can reach out to for help.'></v-text-field>
|
||||
<v-text-field label='terms of service' v-model='tos' persistent-hint hint='A link to your terms of service (optional)'></v-text-field>
|
||||
<!-- TODO: Implement optional email subscription for a "server admins" list -->
|
||||
<!-- <p class='xxx-caption mt-4'>As you have deployed this server, we would like to stay in touch with you for updates and notifications regarding any vulnerability patching. Let us know below if you want to participate.</p>
|
||||
<v-checkbox v-model="subscribe" label="Subscribe to updates"></v-checkbox> -->
|
||||
<v-btn block block color='primary' class='' :loading='loading' @click="submit">Submit</v-btn>
|
||||
</v-form>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-snackbar v-model="setupError" multi-line>
|
||||
{{ errorMessage }}
|
||||
<v-btn color="red" text @click="setupError = false">
|
||||
Close
|
||||
</v-btn>
|
||||
</v-snackbar>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import { onLogin } from '../vue-apollo'
|
||||
export default {
|
||||
apollo: {
|
||||
serverInfo: gql ` query { serverInfo { name company description adminContact canonicalUrl termsOfService } }`
|
||||
},
|
||||
methods: {
|
||||
async submit( ) {
|
||||
this.loading = true
|
||||
try {
|
||||
let result = await this.$apollo.mutate( {
|
||||
mutation: gql `
|
||||
mutation ( $info: ServerInfoUpdateInput! ) { serverInfoUpdate( info: $info ) }
|
||||
`,
|
||||
variables: {
|
||||
info: {
|
||||
name: this.serverName,
|
||||
company: this.company,
|
||||
adminContact: this.contact,
|
||||
termsOfService: this.tos
|
||||
}
|
||||
}
|
||||
} )
|
||||
if ( result.data.serverInfoUpdate ) {
|
||||
this.loading = false
|
||||
this.$emit( 'completed' )
|
||||
} else
|
||||
throw new Error( 'Failed to update server information.' )
|
||||
|
||||
} catch ( err ) {
|
||||
this.loading = false
|
||||
this.setupError = true
|
||||
this.errorMessage = err.message
|
||||
}
|
||||
}
|
||||
},
|
||||
data: ( ) => ( {
|
||||
serverInfo: null,
|
||||
valid: true,
|
||||
setupError: false,
|
||||
loading: false,
|
||||
errorMessage: '',
|
||||
subscribe: true,
|
||||
serverName: 'Default Speckle Server',
|
||||
company: 'Acme Inc.',
|
||||
contact: null,
|
||||
tos: null
|
||||
} )
|
||||
}
|
||||
</script>
|
||||
@@ -1,31 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/auth',
|
||||
name: 'Login',
|
||||
component: () => import('../views/auth/Login.vue')
|
||||
},
|
||||
{
|
||||
path: '/auth/register',
|
||||
name: 'Register',
|
||||
component: () => import('../views/auth/Registration.vue')
|
||||
},
|
||||
{
|
||||
path: '/auth/finalize',
|
||||
name: 'AuthorizeApp',
|
||||
component: () => import('../views/auth/AuthorizeApp.vue')
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -126,14 +126,6 @@ const routes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'about',
|
||||
meta: {
|
||||
title: 'About | Speckle'
|
||||
},
|
||||
component: () => import('../views/About.vue')
|
||||
},
|
||||
{
|
||||
path: '/error',
|
||||
name: 'error',
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,27 +1,30 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col cols="12" md="8">
|
||||
<v-sheet rounded="lg" class="pa-15">
|
||||
<h1>
|
||||
Oups. Page not found
|
||||
<v-icon large>mdi-bug</v-icon>
|
||||
</h1>
|
||||
<!-- <v-img src="@/assets/bug.svg" responsive contain max-height="100"/> -->
|
||||
<p class="subtitle-1 font-weight-light">
|
||||
Don't worry - you haven't deleted the internet. Here's a bunch of places you might want to go to:
|
||||
<br />
|
||||
<br />
|
||||
<router-link to="/">Home</router-link>
|
||||
<br />
|
||||
<router-link to="/streams">Streams</router-link>
|
||||
<br />
|
||||
<router-link to="/profile">Your Profile</router-link>
|
||||
</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
<v-app id="speckle-auth">
|
||||
<v-container fill-height fluid>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col cols="12" md="8">
|
||||
<v-sheet rounded="lg" class="pa-15">
|
||||
<h1>
|
||||
Oups. Page not found
|
||||
<v-icon large>mdi-bug</v-icon>
|
||||
</h1>
|
||||
<!-- <v-img src="@/assets/bug.svg" responsive contain max-height="100"/> -->
|
||||
<p class="subtitle-1 font-weight-light">
|
||||
Don't worry - you haven't deleted the internet. Here's a bunch of places you might
|
||||
want to go to:
|
||||
<br />
|
||||
<br />
|
||||
<router-link to="/">Home</router-link>
|
||||
<br />
|
||||
<router-link to="/streams">Streams</router-link>
|
||||
<br />
|
||||
<router-link to="/profile">Your Profile</router-link>
|
||||
</p>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-app>
|
||||
</template>
|
||||
<script>
|
||||
export default {}
|
||||
|
||||
@@ -30,8 +30,8 @@ export default {
|
||||
id: this.$route.params.streamId
|
||||
}
|
||||
},
|
||||
error() {
|
||||
this.$router.push({ path: '/error' })
|
||||
error(err) {
|
||||
// this.$router.push({ path: `/error?message=${err.message}` })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = {
|
||||
return stream
|
||||
|
||||
let acl = await Acl().where( { resourceId: streamId, userId: userId } ).select( 'role' ).first()
|
||||
stream.role = acl.role
|
||||
if ( acl ) stream.role = acl.role
|
||||
return stream
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user