diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-25 13:25:41 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-25 13:25:41 +0100 |
| commit | 9c08495cca8b9aaf297c88da9ec98a619eb90762 (patch) | |
| tree | fedb0ba09e45c51f7f1b9d5ce9ea5b9a47ce6f01 /common | |
| parent | 6949f8d40d1784d5a9c54dbe44e212fe2fae76f4 (diff) | |
| download | jellything-9c08495cca8b9aaf297c88da9ec98a619eb90762.tar jellything-9c08495cca8b9aaf297c88da9ec98a619eb90762.tar.bz2 jellything-9c08495cca8b9aaf297c88da9ec98a619eb90762.tar.zst | |
user creation; flash message in request info
Diffstat (limited to 'common')
| -rw-r--r-- | common/object/src/buffer.rs | 9 | ||||
| -rw-r--r-- | common/src/routes.rs | 21 | ||||
| -rw-r--r-- | common/src/user.rs | 1 |
3 files changed, 13 insertions, 18 deletions
diff --git a/common/object/src/buffer.rs b/common/object/src/buffer.rs index 703e203..1f8cec6 100644 --- a/common/object/src/buffer.rs +++ b/common/object/src/buffer.rs @@ -54,9 +54,14 @@ impl ObjectBuffer { } } +pub type OBB = ObjectBufferBuilder; + #[derive(Default)] pub struct ObjectBufferBuilder(Vec<(Tag, u32, Vec<u32>)>); impl ObjectBufferBuilder { + pub fn new() -> Self { + Self::default() + } pub fn push<T: ValueStore>(&mut self, tag: TypedTag<T>, value: T) { let ty = value.get_type(); let tyb = (ty as u32) << 2; @@ -71,6 +76,10 @@ impl ObjectBufferBuilder { self.0.push((tag.0, tyb | pad, vec_u8_to_u32(buf))); } } + pub fn with<T: ValueStore>(mut self, tag: TypedTag<T>, value: T) -> Self { + self.push(tag, value); + self + } pub fn finish(mut self) -> ObjectBuffer { let mut tags = Vec::new(); let mut offsets = Vec::new(); diff --git a/common/src/routes.rs b/common/src/routes.rs index 3266745..b2a10b1 100644 --- a/common/src/routes.rs +++ b/common/src/routes.rs @@ -52,33 +52,15 @@ pub fn u_items_filter(page: usize) -> String { pub fn u_admin_users() -> String { "/admin/users".to_string() } -pub fn u_admin_user(name: &str) -> String { - format!("/admin/user/{name}") -} -pub fn u_admin_user_permission(name: &str) -> String { - format!("/admin/user/{name}/update_permissions") -} -pub fn u_admin_user_remove(name: &str) -> String { - format!("/admin/user/{name}/remove") -} pub fn u_admin_log(warn_only: bool) -> String { format!("/admin/log?warn_only={warn_only}") } -pub fn u_admin_invite_create() -> String { - "/admin/generate_invite".to_string() -} -pub fn u_admin_invite_remove() -> String { - "/admin/remove_invite".to_string() -} pub fn u_admin_import() -> String { format!("/admin/import") } pub fn u_admin_import_post(incremental: bool) -> String { format!("/admin/import?incremental={incremental}") } -pub fn u_admin_update_search() -> String { - "/admin/update_search".to_string() -} pub fn u_account_login() -> String { "/account/login".to_owned() } @@ -88,6 +70,9 @@ pub fn u_account_logout() -> String { pub fn u_admin_dashboard() -> String { "/admin/dashboard".to_owned() } +pub fn u_admin_new_user() -> String { + "/admin/new_user".to_owned() +} pub fn u_account_settings() -> String { "/account/settings".to_owned() } diff --git a/common/src/user.rs b/common/src/user.rs index 0a4111d..636046f 100644 --- a/common/src/user.rs +++ b/common/src/user.rs @@ -9,6 +9,7 @@ use jellyobject::{Tag, enums, fields}; fields! { USER_LOGIN: &str = b"Ulgn"; USER_PASSWORD: &[u8] = b"Upwd"; + USER_PASSWORD_REQUIRE_CHANGE: () = b"Upwc"; USER_NAME: &str = b"Unam"; USER_ADMIN: () = b"Uadm"; USER_THEME_PRESET: Tag = b"Utpr"; |