mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 04:27:02 +01:00
CLI image error nicening (#3037)
* fix(scim_proto): fixing an issue with building due to dependencies * feat(cli): more error message detail when things go wrong with images on the CLI
This commit is contained in:
parent
6065f2db60
commit
004e263f90
131
Cargo.lock
generated
131
Cargo.lock
generated
|
@ -4,19 +4,13 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.22.0"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.0"
|
||||
|
@ -538,17 +532,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.73"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide 0.7.4",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -749,9 +743,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce"
|
|||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.17.1"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2"
|
||||
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
|
@ -773,9 +767,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.15"
|
||||
version = "1.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6"
|
||||
checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
@ -1065,9 +1059,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
|||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad"
|
||||
checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -1721,7 +1715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide 0.8.0",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1928,9 +1922,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.29.0"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64"
|
||||
|
||||
[[package]]
|
||||
name = "gix"
|
||||
|
@ -2226,9 +2220,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gix-path"
|
||||
version = "0.10.10"
|
||||
version = "0.10.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d5b8722112fa2fa87135298780bc833b0e9f6c56cc82795d209804b3a03484"
|
||||
checksum = "ebfc4febd088abdcbc9f1246896e57e37b7a34f6909840045a1767c6dafac7af"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-trace",
|
||||
|
@ -2339,9 +2333,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gix-trace"
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e"
|
||||
checksum = "6cae0e8661c3ff92688ce1c8b8058b3efb312aba9492bbe93661a21705ab431b"
|
||||
|
||||
[[package]]
|
||||
name = "gix-traverse"
|
||||
|
@ -2604,7 +2598,7 @@ dependencies = [
|
|||
"futures-sink",
|
||||
"futures-util",
|
||||
"http 0.2.12",
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
|
@ -2623,7 +2617,7 @@ dependencies = [
|
|||
"futures-core",
|
||||
"futures-sink",
|
||||
"http 1.1.0",
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
|
@ -2847,9 +2841,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.2"
|
||||
version = "0.27.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
|
||||
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
|
@ -3020,9 +3014,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
|
||||
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.14.5",
|
||||
|
@ -3060,9 +3054,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.9.0"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
||||
checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
|
@ -3298,6 +3292,7 @@ name = "kanidm_proto"
|
|||
version = "1.4.0-dev"
|
||||
dependencies = [
|
||||
"base32",
|
||||
"clap",
|
||||
"enum-iterator",
|
||||
"num_enum",
|
||||
"scim_proto",
|
||||
|
@ -3327,6 +3322,7 @@ dependencies = [
|
|||
"futures-concurrency",
|
||||
"kanidm_build_profiles",
|
||||
"kanidm_client",
|
||||
"kanidm_lib_file_permissions",
|
||||
"kanidm_proto",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
|
@ -3796,7 +3792,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
|||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"libc",
|
||||
"redox_syscall 0.5.3",
|
||||
"redox_syscall 0.5.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3968,15 +3964,6 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.0"
|
||||
|
@ -4302,9 +4289,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.3"
|
||||
version = "0.36.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
|
||||
checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -4589,7 +4576,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall 0.5.3",
|
||||
"redox_syscall 0.5.4",
|
||||
"smallvec",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
@ -4666,7 +4653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -4757,9 +4744,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
|||
|
||||
[[package]]
|
||||
name = "plotters"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3"
|
||||
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"plotters-backend",
|
||||
|
@ -4770,15 +4757,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "plotters-backend"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7"
|
||||
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
|
||||
|
||||
[[package]]
|
||||
name = "plotters-svg"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705"
|
||||
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
|
||||
dependencies = [
|
||||
"plotters-backend",
|
||||
]
|
||||
|
@ -5046,9 +5033,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
|
||||
checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
]
|
||||
|
@ -5299,9 +5286,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.35"
|
||||
version = "0.38.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f"
|
||||
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
|
@ -5312,9 +5299,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.12"
|
||||
version = "0.23.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044"
|
||||
checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"rustls-pki-types",
|
||||
|
@ -5341,9 +5328,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"
|
|||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.102.7"
|
||||
version = "0.102.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56"
|
||||
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
|
@ -5373,11 +5360,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
|
||||
checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5584,7 +5571,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
|
@ -6079,9 +6066,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-stream"
|
||||
version = "0.1.15"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
|
||||
checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
|
@ -6123,7 +6110,7 @@ version = "0.19.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||
dependencies = [
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"toml_datetime",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
@ -6416,9 +6403,9 @@ checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
|
@ -6483,7 +6470,7 @@ version = "4.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5afb1a60e207dca502682537fefcfd9921e71d0b83e9576060f09abc6efab23"
|
||||
dependencies = [
|
||||
"indexmap 2.4.0",
|
||||
"indexmap 2.5.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"utoipa-gen",
|
||||
|
@ -6874,7 +6861,7 @@ version = "1.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d"
|
||||
dependencies = [
|
||||
"redox_syscall 0.5.3",
|
||||
"redox_syscall 0.5.4",
|
||||
"wasite",
|
||||
"web-sys",
|
||||
]
|
||||
|
|
|
@ -284,7 +284,7 @@ tracing-forest = "^0.1.6"
|
|||
|
||||
url = "^2.5.2"
|
||||
urlencoding = "2.1.3"
|
||||
utoipa = "4.2.0"
|
||||
utoipa = { version = "4.2.0", features = ["url", "uuid"] }
|
||||
utoipa-swagger-ui = "6.0.0"
|
||||
uuid = "^1.10.0"
|
||||
|
||||
|
|
|
@ -20,11 +20,15 @@ base64urlsafedata = { workspace = true }
|
|||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
peg = { workspace = true }
|
||||
time = { workspace = true, features = ["local-offset", "formatting", "parsing", "serde"] }
|
||||
time = { workspace = true, features = [
|
||||
"local-offset",
|
||||
"formatting",
|
||||
"parsing",
|
||||
"serde",
|
||||
] }
|
||||
tracing = { workspace = true }
|
||||
url = { workspace = true, features = ["serde"] }
|
||||
utoipa = { workspace = true }
|
||||
uuid = { workspace = true, features = ["serde"] }
|
||||
utoipa.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
|
|
@ -259,7 +259,7 @@ peg::parser! {
|
|||
barevalue()
|
||||
|
||||
rule barevalue() -> Value =
|
||||
s:$((!operator()[_])*) {? eprintln!("--> {}", s); serde_json::from_str(s).map_err(|_| "invalid json value" ) }
|
||||
s:$((!operator()[_])*) {? serde_json::from_str(s).map_err(|_| "invalid json value" ) }
|
||||
|
||||
pub(crate) rule attrpath() -> AttrPath =
|
||||
a:attrname() s:subattr()? { AttrPath { a, s } }
|
||||
|
|
|
@ -21,6 +21,7 @@ test = []
|
|||
|
||||
[dependencies]
|
||||
base32 = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
num_enum = { workspace = true }
|
||||
scim_proto = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use crate::constants::{
|
||||
CONTENT_TYPE_GIF, CONTENT_TYPE_JPG, CONTENT_TYPE_PNG, CONTENT_TYPE_SVG, CONTENT_TYPE_WEBP,
|
||||
};
|
||||
use clap::ValueEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
@ -100,7 +101,7 @@ pub enum IdentifyUserResponse {
|
|||
InvalidUserId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Ord, PartialOrd)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Ord, PartialOrd, ValueEnum)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ImageType {
|
||||
Png,
|
||||
|
|
|
@ -43,6 +43,7 @@ dialoguer = { workspace = true }
|
|||
futures-concurrency = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
kanidm_client = { workspace = true }
|
||||
kanidm_lib_file_permissions = { workspace = true }
|
||||
kanidm_proto = { workspace = true }
|
||||
qrcode = { workspace = true }
|
||||
rpassword = { workspace = true }
|
||||
|
@ -61,6 +62,7 @@ regex = { workspace = true }
|
|||
sketching = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
kanidm_proto = { workspace = true }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
clap_complete = { workspace = true }
|
||||
kanidm_build_profiles = { workspace = true }
|
||||
|
|
|
@ -79,20 +79,29 @@ impl DomainOpt {
|
|||
.context("Path contains non utf-8")?
|
||||
.to_string();
|
||||
|
||||
let image_type = if let Some(image_type) = image_type {
|
||||
image_type.as_str().try_into().map_err(Error::msg)?
|
||||
} else {
|
||||
let image_type = match image_type {
|
||||
Some(val) => val.clone(),
|
||||
None => {
|
||||
path
|
||||
.extension().context("Path has no extension so we can't infer the imageType, or you could pass the optional imageType argument yourself.")?
|
||||
.to_str().context("Path contains invalid utf-8")?
|
||||
.try_into()
|
||||
.map_err(Error::msg)?
|
||||
}
|
||||
};
|
||||
|
||||
let read_res = read(path);
|
||||
match read_res {
|
||||
Ok(data) => Ok(ImageValue::new(file_name, image_type, data)),
|
||||
Err(err) => Err(err).context("Reading error"),
|
||||
Err(err) => {
|
||||
if copt.debug {
|
||||
eprintln!(
|
||||
"{}",
|
||||
kanidm_lib_file_permissions::diagnose_path(path.as_ref())
|
||||
);
|
||||
}
|
||||
Err(err).context(format!("Failed to read file at '{}'", path.display()))
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
|
|
|
@ -258,7 +258,6 @@ impl Oauth2Opt {
|
|||
path,
|
||||
image_type,
|
||||
} => {
|
||||
let client = nopt.copt.to_client(OpType::Write).await;
|
||||
let img_res: Result<ImageValue, Error> = (move || {
|
||||
let file_name = path
|
||||
.file_name()
|
||||
|
@ -267,31 +266,42 @@ impl Oauth2Opt {
|
|||
.context("Path contains non utf-8")?
|
||||
.to_string();
|
||||
|
||||
let image_type = if let Some(image_type) = image_type {
|
||||
image_type.as_str().try_into().map_err(Error::msg)?
|
||||
} else {
|
||||
path
|
||||
.extension().context("Path has no extension so we can't infer the imageType, or you could pass the optional imageType argument yourself.")?
|
||||
.to_str().context("Path contains invalid utf-8")?
|
||||
.try_into()
|
||||
.map_err(Error::msg)?
|
||||
let image_type = match image_type {
|
||||
Some(val) => val.clone(),
|
||||
None => {
|
||||
path
|
||||
.extension().context("Path has no extension so we can't infer the imageType, or you could pass the optional imageType argument yourself.")?
|
||||
.to_str().context("Path contains invalid utf-8")?
|
||||
.try_into()
|
||||
.map_err(Error::msg)?
|
||||
}
|
||||
};
|
||||
|
||||
let read_res = read(path);
|
||||
match read_res {
|
||||
Ok(data) => Ok(ImageValue::new(file_name, image_type, data)),
|
||||
Err(err) => Err(err).context("Reading error"),
|
||||
Err(err) => {
|
||||
if nopt.copt.debug {
|
||||
eprintln!(
|
||||
"{}",
|
||||
kanidm_lib_file_permissions::diagnose_path(path.as_ref())
|
||||
);
|
||||
}
|
||||
Err(err).context(format!("Failed to read file at '{}'", path.display()))
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
let img = match img_res {
|
||||
Ok(img) => img,
|
||||
Err(err) => {
|
||||
eprintln!("{err}");
|
||||
eprintln!("{:?}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let client = nopt.copt.to_client(OpType::Write).await;
|
||||
|
||||
match client
|
||||
.idm_oauth2_rs_update_image(nopt.name.as_str(), img)
|
||||
.await
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use clap::{builder::PossibleValue, Args, Subcommand, ValueEnum};
|
||||
use kanidm_proto::internal::ImageType;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Args)]
|
||||
|
@ -1089,16 +1090,17 @@ pub enum Oauth2Opt {
|
|||
#[clap(name = "landing-url")]
|
||||
url: Url,
|
||||
},
|
||||
/// The image presented on the Kanidm Apps Listing page for an oauth2 resource server.
|
||||
/// The image presented on the Kanidm Apps Listing page for an OAuth2 resource server.
|
||||
#[clap(name = "set-image")]
|
||||
SetImage {
|
||||
#[clap(flatten)]
|
||||
nopt: Named,
|
||||
#[clap(name = "file-path")]
|
||||
/// A local file path to an image to use as the icon for this OAuth2 client.
|
||||
path: PathBuf,
|
||||
#[clap(name = "image-type",
|
||||
value_parser = clap::builder::NonEmptyStringValueParser::new())]
|
||||
image_type: Option<String>,
|
||||
#[clap(name = "image-type")]
|
||||
/// The type of image being uploaded.
|
||||
image_type: Option<ImageType>,
|
||||
},
|
||||
/// Removes the custom image previously set.
|
||||
#[clap(name = "remove-image")]
|
||||
|
@ -1275,17 +1277,17 @@ pub enum DomainOpt {
|
|||
key_id: String,
|
||||
},
|
||||
/// The image presented as the instance logo
|
||||
#[clap(name="set-image")]
|
||||
#[clap(name = "set-image")]
|
||||
SetImage {
|
||||
#[clap(flatten)]
|
||||
copt: CommonOpt,
|
||||
#[clap(name = "file-path")]
|
||||
path: PathBuf,
|
||||
#[clap(name = "image-type")]
|
||||
image_type: Option<String>,
|
||||
image_type: Option<ImageType>,
|
||||
},
|
||||
/// The remove the current instance logo, reverting to the default.
|
||||
#[clap(name="remove-image")]
|
||||
#[clap(name = "remove-image")]
|
||||
RemoveImage {
|
||||
#[clap(flatten)]
|
||||
copt: CommonOpt,
|
||||
|
|
Loading…
Reference in a new issue