-
Notifications
You must be signed in to change notification settings - Fork 74
Rewrite users service from ruby to rust #2937
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
373bc70
Added basic skeleton of users service
mchf aeb38a2
Formatting
mchf 4d7c12a
Basic implementation of GetSystem message for agama-users service
mchf 3ed2876
Formatting
mchf a051437
After rebase fixes
mchf 7852e77
Basic messages hooked in
mchf b445479
Let users service produce first issue when needed
mchf fd1c06c
Formatting + doc
mchf 952b646
Added skeleton of "model" for users service
mchf ed76843
Populating the users model
mchf df50b79
Populated SetConfig
mchf 1e9f8a6
Switching from mocked users struct to existing UserSettings
mchf 6871133
Cleanup and formatting
mchf ecbcd99
Updated profile schema
mchf 105e839
Fixes related to profile schema
mchf 41eed7a
Fixed check in users service get_proposal
mchf 6ebd468
Fixed tests
mchf 60d3b64
Hooked issues / events into users' SetConfig handler
mchf 5fcf24f
Removed debugging stuff. Added licenses where were missing.
mchf 5c863ff
Refactoring: removed unnecessary nesting in users' Config struct
mchf 931f509
Cleanup
mchf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| [package] | ||
| name = "agama-users" | ||
| version = "0.1.0" | ||
| rust-version.workspace = true | ||
| edition.workspace = true | ||
|
|
||
| [dependencies] | ||
| anyhow = "1.0.99" | ||
| thiserror = "2.0.16" | ||
| agama-locale-data = { path = "../agama-locale-data" } | ||
| agama-utils = { path = "../agama-utils" } | ||
| regex = "1.11.2" | ||
| tracing = "0.1.41" | ||
| gettext-rs = { version = "0.7.2", features = ["gettext-system"] } | ||
| tokio = { version = "1.47.1", features = ["macros", "rt-multi-thread", "sync"] } | ||
| tokio-stream = "0.1.17" | ||
| zbus = "5.11.0" | ||
| async-trait = "0.1.89" | ||
|
|
||
| [dev-dependencies] | ||
| test-context = "0.4.1" | ||
| tokio-test = "0.4.4" | ||
|
|
||
| [lints.rust] | ||
| unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ci)'] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) [2025] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| pub mod service; | ||
| pub use service::{Service, Starter}; | ||
|
|
||
| pub mod message; | ||
|
|
||
| mod model; | ||
| pub use model::{Model, ModelAdapter}; | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // Copyright (c) [2025] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use agama_utils::{ | ||
| actor::Message, | ||
| api::{self}, | ||
| }; | ||
|
|
||
| #[derive(Clone)] | ||
| pub struct SetSystem<T> { | ||
| pub system: Option<T>, | ||
| } | ||
|
|
||
| impl<T: Send + 'static> Message for SetSystem<T> { | ||
| type Reply = (); | ||
| } | ||
|
|
||
| pub struct GetConfig; | ||
|
|
||
| impl Message for GetConfig { | ||
| type Reply = api::users::Config; | ||
| } | ||
|
|
||
| pub struct SetConfig<T> { | ||
| pub config: Option<T>, | ||
| } | ||
|
|
||
| impl<T> SetConfig<T> { | ||
| pub fn new(config: Option<T>) -> Self { | ||
| Self { config } | ||
| } | ||
| } | ||
|
|
||
| impl<T: Send + 'static> Message for SetConfig<T> { | ||
| type Reply = (); | ||
| } | ||
|
|
||
| pub struct GetProposal; | ||
|
|
||
| impl Message for GetProposal { | ||
| type Reply = Option<api::users::Config>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright (c) [2024] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use crate::service; | ||
|
|
||
| /// Abstract the users-related configuration from the underlying system. | ||
| pub trait ModelAdapter: Send + 'static { | ||
| /// Apply the changes to target system. It is expected to be called almost | ||
| /// at the end of the installation. | ||
| fn install(&self) -> Result<(), service::Error> { | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| /// [ModelAdapter] implementation for systemd-based systems. | ||
| pub struct Model {} | ||
|
|
||
| impl ModelAdapter for Model { | ||
| fn install(&self) -> Result<(), service::Error> { | ||
| Ok(()) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.