21 Commits

Author SHA1 Message Date
7083d27644 Merge pull request 'single-user-edit-page' (#986) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m24s
CI/CD Pipeline / deploy-staging (push) Successful in 8m23s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #986
2025-05-05 20:37:12 +02:00
8277ef6af8 Merge pull request 'allow to create users' (#978) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m29s
CI/CD Pipeline / deploy-staging (push) Successful in 7m14s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #978
2025-05-05 12:05:47 +02:00
67d5df9c18 Merge pull request 'Fill acitivites from various activities; Fixes #972' (#977) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m29s
CI/CD Pipeline / deploy-staging (push) Successful in 7m49s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #977
2025-05-04 19:05:38 +02:00
3ffc44a5a2 Merge pull request 'single-user-edit-page' (#975) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m18s
CI/CD Pipeline / deploy-staging (push) Successful in 7m57s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #975
2025-05-04 10:48:41 +02:00
bd2686fa9c Merge pull request 'add notes' (#973) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m2s
CI/CD Pipeline / deploy-staging (push) Successful in 7m5s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #973
2025-05-03 21:37:31 +02:00
495ee666cd Merge pull request 'single-user-edit-page' (#971) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m33s
CI/CD Pipeline / deploy-staging (push) Successful in 7m46s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #971
2025-05-03 19:20:17 +02:00
5296b6a6c1 Merge pull request 'single-user-edit-page' (#970) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m54s
CI/CD Pipeline / deploy-staging (push) Successful in 7m8s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #970
2025-05-03 13:46:39 +02:00
49e657ab54 Merge pull request 'single-user-edit-page' (#968) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m27s
CI/CD Pipeline / deploy-staging (push) Successful in 6m34s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #968
2025-05-02 18:16:53 +02:00
25bbaca0d3 Merge pull request 'show payment status in user view; Fixes #965' (#967) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m54s
CI/CD Pipeline / deploy-staging (push) Successful in 8m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #967
2025-04-30 23:32:36 +02:00
26038eabe4 Merge pull request 'single-user-edit-page' (#966) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m39s
CI/CD Pipeline / deploy-staging (push) Successful in 7m3s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #966
2025-04-30 22:32:46 +02:00
57acd92e7c Merge pull request 'fix-list-scheckbuch' (#960) from fix-list-scheckbuch into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m37s
CI/CD Pipeline / deploy-staging (push) Successful in 7m3s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #960
2025-04-29 23:01:50 +02:00
c136c60e62 Merge pull request 'separate-scheckbuch-user' (#948) from separate-scheckbuch-user into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m17s
CI/CD Pipeline / deploy-staging (push) Successful in 6m45s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #948
2025-04-29 21:06:00 +02:00
a5e90ea014 Merge pull request 'log-event-updates' (#946) from log-event-updates into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 10m29s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #946
2025-04-29 20:37:11 +02:00
f0f3909239 Merge pull request 'format-cal-according-to-standard' (#944) from format-cal-according-to-standard into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m35s
CI/CD Pipeline / deploy-staging (push) Successful in 21m47s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #944
2025-04-28 22:20:39 +02:00
1438bbe3a8 Merge pull request 'hide-box' (#935) from hide-box into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m53s
CI/CD Pipeline / deploy-staging (push) Successful in 7m59s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #935
2025-04-19 21:30:20 +02:00
a910cd745d Merge pull request 'document nextcloud integration, for future nextcloud setups' (#933) from doc-nextcloud-integration into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m47s
CI/CD Pipeline / deploy-staging (push) Successful in 7m25s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #933
2025-04-19 09:19:58 +02:00
6265440288 Merge pull request 'zero-rower-events' (#931) from zero-rower-events into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m10s
CI/CD Pipeline / deploy-staging (push) Successful in 7m42s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #931
2025-04-19 00:22:27 +02:00
3baed66ebc Merge pull request 'also be able to cancel trips (not only events)' (#929) from zero-rower-events into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 13m39s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #929
2025-04-18 23:32:34 +02:00
499ce06438 Merge pull request 'zero-rower-events; Fixes #913' (#927) from zero-rower-events into staging
Some checks failed
CI/CD Pipeline / test (push) Has started running
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #927
2025-04-18 23:12:41 +02:00
67e5277c62 Merge pull request 'remove unused dep; cargo clippy' (#925) from simple-nx-auth into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m20s
CI/CD Pipeline / deploy-staging (push) Successful in 7m38s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #925
2025-04-18 17:45:44 +02:00
ce154bf060 Merge pull request 'simple-nx-auth' (#923) from simple-nx-auth into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m3s
CI/CD Pipeline / deploy-staging (push) Successful in 7m41s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #923
2025-04-18 17:10:44 +02:00
7 changed files with 73 additions and 117 deletions

View File

@@ -11,10 +11,6 @@
@apply text-white hover:text-primary-100 underline;
}
&-black {
@apply text-black hover:text-primary-950 dark:text-white hover:dark:text-primary-300 underline;
}
&-no-underline {
@apply no-underline;
}

View File

@@ -414,14 +414,12 @@ impl User {
.await
.unwrap();
if !role.hide_in_lists && role.cluster.is_none() {
ActivityBuilder::new(&format!(
"{updated_by} hat die Rolle {role} von {self} entfernt."
))
.relevant_for_user(self)
.save(db)
.await;
}
Ok(())
}
@@ -501,7 +499,7 @@ impl User {
)
})?;
if !role.hide_in_lists && role.cluster.is_none() {
if !role.hide_in_lists {
ActivityBuilder::new(&format!(
"{updated_by} hat die Rolle '{role}' dem Benutzer {self} hinzugefügt."
))

View File

@@ -1,20 +1,21 @@
use std::{fmt::Display, ops::DerefMut};
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
use argon2::{Argon2, PasswordHasher, password_hash::SaltString};
use chrono::{Datelike, Local, NaiveDate};
use log::info;
use rocket::async_trait;
use rocket::{
Request,
http::{Cookie, Status},
request::{FromRequest, Outcome},
time::{Duration, OffsetDateTime},
Request,
};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
use super::activity::ActivityBuilder;
use super::{
Day,
log::Log,
logbook::Logbook,
mail::Mail,
@@ -23,7 +24,6 @@ use super::{
role::Role,
stat::Stat,
tripdetails::TripDetails,
Day,
};
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
use scheckbuch::ScheckbuchUser;
@@ -867,8 +867,8 @@ special_user!(SteeringUser, +"cox", +"Bootsführer");
special_user!(AdminUser, +"admin");
special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förderndes Mitglied");
special_user!(DonauLinzUser, +"Donau Linz", -"Unterstützend", -"Förderndes Mitglied"); // TODO:
// remove ->
// RegularUser
// remove ->
// RegularUser
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
special_user!(VorstandUser, +"admin", +"Vorstand");
special_user!(EventUser, +"manage_events");
@@ -982,17 +982,21 @@ mod test {
#[sqlx::test]
fn wrong_pw() {
let pool = testdb!();
assert!(User::login(&pool, "admin".into(), "admi".into())
assert!(
User::login(&pool, "admin".into(), "admi".into())
.await
.is_err());
.is_err()
);
}
#[sqlx::test]
fn wrong_username() {
let pool = testdb!();
assert!(User::login(&pool, "admi".into(), "admin".into())
assert!(
User::login(&pool, "admi".into(), "admin".into())
.await
.is_err());
.is_err()
);
}
#[sqlx::test]
@@ -1011,9 +1015,11 @@ mod test {
let pool = testdb!();
let user = User::find_by_id(&pool, 1).await.unwrap();
assert!(User::login(&pool, "admin".into(), "abc".into())
assert!(
User::login(&pool, "admin".into(), "abc".into())
.await
.is_err());
.is_err()
);
user.update_pw(&pool, "abc".into()).await;

View File

@@ -7,11 +7,11 @@ use crate::{
mail::valid_mails,
role::Role,
user::{
AdminUser, AllowedToEditPaymentStatusUser, ManageUserUser, User, UserWithDetails,
UserWithMembershipPdf, UserWithRolesAndMembershipPdf, VorstandUser,
clubmember::ClubMemberUser, foerdernd::FoerderndUser, member::Member,
regular::RegularUser, scheckbuch::ScheckbuchUser, schnupperant::SchnupperantUser,
schnupperinterest::SchnupperInterestUser, unterstuetzend::UnterstuetzendUser,
AdminUser, AllowedToEditPaymentStatusUser, ManageUserUser, User, UserWithDetails,
UserWithMembershipPdf, UserWithRolesAndMembershipPdf, VorstandUser,
},
},
tera::Config,
@@ -19,6 +19,7 @@ use crate::{
use chrono::NaiveDate;
use futures::future::join_all;
use rocket::{
FromForm, Request, Route, State,
form::Form,
fs::TempFile,
get,
@@ -26,9 +27,9 @@ use rocket::{
post,
request::{FlashMessage, FromRequest, Outcome},
response::{Flash, Redirect},
routes, FromForm, Request, Route, State,
routes,
};
use rocket_dyn_templates::{tera::Context, Template};
use rocket_dyn_templates::{Template, tera::Context};
use sqlx::SqlitePool;
// Custom request guard to extract the Referer header
@@ -132,12 +133,6 @@ async fn view(
format!("User mit ID {} gibts ned", user),
));
};
if user.name == "Externe Steuerperson" {
return Err(Flash::error(
Redirect::to("/admin/user"),
"Diese besondere Person kannst du dir leider nicht anschauen, mein lieber neugieriger Ruderant!"
));
}
let member = Member::from(db, user.clone()).await;
let fee = user.fee(db).await;

View File

@@ -1,6 +1,7 @@
use std::net::IpAddr;
use rocket::{
Request, Route, State,
form::Form,
get,
http::{Cookie, CookieJar},
@@ -9,9 +10,8 @@ use rocket::{
response::{Flash, Redirect},
routes,
time::{Duration, OffsetDateTime},
Request, Route, State,
};
use rocket_dyn_templates::{context, Template};
use rocket_dyn_templates::{Template, context};
use sqlx::SqlitePool;
use tera::Context;
@@ -110,13 +110,10 @@ async fn index(
#[get("/show", rank = 3)]
async fn show(db: &State<SqlitePool>, user: DonauLinzUser) -> Template {
let logs = Logbook::completed(db).await;
let boats = Boat::all(db).await;
let users = User::all(db).await;
let logtypes = LogType::all(db).await;
Template::render(
"log.completed",
context!(logs, boats, users, logtypes, loggedin_user: &UserWithDetails::from_user(user.into_inner(), db).await),
context!(logs, loggedin_user: &UserWithDetails::from_user(user.into_inner(), db).await),
)
}
@@ -585,7 +582,7 @@ mod test {
use sqlx::SqlitePool;
use crate::model::logbook::Logbook;
use crate::tera::{log::Boat, User};
use crate::tera::{User, log::Boat};
use crate::testdb;
#[sqlx::test]

View File

@@ -7,8 +7,8 @@
<a href="/admin/user" class="link link-primary link-no-underline">&larr; Userverwaltung</a>
{% endif %}
<h1 class="h1">{{ user.name }}</h1>
<div class="grid sm:grid-cols-2 gap-8 my-8">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="grid sm:grid-cols-2 gap-3">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">
Grunddaten
<br />
@@ -53,7 +53,7 @@
</div>
</div>
</div>
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">
Mitgliedschaft
<br />
@@ -285,7 +285,7 @@
</div>
</div>
{% if is_clubmember %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">Rollen</h2>
<div>
<ul class="divide-y divide-gray-200 dark:divide-primary-60 w-full">
@@ -363,7 +363,7 @@
</div>
{% endif %}
{% if supposed_to_pay %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">💸-Beitrag</h2>
<div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3">
@@ -400,7 +400,7 @@
</div>
</div>
{% endif %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">Aktivitäten</h2>
<div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3">
@@ -414,13 +414,13 @@
</div>
</div>
</div>
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">Ergo-Challenge</h2>
<div class="mx-3">
<div class="grid gap-3 pb-3 mt-3">
{{ macros::inputgroup(label='DOB', name='dob', type="text", value=user.dob, readonly=allowed_to_edit == false) }}
{{ macros::inputgroup(label='Weight (kg)', name='weight', type="text", value=user.weight, readonly=allowed_to_edit == false) }}
{{ macros::inputgroup(label='Sex', name='sex', type="text", value=user.sex, readonly=allowed_to_edit == false) }}
<div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3">
{{ macros::input(label='DOB', name='dob', type="text", value=user.dob, readonly=allowed_to_edit == false) }}
{{ macros::input(label='Weight (kg)', name='weight', type="text", value=user.weight, readonly=allowed_to_edit == false) }}
{{ macros::input(label='Sex', name='sex', type="text", value=user.sex, readonly=allowed_to_edit == false) }}
</div>
</div>
</div>

View File

@@ -183,6 +183,8 @@
<div class="border-t bg-white dark:bg-primary-900 py-3 px-4 relative"
data-filterable="true"
data-filter="{{ log.boat.name }} {% for rower in log.rowers %}{{ rower.name }}{% endfor %}">
<details>
<summary style="list-style: none;">
{% if log.logtype and not hide_type %}
<div class="absolute top-0 right-0 bg-primary-100 rounded-bl-md text-primary-950 text-xs w-32 px-2 py-1 text-center font-bold">
{% if log.logtype == 1 %}
@@ -197,15 +199,7 @@
</div>
{% endif %}
<div {% if log.logtype %}class="mt-4 sm:mt-0"{% endif %}>
{% if allowed_to_edit %}
<a href="#"
onclick="document.getElementById('change-{{ log.id }}').showModal()"
class="link link-black font-bold">{{ log.boat.name }}</a>
{% else %}
<strong class="text-black dark:text-white">
{{ log.boat.name }}
</strong>
{% endif %}
<strong class="text-black dark:text-white">{{ log.boat.name }}</strong>
<small class="text-gray-600 dark:text-gray-100">({{ log.shipmaster_user.name -}}
{% if log.shipmaster_only_steering %}
- handgesteuert
@@ -258,65 +252,35 @@
{% endif %}
{% endif %}
</div>
</summary>
{% if allowed_to_edit %}
<dialog id="change-{{ log.id }}"
class="max-w-screen-sm w-full dark:bg-primary-900 dark:text-white rounded-md"
onclick="document.getElementById('change-{{ log.id }}').close()">
<div onclick="event.stopPropagation();" class="p-3">
<button type="button"
onclick="document.getElementById('change-{{ log.id }}').close()"
title="Schließen"
class="sidebar-close border-0 bg-primary-100 focus:bg-primary-50 text-black flex items-center justify-center transform rotate-45 absolute right-0 mr-3">
<svg class="inline h-5 w-5"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16">
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</svg>
</button>
<div class="mt-8">
<h2 class="h3">Eintrag '{{ log.boat.name }}' ändern </h2>
<p class="text-center mb-3">ID: {{ log.id }}</p>
<form action="/log/update" method="post" class="grid gap-3">
<form action="/log/update" method="post">
<input type="hidden" name="id" value="{{ log.id }}" />
<input type="hidden" name="boat_id" value="{{ log.boat_id }}" />
<input type="hidden" name="shipmaster" value="{{ log.shipmaster }}" />
<input type="hidden"
name="steering_person"
value="{{ log.steering_person }}" />
{{ macros::select(label="Boot", data=boats, name="boat_id", id="boat_id{{ log.id }}", selected_id=log.boat.id ,display=["name", " (","amount_seats", " x)"]) }}
{{ macros::select(label="Schiffsführer", data=log.rowers, name="shipmaster", id="shipmaster{{ log.id }}", selected_id=log.shipmaster_user.id) }}
{{ macros::checkbox(label='Handgesteuert', name='shipmaster_only_steering', id=log.shipmaster_only_steering,checked=log.shipmaster_only_steering) }}
<div>
<label for="departure" class=" text-sm text-gray-600 dark:text-white ">
Abfahrt
</label>
<input type="datetime-local" class="input rounded-md" name="departure" value="{{ log.departure }}" />
</div>
<div>
<label for="arrival" class=" text-sm text-gray-600 dark:text-white ">
Ankunft
</label>
<input type="datetime-local" class="input rounded-md" name="arrival" value="{{ log.arrival }}" />
</div>
Handgesteuert:
<input type="checkbox"
name="shipmaster_only_steering"
{% if log.shipmaster_only_steering %}checked="checked"{% endif %} />
<input type="datetime-local" name="departure" value="{{ log.departure }}" />
<input type="datetime-local" name="arrival" value="{{ log.arrival }}" />
<input type="hidden" name="destination" value="{{ log.destination }}" />
<input type="hidden" name="distance_in_km" value="{{ log.distance_in_km }}" />
<input type="hidden" name="comments" value="{{ log.comments }}" />
<input type="hidden" name="logtype" value="{{ log.logtype }}" />
<input type="submit" class="btn btn-primary" value="Updaten" />
<input type="submit" value="Updaten" />
</form>
<a href="/log/{{ log.id }}/delete"
class="w-28 btn btn-alert mt-3"
class="w-28 btn btn-alert"
onclick="return confirm('Willst du diesen Logbucheintrag wirklich löschen?');">
{% include "includes/delete-icon" %}
Löschen
</a>
</div>
</div>
</dialog>
{% endif %}
</details>
</div>
{% endmacro show_old %}
{% macro home(log) %}