Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xeruf/dashboard
  • stackspin/dashboard
2 results
Show changes
......@@ -12,6 +12,8 @@ import {
clearCurrentUser,
createBatchUsers,
fetchRecoveryLink,
resetTotpById,
resetWebAuthnById,
} from '../redux';
import { getUserById, getRecoveryLink, getUserModalLoading, getUserslLoading } from '../redux/selectors';
......@@ -62,10 +64,19 @@ export function useUsers() {
function deleteUserById(id: string) {
return dispatch(deleteUser(id));
}
function getRecoveryLinkUserById(id: string) {
return dispatch(fetchRecoveryLink(id));
}
function resetTotp(id: string) {
return dispatch(resetTotpById(id));
}
function resetWebAuthn(id: string) {
return dispatch(resetWebAuthnById(id));
}
return {
users,
user,
......@@ -83,5 +94,7 @@ export function useUsers() {
getRecoveryLinkUserById,
clearSelectedUser,
createUsers,
resetTotp,
resetWebAuthn,
};
}
......@@ -12,6 +12,8 @@ import {
transformUser,
transformUpdateMultipleUsers,
transformRecoveryLink,
transformTotp,
transformWebAuthn,
} from '../transformations';
export enum UserActionTypes {
......@@ -25,6 +27,8 @@ export enum UserActionTypes {
SET_USERS_LOADING = 'users/users_loading',
CREATE_BATCH_USERS = 'users/create_batch_users',
UPDATE_MULTIPLE_USERS = '/users/multi-edit',
RESET_TOTP = 'users/reset-totp-user',
RESET_WEBAUTHN = 'users/reset-webauthn-user',
}
export const setUsersLoading = (isLoading: boolean) => (dispatch: Dispatch<any>) => {
......@@ -235,6 +239,38 @@ export const fetchRecoveryLink = (id: string) => async (dispatch: Dispatch<any>)
}
};
export const resetTotpById = (id: string) => async (dispatch: Dispatch<any>) => {
try {
const { data } = await performApiCall({
path: `/users/${id}/reset_totp`,
method: 'POST',
});
dispatch({
type: UserActionTypes.RESET_TOTP,
payload: transformTotp(data),
});
} catch (err) {
console.error(err);
}
};
export const resetWebAuthnById = (id: string) => async (dispatch: Dispatch<any>) => {
try {
const { data } = await performApiCall({
path: `/users/${id}/reset_webauthn`,
method: 'POST',
});
dispatch({
type: UserActionTypes.RESET_WEBAUTHN,
payload: transformWebAuthn(data),
});
} catch (err) {
console.error(err);
}
};
export const deleteUser = (id: string) => async (dispatch: Dispatch<any>) => {
dispatch(setUserModalLoading(true));
......
......@@ -45,6 +45,20 @@ export const transformRequestAppRoles = (data: AppRoles): any => {
};
};
export const transformTotp = (data: any) => {
if (data.credentials !== undefined) {
return data.credentials.totp !== undefined;
}
return undefined;
};
export const transformWebAuthn = (data: any) => {
if (data.credentials !== undefined) {
return data.credentials.webauthn !== undefined;
}
return undefined;
};
export const transformUser = (response: any): User => {
return {
id: response.id ?? '',
......@@ -53,6 +67,11 @@ export const transformUser = (response: any): User => {
name: response.traits.name ?? '',
preferredUsername: response.preferredUsername ?? '',
status: response.state ?? '',
totp: transformTotp(response),
webauthn: transformWebAuthn(response),
tags: response.stackspin_data.tags ?? '',
admin: response.stackspin_data.stackspin_admin ?? '',
meta: response.metadata_admin ?? '',
};
};
......@@ -111,3 +130,11 @@ export const transformBatchResponse = (response: any): any => {
export const transformRecoveryLink = (response: any): string => {
return response.recovery_link;
};
export const transformResetTotpById = (response: any): any => {
return {
success: response.success,
existing: response.existing,
failed: response.failed,
};
};
......@@ -5,6 +5,11 @@ export interface User {
name: string;
preferredUsername: string;
status: string;
totp?: boolean;
webauthn?: boolean;
tags?: [];
admin?: boolean;
meta?: [];
}
export interface FormUser extends User {
......
module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
content: [
'./src/**/*.{js,jsx,ts,tsx}',
'./public/index.html',
],
theme: {
extend: {
colors: {
primary: {
50: '#F2FFFF',
100: '#D6FDFF',
200: '#B6F7FB',
300: '#7AE5EA',
400: '#55C6CC',
500: '#39A9B1',
600: '#24929C',
700: '#157983',
800: '#135D66',
900: '#0F4F57',
light: '#54C6CC',
DEFAULT: '#54C6CC',
dark: '#1E8290',
50: 'var(--colour-primary-50)',
100: 'var(--colour-primary-100)',
200: 'var(--colour-primary-200)',
300: 'var(--colour-primary-300)',
400: 'var(--colour-primary-400)',
500: 'var(--colour-primary-500)',
600: 'var(--colour-primary-600)',
700: 'var(--colour-primary-700)',
800: 'var(--colour-primary-800)',
900: 'var(--colour-primary-900)',
950: 'var(--colour-primary-950)',
light: 'var(--colour-primary-light)',
DEFAULT: 'var(--colour-primary-default)',
dark: 'var(--colour-primary-dark)',
},
},
},
},
variants: {
extend: {
tableLayout: ['hover', 'focus'],
},
},
plugins: [
require('@tailwindcss/forms'), // eslint-disable-line
require('@tailwindcss/typography'), // eslint-disable-line
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -9,8 +9,13 @@
"packageRules": [
{
"matchDepNames": ["node"],
"matchFiles": ["frontend/Dockerfile", ".gitlab-ci.yml"],
"allowedVersions": "!/^\d*[13579](-.*)?$/"
"matchFileNames": ["frontend/Dockerfile", ".gitlab-ci.yml"],
"allowedVersions": "!/^\\d*[13579](-.*)?$/"
},
{
"matchPackageNames": ["ory-hydra-client"],
"matchFileNames": ["backend/requirements.in"],
"allowedVersions": "<2.0.0"
}
]
}
#!/usr/bin/env bash
if [ -f "./backend/kubeconfig/kube_config_cluster.yml" ]; then
echo "Local KUBECONFIG configuration file found, applying custom configuration."
export KUBECONFIG=./backend/kubeconfig/kube_config_cluster.yml
else
echo "no Local KUBECONFIG configuration file found, skipping custom configuration."
fi
set -euo pipefail
dockerComposeArgs=$@
export DATABASE_PASSWORD=$(kubectl get secret -n flux-system stackspin-single-sign-on-variables -o jsonpath --template '{.data.dashboard_database_password}' | base64 -d)
export DOMAIN=$(kubectl get secret -n flux-system stackspin-cluster-variables -o jsonpath --template '{.data.domain}' | base64 -d)
export HYDRA_CLIENT_SECRET=$(kubectl get secret -n flux-system stackspin-dashboard-local-oauth-variables -o jsonpath --template '{.data.client_secret}' | base64 -d)
export FLASK_SECRET_KEY=$(kubectl get secret -n flux-system stackspin-dashboard-variables -o jsonpath --template '{.data.backend_secret_key}' | base64 -d)
if [[ -z "$DATABASE_PASSWORD" ]]; then
echo "Could not find database password in stackspin-single-sign-on-variables secret"
exit 1
fi
if [[ -z "$DOMAIN" ]]; then
echo "Could not find domain name in stackspin-cluster-variables secret"
exit 1
fi
if [[ -z "$FLASK_SECRET_KEY" ]]; then
echo "Could not find backend_secret_key in stackspin-dashboard-variables secret"
exit 1
fi
if [[ -z "$HYDRA_CLIENT_SECRET" ]]; then
echo "Could not find client_secret in stackspin-dashboard-local-oauth-variables secret"
echo "make sure you add this secret following instructions in the dashboard-dev-overrides repository"
exit 1
fi
KUBECTL_UID=${UID:-1001} KUBECTL_GID=${GID:-0} docker compose up $dockerComposeArgs
client:
# The time that the traffic-manager will retain a client connection without
# any sign of life from the workstation.
connectionTTL: 5m
routing:
allowConflictingSubnets:
- "10.42.0.0/16"
- "10.43.0.0/16"