spacing again #269
@ -472,7 +472,7 @@ ORDER BY departure DESC
|
||||
mut log: LogToFinalize,
|
||||
) -> Result<(), LogbookUpdateError> {
|
||||
//TODO: extract common tests with `create()`
|
||||
if user.id != self.shipmaster {
|
||||
if !user.has_role_tx(db, "Vorstand").await && user.id != self.shipmaster {
|
||||
return Err(LogbookUpdateError::NotYourEntry);
|
||||
}
|
||||
|
||||
@ -549,7 +549,10 @@ ORDER BY departure DESC
|
||||
pub async fn delete(&self, db: &SqlitePool, user: &User) -> Result<(), LogbookDeleteError> {
|
||||
Log::create(db, format!("{user:?} deleted trip: {self:?}")).await;
|
||||
|
||||
if user.has_role(db, "admin").await || user.id == self.shipmaster {
|
||||
if user.has_role(db, "admin").await
|
||||
|| user.has_role(db, "Vorstand").await
|
||||
|| user.id == self.shipmaster
|
||||
{
|
||||
sqlx::query!("DELETE FROM logbook WHERE id=?", self.id)
|
||||
.execute(db)
|
||||
.await
|
||||
|
@ -137,9 +137,11 @@
|
||||
{{ rower.name }}
|
||||
{% if rower.id == log.shipmaster or rower.id == log.steering_person %}
|
||||
<small class="text-gray-600 dark:text-primary-100">(
|
||||
{%- if rower.id == log.shipmaster %}Schiffsführer{% endif -%}
|
||||
{% if rower.id == log.shipmaster and rower.id == log.steering_person %} / {% endif %}
|
||||
{%- if rower.id == log.steering_person %}Steuerperson{% endif -%}
|
||||
{%- if rower.id == log.shipmaster %}Schiffsführer
|
||||
{% endif -%}
|
||||
{% if rower.id == log.shipmaster and rower.id == log.steering_person %}/{% endif %}
|
||||
{%- if rower.id == log.steering_person %}Steuerperson
|
||||
{% endif -%}
|
||||
)</small>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
@ -19,6 +19,8 @@
|
||||
{% for log in on_water %}
|
||||
{% if log.shipmaster == loggedin_user.id %}
|
||||
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
|
||||
{% elif "Vorstand" in loggedin_user.roles %}
|
||||
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
|
||||
{% else %}
|
||||
{{ log::show(log=log, state="on_water", only_ones=true) }}
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user