-
Notifications
You must be signed in to change notification settings - Fork 68
feat(rust): improve user/root exported information #2461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rust/agama-lib/src/users/store.rs
Outdated
|
|
||
| Some(FirstUserSettings { | ||
| user_name: Some(first_user.user_name), | ||
| full_name: Some(first_user.full_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means we still export even empty full_name. Is it correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the full_name is not mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so in exported profile will be full_name: "" which looks wrong to me.
rust/agama-lib/src/users/store.rs
Outdated
| .password | ||
| .as_ref() | ||
| .map(|p| p.hashed_password) | ||
| .unwrap_or_default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I see how tricky it is...maybe it belongs more to FirstUser or FirstUserSettings and having trait like Into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I can change that. At first sight, I preferred to keep this logic just here because it is not needed anywhere else and, for consistency, I would have to implement other conversions too (From<&FirstUser> for FirstUserSettings, From<&RootUser> for RootUserSettings and From<&RootUserSettings> for RootUser).
jreidinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general approach looks good and it is better then before. Please after merge close mine #2238
Prepare to release Agama 16: * #1868 * #2347 * #2356 * #2373 * #2393 * #2402 * #2404 * #2406 * #2408 * #2409 * #2410 * #2411 * #2412 * #2413 * #2414 * #2415 * #2416 * #2417 * #2418 * #2419 * #2420 * #2421 * #2422 * #2423 * #2424 * #2425 * #2426 * #2427 * #2428 * #2431 * #2433 * #2434 * #2436 * #2437 * #2438 * #2439 * #2440 * #2441 * #2442 * #2443 * #2445 * #2446 * #2450 * #2451 * #2452 * #2453 * #2454 * #2455 * #2456 * #2457 * #2458 * #2460 * #2461 * #2462 * #2463 * #2464 * #2465 * #2466 * #2467 * #2468 * #2469 * #2470 * #2471 * #2472 * #2473 * #2474 * #2475 * #2476 * #2478 * #2479 * #2480 * #2482 * #2483 * #2484 * #2485 * #2487 * #2488 * #2489 * #2490 * #2491 * #2493 * #2494 * #2495 * #2496 * #2497 * #2498 * #2499 * #2502 * #2505 * #2507 * #2509 * #2511 * #2512 * #2513 * #2515 * #2516 * #2517 * #2518 * #2520 * #2523 * #2524 * #2525
Problem
There are a few problems with the user and root settings that "agama config show" generates.
usersection is exported even if a first user does not exist.rootsection is exported even if no authentication mechanism has been defined.hashed_passwordkey is exported even if therootonly has an SSH public key.For instance, here's the output for a just started Agama instance:
{ "root": {}, "user": { "fullName": "", "userName": "", "password": "", "hashedPassword": false } }Solution
UserPassword). Thepasswordand thehashedPasswordkeys are always exported together.userorrootsections unless it is needed.I decided to not make the changes at HTTP level because it would imply adapting the web client too and we have more urgent things to work on.
Testing