feat: add command login

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
2026-09-11 09:04:08 +00:00
parent ccd4288c79
commit 418305653c
9 changed files with 147 additions and 19 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ anyhow = "1"
cfg-if = "1"
bitflags = "2"
clap = { workspace = true }
rusqlite = "0.39"
rusqlite = { version = "0.39", features = ["bundled"] }
rustc-hash = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
-1
View File
@@ -1 +0,0 @@
// Sandbox rules for running an authentication method.
+9 -9
View File
@@ -154,7 +154,7 @@ impl Session {
async fn list_user(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: ListUserArgs,
) -> Result<Vec<Uuid>, Error> {
Ok(state.local_db.list_user(args.start, args.len))
@@ -162,7 +162,7 @@ async fn list_user(
async fn list_group(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: ListGroupArgs,
) -> Result<Vec<Uuid>, Error> {
Ok(state.local_db.list_group(args.start, args.len))
@@ -170,7 +170,7 @@ async fn list_group(
async fn get_user_info(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: GetUserInfoArgs,
) -> Result<UserInfo, Error> {
let uuid = match args {
@@ -189,7 +189,7 @@ async fn get_user_info(
async fn get_group_info(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: GetGroupInfoArgs,
) -> Result<GroupInfo, Error> {
let uuid = match args {
@@ -279,7 +279,7 @@ async fn create_group(
async fn remove_user(
state: Arc<AppState>,
caller: Caller,
args: RemoveUserArgs,
_args: RemoveUserArgs,
) -> Result<(), Error> {
require_secure_tags(&state, caller, &[SecureTag::RemoveUser]).await?;
todo!();
@@ -321,7 +321,7 @@ async fn set_secret(
async fn get_user_auth_methods(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: GetUserAuthMethodsArgs,
) -> Result<Vec<UserAuthMethodRecord>, Error> {
require_secure_tags(&state, Caller::User(args.user), &[SecureTag::Login]).await?;
@@ -330,7 +330,7 @@ async fn get_user_auth_methods(
async fn user_add_auth_method(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: UserAddAuthMethodArgs,
) -> Result<(), Error> {
require_secure_tags(&state, Caller::User(args.user), &[SecureTag::Login]).await?;
@@ -355,7 +355,7 @@ async fn user_add_auth_method(
async fn get_auth_method_path(
state: Arc<AppState>,
caller: Caller,
_caller: Caller,
args: GetAuthMethodPathArgs,
) -> Result<PathBuf, Error> {
Ok(state
@@ -368,7 +368,7 @@ async fn get_auth_method_path(
// ==- Helpers -==
async fn require_same_user(
state: &AppState,
_state: &AppState,
caller: Caller,
requested_user: Uuid,
) -> Result<(), Error> {