77 * http://github.com/YugaByte/yugabyte-db/blob/master/licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt
88 */
99
10- import { useState } from 'react' ;
10+ import { useEffect , useState } from 'react' ;
1111import { find , isString } from 'lodash' ;
1212import { useForm } from 'react-hook-form' ;
1313import { useMutation , useQuery , useQueryClient } from 'react-query' ;
@@ -158,7 +158,7 @@ const useStyles = makeStyles((theme) => ({
158158 borderRight : 'none' ,
159159 justifyContent : 'center' ,
160160 '& .MuiAccordionSummary-root' : {
161- height : '86px ' ,
161+ height : '120px ' ,
162162 padding : '16px 24px'
163163 } ,
164164 '& .MuiAccordionSummary-content' : {
@@ -171,10 +171,6 @@ const useStyles = makeStyles((theme) => ({
171171 alignItems : 'center' ,
172172 marginBottom : '8px'
173173 } ,
174- groupsIcon : {
175- width : '24px' ,
176- height : '24px'
177- } ,
178174 accordionDetails : {
179175 flexDirection : 'column' ,
180176 gap : '24px' ,
@@ -183,6 +179,9 @@ const useStyles = makeStyles((theme) => ({
183179 } ,
184180 scope : {
185181 width : '308px'
182+ } ,
183+ ldapUseRoleMapping : {
184+ marginTop : '16px'
186185 }
187186} ) ) ;
188187
@@ -212,8 +211,8 @@ const initializeFormValues = (configEntries: RunTimeConfigEntry[]) => {
212211 enable_ldaps === 'true'
213212 ? SecurityOption . ENABLE_LDAPS
214213 : enable_ldap_start_tls === 'true'
215- ? SecurityOption . ENABLE_LDAP_START_TLS
216- : SecurityOption . UNSECURE ;
214+ ? SecurityOption . ENABLE_LDAP_START_TLS
215+ : SecurityOption . UNSECURE ;
217216 finalFormData = { ...finalFormData , ldap_security } ;
218217
219218 return finalFormData ;
@@ -304,6 +303,12 @@ export const LDAPAuthNew = () => {
304303 return promiseArray ;
305304 } ;
306305
306+ const ldapUseGroupMapping = watch ( 'ldap_group_use_role_mapping' ) ;
307+
308+ useEffect ( ( ) => {
309+ setGroupSettingsExpanded ( ldapUseGroupMapping ) ;
310+ } , [ ldapUseGroupMapping ] ) ;
311+
307312 if ( isLoading ) return < YBLoadingCircleIcon /> ;
308313 if ( isError ) return < YBErrorIndicator /> ;
309314
@@ -322,7 +327,7 @@ export const LDAPAuthNew = () => {
322327 const securityProtocol = watch ( 'ldap_security' ) ;
323328 const useSearchAndBind = watch ( 'use_search_and_bind' ) ;
324329 const ldapUseQuery = watch ( 'ldap_group_use_query' ) ;
325-
330+
326331 const toolTip = ( content : string ) => {
327332 return (
328333 < YBTooltip title = { content } placement = "top" >
@@ -393,21 +398,21 @@ export const LDAPAuthNew = () => {
393398 />
394399 { ( securityProtocol === SecurityOption . ENABLE_LDAPS ||
395400 securityProtocol === SecurityOption . ENABLE_LDAP_START_TLS ) && (
396- < YBRadioGroupField
397- label = {
398- < >
399- { t ( 'tlsProtocol' ) }
400- { toolTip ( t ( 'infos.tlsProtocol' ) ) }
401- </ >
402- }
403- name = "ldap_tls_protocol"
404- options = { TLSVersions }
405- control = { control }
406- orientation = "horizontal"
407- isDisabled = { ! ldapEnabled }
408- data-testid = "tls-protocol"
409- />
410- ) }
401+ < YBRadioGroupField
402+ label = {
403+ < >
404+ { t ( 'tlsProtocol' ) }
405+ { toolTip ( t ( 'infos.tlsProtocol' ) ) }
406+ </ >
407+ }
408+ name = "ldap_tls_protocol"
409+ options = { TLSVersions }
410+ control = { control }
411+ orientation = "horizontal"
412+ isDisabled = { ! ldapEnabled }
413+ data-testid = "tls-protocol"
414+ />
415+ ) }
411416 < YBInputField
412417 control = { control }
413418 name = "ldap_basedn"
@@ -548,16 +553,21 @@ export const LDAPAuthNew = () => {
548553 </ div >
549554 < Accordion
550555 expanded = { groupSettingsExpanded }
551- onChange = { ( ) => setGroupSettingsExpanded ( ! groupSettingsExpanded ) }
552556 className = { classes . groupSettings }
553557 data-testid = "group-settings-tab"
554558 >
555- < AccordionSummary expandIcon = { < ArrowDropDown className = { classes . groupsIcon } /> } >
559+ < AccordionSummary >
556560 < div className = { classes . groupHeader } >
557- < UserGroupsIcon className = { classes . groupsIcon } />
558561 < Typography variant = "body1" > { t ( 'group.title' ) } </ Typography >
559562 </ div >
560563 { t ( 'group.helpText' ) }
564+ < div className = { classes . ldapUseRoleMapping } >
565+ < YBToggleField
566+ name = "ldap_group_use_role_mapping"
567+ control = { control }
568+ label = { t ( 'ldapUseRoleMapping' ) }
569+ />
570+ </ div >
561571 </ AccordionSummary >
562572 < AccordionDetails className = { classes . accordionDetails } >
563573 < YBRadioGroupField
0 commit comments