feat: assign teams via oidc #3033
|
@ -11,13 +11,15 @@ export function getRedirectUrlFromCurrentFrontendPath(provider: IProvider): stri
|
||||||
|
|
||||||
export const redirectToProvider = (provider: IProvider) => {
|
export const redirectToProvider = (provider: IProvider) => {
|
||||||
|
|
||||||
console.log({provider})
|
|
||||||
|
|
||||||
const redirectUrl = getRedirectUrlFromCurrentFrontendPath(provider)
|
const redirectUrl = getRedirectUrlFromCurrentFrontendPath(provider)
|
||||||
const state = createRandomID(24)
|
const state = createRandomID(24)
|
||||||
localStorage.setItem('state', state)
|
localStorage.setItem('state', state)
|
||||||
|
|
||||||
window.location.href = `${provider.authUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=openid email profile&state=${state}`
|
let scope = 'openid email profile'
|
||||||
|
if (provider.scope !== null){
|
||||||
|
scope = provider.scope
|
||||||
|
}
|
||||||
|
window.location.href = `${provider.authUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=${scope}&state=${state}`
|
||||||
}
|
}
|
||||||
export const redirectToProviderOnLogout = (provider: IProvider) => {
|
export const redirectToProviderOnLogout = (provider: IProvider) => {
|
||||||
if (provider.logoutUrl.length > 0) {
|
if (provider.logoutUrl.length > 0) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ export interface ITeam extends IAbstract {
|
||||||
description: string
|
description: string
|
||||||
members: ITeamMember[]
|
members: ITeamMember[]
|
||||||
right: Right
|
right: Right
|
||||||
|
oidcId: string
|
||||||
|
|||||||
|
|
||||||
createdBy: IUser
|
createdBy: IUser
|
||||||
created: Date
|
created: Date
|
||||||
|
|
|
@ -13,6 +13,7 @@ export default class TeamModel extends AbstractModel<ITeam> implements ITeam {
|
||||||
description = ''
|
description = ''
|
||||||
members: ITeamMember[] = []
|
members: ITeamMember[] = []
|
||||||
right: Right = RIGHTS.READ
|
right: Right = RIGHTS.READ
|
||||||
|
oidcId = ''
|
||||||
|
|
||||||
createdBy: IUser = {} // FIXME: seems wrong
|
createdBy: IUser = {} // FIXME: seems wrong
|
||||||
created: Date = null
|
created: Date = null
|
||||||
|
|
|
@ -4,4 +4,5 @@ export interface IProvider {
|
||||||
authUrl: string;
|
authUrl: string;
|
||||||
clientId: string;
|
clientId: string;
|
||||||
logoutUrl: string;
|
logoutUrl: string;
|
||||||
|
scope: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
class="loader-container is-max-width-desktop"
|
class="loader-container is-max-width-desktop"
|
||||||
:class="{ 'is-loading': teamService.loading }"
|
:class="{ 'is-loading': teamService.loading }"
|
||||||
>
|
>
|
||||||
<card
|
<card class="is-fullwidth" v-if="userIsAdmin && !team.oidcId" :title="title">
|
||||||
konrad
commented
If If `oidcId` is a string, the comparison here does not make sense.
|
|||||||
v-if="userIsAdmin"
|
|
||||||
class="is-fullwidth"
|
|
||||||
:title="title"
|
|
||||||
>
|
|
||||||
<form @submit.prevent="save()">
|
<form @submit.prevent="save()">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label
|
<label
|
||||||
|
@ -71,15 +67,8 @@
|
||||||
</div>
|
</div>
|
||||||
</card>
|
</card>
|
||||||
|
|
||||||
<card
|
<card class="is-fullwidth has-overflow" :title="$t('team.edit.members')" :padding="false">
|
||||||
class="is-fullwidth has-overflow"
|
<div class="p-4" v-if="userIsAdmin && !team.oidcId">
|
||||||
:title="$t('team.edit.members')"
|
|
||||||
:padding="false"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
v-if="userIsAdmin"
|
|
||||||
class="p-4"
|
|
||||||
>
|
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control is-expanded">
|
<div class="control is-expanded">
|
||||||
<Multiselect
|
<Multiselect
|
||||||
|
|
|
@ -12,16 +12,12 @@
|
||||||
</x-button>
|
</x-button>
|
||||||
|
|
||||||
<h1>{{ $t('team.title') }}</h1>
|
<h1>{{ $t('team.title') }}</h1>
|
||||||
<ul
|
<ul class="teams box" v-if="teams.length > 0">
|
||||||
v-if="teams.length > 0"
|
<li :key="t.id" v-for="t in teams">
|
||||||
class="teams box"
|
<router-link :to="{name: 'teams.edit', params: {id: t.id}}">
|
||||||
>
|
<p>
|
||||||
<li
|
{{ t.name + (t.oidcId ? ` (sso: ${t.oidcId})`: '')}}
|
||||||
konrad
commented
Please use something like this instead:
Please use something like this instead:
```
{{ t.name + (t.oidcId !== 0 ? ` (sso: ${t.oidcId})` : '') }}
```
|
|||||||
v-for="team in teams"
|
</p>
|
||||||
:key="team.id"
|
|
||||||
>
|
|
||||||
<router-link :to="{name: 'teams.edit', params: {id: team.id}}">
|
|
||||||
{{ team.name }}
|
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Reference in New Issue
What's the null value of this? An empty string?