mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
event check authorization
This commit is contained in:
@@ -12,9 +12,12 @@ pub async fn delete_event<A: CheckAuthentication, C: CalendarStore + ?Sized>(
|
|||||||
auth: AuthInfoExtractor<A>,
|
auth: AuthInfoExtractor<A>,
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let _user = auth.inner.user_id;
|
|
||||||
// TODO: verify whether user is authorized
|
|
||||||
let (principal, mut cid, uid) = path.into_inner();
|
let (principal, mut cid, uid) = path.into_inner();
|
||||||
|
|
||||||
|
if auth.inner.user_id != principal {
|
||||||
|
return Ok(HttpResponse::Unauthorized().body(""));
|
||||||
|
}
|
||||||
|
|
||||||
if cid.ends_with(".ics") {
|
if cid.ends_with(".ics") {
|
||||||
cid.truncate(cid.len() - 4);
|
cid.truncate(cid.len() - 4);
|
||||||
}
|
}
|
||||||
@@ -39,7 +42,6 @@ pub async fn get_event<A: CheckAuthentication, C: CalendarStore + ?Sized>(
|
|||||||
path: Path<(String, String, String)>,
|
path: Path<(String, String, String)>,
|
||||||
auth: AuthInfoExtractor<A>,
|
auth: AuthInfoExtractor<A>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
// TODO: verify whether user is authorized
|
|
||||||
let (principal, cid, mut uid) = path.into_inner();
|
let (principal, cid, mut uid) = path.into_inner();
|
||||||
|
|
||||||
if auth.inner.user_id != principal {
|
if auth.inner.user_id != principal {
|
||||||
|
|||||||
Reference in New Issue
Block a user