fix: allow users with correct permissions to manage community
This commit is contained in:
parent
c0a4bb3159
commit
0bef301deb
1 changed files with 3 additions and 3 deletions
|
@ -8,11 +8,11 @@ use axum::{
|
||||||
use axum_extra::extract::CookieJar;
|
use axum_extra::extract::CookieJar;
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
use tetratto_core::model::{
|
use tetratto_core::model::{
|
||||||
Error,
|
|
||||||
auth::User,
|
auth::User,
|
||||||
communities::{Community, CommunityReadAccess},
|
communities::{Community, CommunityMembership, CommunityReadAccess},
|
||||||
communities_permissions::CommunityPermission,
|
communities_permissions::CommunityPermission,
|
||||||
permissions::FinePermission,
|
permissions::FinePermission,
|
||||||
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
macro_rules! check_permissions {
|
macro_rules! check_permissions {
|
||||||
|
@ -304,7 +304,7 @@ pub async fn settings_request(
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
Err(_) => CommunityMembership::new(user.id, community.id, CommunityPermission::DEFAULT),
|
||||||
};
|
};
|
||||||
|
|
||||||
if user.id != community.owner
|
if user.id != community.owner
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue