feat: assign teams via oidc #3033

Open
viehlieb wants to merge 6 commits from viehlieb/frontend:assign_teams_via_oidc into main
6 changed files with 17 additions and 27 deletions

View File

@ -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) {

View File

@ -9,6 +9,7 @@ export interface ITeam extends IAbstract {
description: string
members: ITeamMember[]
right: Right
oidcId: string

What's the null value of this? An empty string?

What's the null value of this? An empty string?
createdBy: IUser
created: Date

View File

@ -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

View File

@ -4,4 +4,5 @@ export interface IProvider {
authUrl: string;
clientId: string;
logoutUrl: string;
scope: string;
}

View File

@ -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">

If oidcId is a string, the comparison here does not make sense.

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

View File

@ -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})`: '')}}

Please use something like this instead:

{{ t.name + (t.oidcId !== 0 ? ` (sso: ${t.oidcId})` : '') }}
Please use something like this instead: ``` {{ t.name + (t.oidcId !== 0 ? ` (sso: ${t.oidcId})` : '') }} ```
</p>
</router-link>
</li>
</ul>