mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
store: prevent objects from being commited to subscription calendar
This commit is contained in:
@@ -353,7 +353,6 @@ impl SqliteCalendarStore {
|
|||||||
object: CalendarObject,
|
object: CalendarObject,
|
||||||
overwrite: bool,
|
overwrite: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
// TODO: Prevent objects from being commited to a subscription calendar
|
|
||||||
let (object_id, ics) = (object.get_id(), object.get_ics());
|
let (object_id, ics) = (object.get_id(), object.get_ics());
|
||||||
|
|
||||||
let first_occurence = object
|
let first_occurence = object
|
||||||
@@ -669,11 +668,16 @@ impl CalendarStore for SqliteCalendarStore {
|
|||||||
object: CalendarObject,
|
object: CalendarObject,
|
||||||
overwrite: bool,
|
overwrite: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
// TODO: Prevent objects from being commited to a subscription calendar
|
|
||||||
let mut tx = self.db.begin().await.map_err(crate::Error::from)?;
|
let mut tx = self.db.begin().await.map_err(crate::Error::from)?;
|
||||||
|
|
||||||
let object_id = object.get_id().to_owned();
|
let object_id = object.get_id().to_owned();
|
||||||
|
|
||||||
|
let calendar = Self::_get_calendar(&mut *tx, &principal, &cal_id, true).await?;
|
||||||
|
if calendar.subscription_url.is_some() {
|
||||||
|
// We cannot commit an object to a subscription calendar
|
||||||
|
return Err(Error::ReadOnly);
|
||||||
|
}
|
||||||
|
|
||||||
Self::_put_object(
|
Self::_put_object(
|
||||||
&mut *tx,
|
&mut *tx,
|
||||||
principal.to_owned(),
|
principal.to_owned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user