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