fix: dashboard roles
This commit is contained in:
parent
6d1d259f71
commit
d8c662eaad
|
@ -1,24 +1,25 @@
|
||||||
import React from "react";
|
import React from 'react';
|
||||||
import { Flex, Stack, Center, Text, useMediaQuery } from "@chakra-ui/react";
|
import { Flex, Stack, Center, Text, useMediaQuery } from '@chakra-ui/react';
|
||||||
import { ArrayInputType } from "../../constants";
|
import { ArrayInputType } from '../../constants';
|
||||||
import InputField from "../InputField";
|
import InputField from '../InputField';
|
||||||
|
|
||||||
const Roles = ({ variables, setVariables }: any) => {
|
const Roles = ({ variables, setVariables }: any) => {
|
||||||
const [isNotSmallerScreen] = useMediaQuery("(min-width:600px)");
|
const [isNotSmallerScreen] = useMediaQuery('(min-width:600px)');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{" "}
|
{' '}
|
||||||
<Text fontSize="md" paddingTop="2%" fontWeight="bold" mb={5}>
|
<Text fontSize="md" paddingTop="2%" fontWeight="bold" mb={5}>
|
||||||
Roles
|
Roles
|
||||||
</Text>
|
</Text>
|
||||||
<Stack spacing={6} padding="2% 0%">
|
<Stack spacing={6} padding="2% 0%">
|
||||||
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
|
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
|
||||||
<Flex w="30%" justifyContent="start" alignItems="center">
|
<Flex w="30%" justifyContent="start" alignItems="center">
|
||||||
<Text fontSize="sm">Roles:</Text>
|
<Text fontSize="sm">Roles:</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Center
|
<Center
|
||||||
w={isNotSmallerScreen ? "70%" : "100%"}
|
w={isNotSmallerScreen ? '70%' : '100%'}
|
||||||
mt={isNotSmallerScreen ? "0" : "2"}
|
mt={isNotSmallerScreen ? '0' : '2'}
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
|
@ -29,13 +30,13 @@ const Roles = ({ variables, setVariables }: any) => {
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
|
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
|
||||||
<Flex w="30%" justifyContent="start" alignItems="center">
|
<Flex w="30%" justifyContent="start" alignItems="center">
|
||||||
<Text fontSize="sm">Default Roles:</Text>
|
<Text fontSize="sm">Default Roles:</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Center
|
<Center
|
||||||
w={isNotSmallerScreen ? "70%" : "100%"}
|
w={isNotSmallerScreen ? '70%' : '100%'}
|
||||||
mt={isNotSmallerScreen ? "0" : "2"}
|
mt={isNotSmallerScreen ? '0' : '2'}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
variables={variables}
|
variables={variables}
|
||||||
|
@ -44,13 +45,13 @@ const Roles = ({ variables, setVariables }: any) => {
|
||||||
/>
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
|
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
|
||||||
<Flex w="30%" justifyContent="start" alignItems="center">
|
<Flex w="30%" justifyContent="start" alignItems="center">
|
||||||
<Text fontSize="sm">Protected Roles:</Text>
|
<Text fontSize="sm">Protected Roles:</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Center
|
<Center
|
||||||
w={isNotSmallerScreen ? "70%" : "100%"}
|
w={isNotSmallerScreen ? '70%' : '100%'}
|
||||||
mt={isNotSmallerScreen ? "0" : "2"}
|
mt={isNotSmallerScreen ? '0' : '2'}
|
||||||
>
|
>
|
||||||
<InputField
|
<InputField
|
||||||
variables={variables}
|
variables={variables}
|
||||||
|
|
|
@ -30,6 +30,7 @@ export const EnvVariablesQuery = `
|
||||||
LINKEDIN_CLIENT_SECRET,
|
LINKEDIN_CLIENT_SECRET,
|
||||||
DEFAULT_ROLES,
|
DEFAULT_ROLES,
|
||||||
PROTECTED_ROLES,
|
PROTECTED_ROLES,
|
||||||
|
ROLES,
|
||||||
JWT_TYPE,
|
JWT_TYPE,
|
||||||
JWT_SECRET,
|
JWT_SECRET,
|
||||||
JWT_ROLE_CLAIM,
|
JWT_ROLE_CLAIM,
|
||||||
|
|
|
@ -147,7 +147,14 @@ func EnvResolver(ctx context.Context) (*model.Env, error) {
|
||||||
res.AllowedOrigins = strings.Split(store[constants.EnvKeyAllowedOrigins].(string), ",")
|
res.AllowedOrigins = strings.Split(store[constants.EnvKeyAllowedOrigins].(string), ",")
|
||||||
res.Roles = strings.Split(store[constants.EnvKeyRoles].(string), ",")
|
res.Roles = strings.Split(store[constants.EnvKeyRoles].(string), ",")
|
||||||
res.DefaultRoles = strings.Split(store[constants.EnvKeyDefaultRoles].(string), ",")
|
res.DefaultRoles = strings.Split(store[constants.EnvKeyDefaultRoles].(string), ",")
|
||||||
res.ProtectedRoles = strings.Split(store[constants.EnvKeyProtectedRoles].(string), ",")
|
// since protected role is optional default split gives array with empty string
|
||||||
|
protectedRoles := strings.Split(store[constants.EnvKeyProtectedRoles].(string), ",")
|
||||||
|
res.ProtectedRoles = []string{}
|
||||||
|
for _, role := range protectedRoles {
|
||||||
|
if strings.Trim(role, " ") != "" {
|
||||||
|
res.ProtectedRoles = append(res.ProtectedRoles, strings.Trim(role, " "))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool vars
|
// bool vars
|
||||||
res.DisableEmailVerification = store[constants.EnvKeyDisableEmailVerification].(bool)
|
res.DisableEmailVerification = store[constants.EnvKeyDisableEmailVerification].(bool)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user