Skip to content

Commit

Permalink
make privileges more defining for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
enaut committed Sep 9, 2024
1 parent 61045b2 commit f64adf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/pages/list_users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ fn save_user(user: UserDelta, orders: &mut impl Orders<Msg>) {
EditMode::Create => "/admin/json/create_user/",
EditMode::Edit => "/admin/json/update_user/",
})
.method(Method::Post)
.json(&data),
Msg::Edit(UserEditMsg::FailedToCreateUser)
);
Expand Down Expand Up @@ -428,6 +429,12 @@ fn view_user_table_filter_input<F: Fn(&str) -> String>(model: &Model, t: F) -> N
fn view_user<F: Fn(&str) -> String>(l: &User, logged_in_user: &User, t: F) -> Node<Msg> {
let user = UserDelta::from(l.clone());
tr![
{
let user = user.clone();
ev(Ev::Click, |_| {
Msg::Edit(UserEditMsg::EditUserSelected(user))
})
},
match l.role {
Role::NotAuthenticated | Role::Disabled => C!("inactive"),
Role::Regular => C!("regular"),
Expand Down
2 changes: 1 addition & 1 deletion pslink/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub async fn process_update_user_json(

#[instrument(skip(id))]
pub async fn toggle_admin(
data: web::Path<String>,
user: web::Json<UserDelta>,
config: web::Data<crate::ServerConfig>,
id: Identity,
) -> Result<HttpResponse, ServerError> {
Expand Down

0 comments on commit f64adf2

Please sign in to comment.