| 1 |
import React from "react"; |
| 2 |
// PatternFly |
| 3 |
import { Flex, FlexItem, Form, FormGroup } from "@patternfly/react-core"; |
| 4 |
// Data types |
| 5 |
import { Metadata } from "src/utils/datatypes/globalDataTypes"; |
| 6 |
// Components |
| 7 |
import PopoverWithIconLayout from "src/components/layouts/PopoverWithIconLayout"; |
| 8 |
// Form |
| 9 |
import IpaTextInput from "src/components/Form/IpaTextInput"; |
| 10 |
import IpaTextArea from "src/components/Form/IpaTextArea"; |
| 11 |
import IpaNumberInput from "src/components/Form/IpaNumberInput"; |
| 12 |
import IpaCheckboxes from "src/components/Form/IpaCheckboxes"; |
| 13 |
import IpaCheckbox from "src/components/Form/IpaCheckbox"; |
| 14 |
import IpaDropdownSearch from "src/components/Form/IpaDropdownSearch"; |
| 15 |
import ConfigObjectclassTable from "./ConfigObjectclassTable"; |
| 16 |
|
| 17 |
interface PropsToSearchOptions { |
| 18 |
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 19 |
ipaObject: Record<string, any>; |
| 20 |
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 21 |
recordOnChange: (ipaObject: Record<string, any>) => void; |
| 22 |
metadata: Metadata; |
| 23 |
groups: string[]; |
| 24 |
onSearch: (value: string) => void; |
| 25 |
} |
| 26 |
|
| 27 |
const ConfigUserOptions = (props: PropsToSearchOptions) => { |
| 28 |
const AuthTypesMessage = () => ( |
| 29 |
<div> |
| 30 |
<p>Implicit method (password) will be used if no method is chosen.</p> |
| 31 |
<p> |
| 32 |
<strong>Password + Two-factor:</strong> LDAP and Kerberos allow |
| 33 |
authentication with either one of the authentication types but Kerberos |
| 34 |
uses pre-authentication method which requires to use armor ccache. |
| 35 |
</p> |
| 36 |
<p> |
| 37 |
<strong>RADIUS with another type:</strong> |
| 38 |
Kerberos always use RADIUS, but LDAP never does. LDAP only recognize the |
| 39 |
password and two-factor authentication options. |
| 40 |
</p> |
| 41 |
</div> |
| 42 |
); |
| 43 |
|
| 44 |
const DomainMessage = () => ( |
| 45 |
<div> |
| 46 |
<p>colon-separated list of domains used for short name qualification</p> |
| 47 |
</div> |
| 48 |
); |
| 49 |
|
| 50 |
return ( |
| 51 |
<Flex |
| 52 |
direction={{ default: "column", lg: "row" }} |
| 53 |
flex={{ default: "flex_1" }} |
| 54 |
> |
| 55 |
<FlexItem flex={{ default: "flex_1" }}> |
| 56 |
<Form className="pf-v6-u-mb-lg pf-v6-u-mt-lg" isHorizontal> |
| 57 |
<FormGroup |
| 58 |
label="User search fields" |
| 59 |
fieldId="ipausersearchfields" |
| 60 |
isRequired |
| 61 |
> |
| 62 |
<IpaTextArea |
| 63 |
dataCy="configuration-textbox-ipausersearchfields" |
| 64 |
name="ipausersearchfields" |
| 65 |
ipaObject={props.ipaObject} |
| 66 |
onChange={props.recordOnChange} |
| 67 |
objectName="config" |
| 68 |
metadata={props.metadata} |
| 69 |
/> |
| 70 |
</FormGroup> |
| 71 |
<FormGroup |
| 72 |
label="Default e-mail domain" |
| 73 |
fieldId="ipadefaultemaildomain" |
| 74 |
> |
| 75 |
<IpaTextInput |
| 76 |
dataCy="configuration-textbox-ipadefaultemaildomain" |
| 77 |
name={"ipadefaultemaildomain"} |
| 78 |
ariaLabel={"Default e-mail domain"} |
| 79 |
ipaObject={props.ipaObject} |
| 80 |
onChange={props.recordOnChange} |
| 81 |
objectName="config" |
| 82 |
metadata={props.metadata} |
| 83 |
/> |
| 84 |
</FormGroup> |
| 85 |
<FormGroup |
| 86 |
label="Domain resolution order" |
| 87 |
fieldId="ipadomainresolutionorder" |
| 88 |
labelHelp={ |
| 89 |
<PopoverWithIconLayout message={DomainMessage} triggerHover /> |
| 90 |
} |
| 91 |
> |
| 92 |
<IpaTextArea |
| 93 |
dataCy="configuration-textbox-ipadomainresolutionorder" |
| 94 |
name={"ipadomainresolutionorder"} |
| 95 |
ariaLabel={"Domain resolution order"} |
| 96 |
ipaObject={props.ipaObject} |
| 97 |
onChange={props.recordOnChange} |
| 98 |
objectName="config" |
| 99 |
metadata={props.metadata} |
| 100 |
/> |
| 101 |
</FormGroup> |
| 102 |
<FormGroup |
| 103 |
label="Default users group" |
| 104 |
fieldId="ipadefaultprimarygroup" |
| 105 |
> |
| 106 |
<IpaDropdownSearch |
| 107 |
dataCy="configuration-dropdown-ipadefaultprimarygroup" |
| 108 |
id="ipadefaultprimarygroup" |
| 109 |
name="ipadefaultprimarygroup" |
| 110 |
options={props.groups} |
| 111 |
ipaObject={props.ipaObject} |
| 112 |
setIpaObject={props.recordOnChange} |
| 113 |
objectName="config" |
| 114 |
metadata={props.metadata} |
| 115 |
onSearch={props.onSearch} |
| 116 |
/> |
| 117 |
</FormGroup> |
| 118 |
<FormGroup |
| 119 |
label="Home directory base" |
| 120 |
fieldId="ipahomesrootdir" |
| 121 |
isRequired |
| 122 |
> |
| 123 |
<IpaTextInput |
| 124 |
dataCy="configuration-textbox-ipahomesrootdir" |
| 125 |
name={"ipahomesrootdir"} |
| 126 |
ariaLabel={"Home directory base"} |
| 127 |
ipaObject={props.ipaObject} |
| 128 |
onChange={props.recordOnChange} |
| 129 |
objectName="config" |
| 130 |
metadata={props.metadata} |
| 131 |
/> |
| 132 |
</FormGroup> |
| 133 |
<FormGroup |
| 134 |
label="Default shell" |
| 135 |
fieldId="ipadefaultloginshell" |
| 136 |
isRequired |
| 137 |
> |
| 138 |
<IpaTextInput |
| 139 |
dataCy="configuration-textbox-ipadefaultloginshell" |
| 140 |
name={"ipadefaultloginshell"} |
| 141 |
ariaLabel={"Default shell"} |
| 142 |
ipaObject={props.ipaObject} |
| 143 |
onChange={props.recordOnChange} |
| 144 |
objectName="config" |
| 145 |
metadata={props.metadata} |
| 146 |
/> |
| 147 |
</FormGroup> |
| 148 |
<FormGroup |
| 149 |
label="Maximum username length" |
| 150 |
fieldId="ipamaxusernamelength" |
| 151 |
isRequired |
| 152 |
> |
| 153 |
<IpaNumberInput |
| 154 |
dataCy="configuration-textbox-ipamaxusernamelength" |
| 155 |
id="ipamaxusernamelength" |
| 156 |
name="ipamaxusernamelength" |
| 157 |
aria-label="Maximum username length" |
| 158 |
ipaObject={props.ipaObject} |
| 159 |
onChange={props.recordOnChange} |
| 160 |
objectName="config" |
| 161 |
metadata={props.metadata} |
| 162 |
numCharsShown={6} |
| 163 |
minValue={1} |
| 164 |
maxValue={255} |
| 165 |
/> |
| 166 |
</FormGroup> |
| 167 |
<FormGroup |
| 168 |
label="Password Expiration Notification (days)" |
| 169 |
fieldId="ipapwdexpadvnotify" |
| 170 |
isRequired |
| 171 |
> |
| 172 |
<IpaNumberInput |
| 173 |
dataCy="configuration-textbox-ipapwdexpadvnotify" |
| 174 |
id="ipapwdexpadvnotify" |
| 175 |
name="ipapwdexpadvnotify" |
| 176 |
aria-label="Password Expiration Notification (days)" |
| 177 |
ipaObject={props.ipaObject} |
| 178 |
onChange={props.recordOnChange} |
| 179 |
objectName="config" |
| 180 |
metadata={props.metadata} |
| 181 |
numCharsShown={6} |
| 182 |
minValue={1} |
| 183 |
maxValue={2147483647} |
| 184 |
/> |
| 185 |
</FormGroup> |
| 186 |
<FormGroup |
| 187 |
label="Password plugin features" |
| 188 |
fieldId="ipaconfigstring" |
| 189 |
role="group" |
| 190 |
> |
| 191 |
<IpaCheckboxes |
| 192 |
dataCy="configuration-checkboxes-ipaconfigstring" |
| 193 |
name="ipaconfigstring" |
| 194 |
options={[ |
| 195 |
{ |
| 196 |
value: "AllowNThash", |
| 197 |
text: "AllowNThash", |
| 198 |
}, |
| 199 |
{ |
| 200 |
value: "KDC:Disable Last Success", |
| 201 |
text: "KDC:Disable Last Success", |
| 202 |
}, |
| 203 |
|
| 204 |
{ |
| 205 |
value: "KDC:Disable Lockout", |
| 206 |
text: "KDC:Disable Lockout", |
| 207 |
}, |
| 208 |
]} |
| 209 |
ipaObject={props.ipaObject} |
| 210 |
onChange={props.recordOnChange} |
| 211 |
objectName="config" |
| 212 |
metadata={props.metadata} |
| 213 |
/> |
| 214 |
</FormGroup> |
| 215 |
<FormGroup |
| 216 |
label="Default user authentication types" |
| 217 |
fieldId="ipauserauthtype" |
| 218 |
role="group" |
| 219 |
labelHelp={ |
| 220 |
<PopoverWithIconLayout message={AuthTypesMessage} triggerHover /> |
| 221 |
} |
| 222 |
> |
| 223 |
<IpaCheckboxes |
| 224 |
dataCy="configuration-checkboxes-ipauserauthtype" |
| 225 |
name="ipauserauthtype" |
| 226 |
options={[ |
| 227 |
{ |
| 228 |
value: "disabled", |
| 229 |
text: "Disable per-user override", |
| 230 |
}, |
| 231 |
{ |
| 232 |
value: "password", |
| 233 |
text: "Password", |
| 234 |
}, |
| 235 |
{ |
| 236 |
value: "radius", |
| 237 |
text: "RADIUS", |
| 238 |
}, |
| 239 |
{ |
| 240 |
value: "otp", |
| 241 |
text: "Two factor authentication (password + OTP)", |
| 242 |
}, |
| 243 |
{ |
| 244 |
value: "pkinit", |
| 245 |
text: "PKINIT", |
| 246 |
}, |
| 247 |
{ |
| 248 |
value: "hardened", |
| 249 |
text: "Hardened Password (by SPAKE or FAST)", |
| 250 |
}, |
| 251 |
{ |
| 252 |
value: "idp", |
| 253 |
text: "External Identity Provider", |
| 254 |
}, |
| 255 |
{ |
| 256 |
value: "passkey", |
| 257 |
text: "Passkey", |
| 258 |
}, |
| 259 |
]} |
| 260 |
ipaObject={props.ipaObject} |
| 261 |
onChange={props.recordOnChange} |
| 262 |
objectName="config" |
| 263 |
metadata={props.metadata} |
| 264 |
/> |
| 265 |
</FormGroup> |
| 266 |
<FormGroup |
| 267 |
label="Enable migration mode" |
| 268 |
fieldId="ipamigrationenabled-ipamigrationenabled" |
| 269 |
> |
| 270 |
<IpaCheckbox |
| 271 |
dataCy="configuration-checkbox-ipamigrationenabled" |
| 272 |
name="ipamigrationenabled" |
| 273 |
value="ipamigrationenabled" |
| 274 |
text="" |
| 275 |
ipaObject={props.ipaObject} |
| 276 |
onChange={props.recordOnChange} |
| 277 |
objectName="config" |
| 278 |
metadata={props.metadata} |
| 279 |
className="pf-v6-u-pt-sm" |
| 280 |
/> |
| 281 |
</FormGroup> |
| 282 |
<FormGroup |
| 283 |
label="Enable adding subids to new users" |
| 284 |
fieldId="ipauserdefaultsubordinateid-ipauserdefaultsubordinateid" |
| 285 |
> |
| 286 |
<IpaCheckbox |
| 287 |
dataCy="configuration-checkbox-ipauserdefaultsubordinateid" |
| 288 |
name="ipauserdefaultsubordinateid" |
| 289 |
value="ipauserdefaultsubordinateid" |
| 290 |
text="" |
| 291 |
ipaObject={props.ipaObject} |
| 292 |
onChange={props.recordOnChange} |
| 293 |
objectName="config" |
| 294 |
metadata={props.metadata} |
| 295 |
className="pf-v6-u-pt-sm" |
| 296 |
/> |
| 297 |
</FormGroup> |
| 298 |
</Form> |
| 299 |
</FlexItem> |
| 300 |
<FlexItem flex={{ default: "flex_1" }}> |
| 301 |
<Form className="pf-v6-u-mb-lg pf-v6-u-mt-lg"> |
| 302 |
<FormGroup |
| 303 |
label="Default user objectclasses" |
| 304 |
fieldId="ipauserobjectclasses" |
| 305 |
role="group" |
| 306 |
> |
| 307 |
<ConfigObjectclassTable |
| 308 |
title="Default user objectclasses" |
| 309 |
name="ipauserobjectclasses" |
| 310 |
ipaObject={props.ipaObject} |
| 311 |
onChange={props.recordOnChange} |
| 312 |
objectName="config" |
| 313 |
metadata={props.metadata} |
| 314 |
/> |
| 315 |
</FormGroup> |
| 316 |
</Form> |
| 317 |
</FlexItem> |
| 318 |
</Flex> |
| 319 |
); |
| 320 |
}; |
| 321 |
|
| 322 |
export default ConfigUserOptions; |