add-ergo-role #1143
@@ -860,6 +860,7 @@ special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förde
|
|||||||
special_user!(DonauLinzUser, +"Donau Linz", +"Förderndes Mitglied", -"Unterstützend"); // TODO:
|
special_user!(DonauLinzUser, +"Donau Linz", +"Förderndes Mitglied", -"Unterstützend"); // TODO:
|
||||||
// remove ->
|
// remove ->
|
||||||
// RegularUser
|
// RegularUser
|
||||||
|
special_user!(ErgoAdminUser, +"ergo-admin", +"admin");
|
||||||
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
|
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
|
||||||
special_user!(VorstandUser, +"admin", +"Vorstand");
|
special_user!(VorstandUser, +"admin", +"Vorstand");
|
||||||
special_user!(EventUser, +"manage_events");
|
special_user!(EventUser, +"manage_events");
|
||||||
|
@@ -2,7 +2,6 @@ use std::env;
|
|||||||
|
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use rocket::{
|
use rocket::{
|
||||||
FromForm, Route, State,
|
|
||||||
form::Form,
|
form::Form,
|
||||||
fs::TempFile,
|
fs::TempFile,
|
||||||
get,
|
get,
|
||||||
@@ -10,9 +9,9 @@ use rocket::{
|
|||||||
post,
|
post,
|
||||||
request::FlashMessage,
|
request::FlashMessage,
|
||||||
response::{Flash, Redirect},
|
response::{Flash, Redirect},
|
||||||
routes,
|
routes, FromForm, Route, State,
|
||||||
};
|
};
|
||||||
use rocket_dyn_templates::{Template, context};
|
use rocket_dyn_templates::{context, Template};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
@@ -21,7 +20,7 @@ use crate::model::{
|
|||||||
log::Log,
|
log::Log,
|
||||||
notification::Notification,
|
notification::Notification,
|
||||||
role::Role,
|
role::Role,
|
||||||
user::{AdminUser, User, UserWithDetails},
|
user::{AdminUser, ErgoAdminUser, User, UserWithDetails},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -59,7 +58,7 @@ async fn send(db: &State<SqlitePool>, _user: AdminUser) -> Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("/reset")]
|
#[get("/reset")]
|
||||||
async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
|
async fn reset(db: &State<SqlitePool>, _user: ErgoAdminUser) -> Flash<Redirect> {
|
||||||
sqlx::query!("UPDATE user SET dirty_thirty = NULL, dirty_dozen = NULL;")
|
sqlx::query!("UPDATE user SET dirty_thirty = NULL, dirty_dozen = NULL;")
|
||||||
.execute(db.inner())
|
.execute(db.inner())
|
||||||
.await
|
.await
|
||||||
@@ -74,7 +73,7 @@ async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
|
|||||||
#[get("/<challenge>/user/<user_id>/new?<new>")]
|
#[get("/<challenge>/user/<user_id>/new?<new>")]
|
||||||
async fn update(
|
async fn update(
|
||||||
db: &State<SqlitePool>,
|
db: &State<SqlitePool>,
|
||||||
_admin: AdminUser,
|
_admin: ErgoAdminUser,
|
||||||
challenge: &str,
|
challenge: &str,
|
||||||
user_id: i64,
|
user_id: i64,
|
||||||
new: &str,
|
new: &str,
|
||||||
|
@@ -65,7 +65,7 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
|
|||||||
|
|
||||||
let date = chrono::Utc::now();
|
let date = chrono::Utc::now();
|
||||||
if date.month() <= 3 || date.month() >= 10 {
|
if date.month() <= 3 || date.month() >= 10 {
|
||||||
// context.insert("show_quick_ergo_button", "yes");
|
context.insert("show_quick_ergo_button", "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.insert("achievements", &Achievements::for_user(db, &user).await);
|
context.insert("achievements", &Achievements::for_user(db, &user).await);
|
||||||
|
@@ -15,10 +15,7 @@
|
|||||||
class="link-primary">Überblick der Challenges</a>
|
class="link-primary">Überblick der Challenges</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="py-1">
|
<li class="py-1">
|
||||||
Eintragung ist jederzeit möglich, alle Daten die bis Sonntag 23:59 hier hochgeladen wurden, werden gesammelt an die Ister Ergo Challenge geschickt
|
Eintragung ist jederzeit möglich, wenn du sie auch an die offizielle Liste schicken willst, kannst du das <a href="https://data.ergochallenge.at/" target="_blank" style="text-decoration: underline">hier</a> machen
|
||||||
<li class="py-1">
|
|
||||||
Montag → gemeinsames Training; bitte um <a href="/planned" class="link-primary">Anmeldung</a>, damit jeder einen Ergo hat
|
|
||||||
</li>
|
|
||||||
<li class="py-1">
|
<li class="py-1">
|
||||||
<a href="https://data.ergochallenge.at"
|
<a href="https://data.ergochallenge.at"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@@ -194,7 +191,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
{% if "admin" in loggedin_user.roles %}
|
{% if "admin" in loggedin_user.roles or "ergo-admin" in loggedin_user.roles %}
|
||||||
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow grid gap-3">
|
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow grid gap-3">
|
||||||
<h2 class="h2">Update</h2>
|
<h2 class="h2">Update</h2>
|
||||||
<details class="p-2">
|
<details class="p-2">
|
||||||
@@ -233,6 +230,14 @@
|
|||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
<div class="mt-3 text-right">
|
||||||
|
<a href="/ergo/reset"
|
||||||
|
class="w-28 btn btn-alert"
|
||||||
|
onclick="return confirm('Willst du wirklich alle Ergo-Eingaben löschen?');">
|
||||||
|
{% include "includes/delete-icon" %}
|
||||||
|
Einträge löschen
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user