progress
This commit is contained in:
12
README.md
12
README.md
@@ -21,5 +21,15 @@ DELETE FROM users WHERE name = 'bob';
|
||||
```sql
|
||||
DELETE FROM calendars WHERE name = 'bob_calendar' AND owner_id = (SELECT id FROM users WHERE name = 'bob');
|
||||
/* or */
|
||||
DELETE FROM calendars WHERE path = '/bob/calendars/bob_calendar/';
|
||||
DELETE FROM calendars WHERE ;
|
||||
```
|
||||
## rename calendar
|
||||
```sql
|
||||
UPDATE calendars SET name = 'new', path '/bob/calendars/new/' WHERE path = '/bob/calendars/old/';
|
||||
UPDATE calendar_objects SET path = regexp_replace(path, '/old/', '/new/')' WHERE your_column ~ '/sport/';
|
||||
```
|
||||
|
||||
## Match Value in calendar objects
|
||||
```sql
|
||||
select id, path, linecut from calendar_objects, LATERAL regexp_split_to_table(data, E'\r\n') AS linecut where linecut ~ 'CLASS';
|
||||
```
|
||||
|
||||
10
config.yaml
10
config.yaml
@@ -1,7 +1,7 @@
|
||||
server:
|
||||
bind_address: "0.0.0.0:8080"
|
||||
public_url: "http://localhost:8080"
|
||||
redaction_text: "[REDACED]"
|
||||
redaction_text: "[-]"
|
||||
default_class: "CONFIDENTIAL"
|
||||
|
||||
database:
|
||||
@@ -42,9 +42,7 @@ users:
|
||||
password: "123"
|
||||
|
||||
calendars:
|
||||
- id: "school"
|
||||
owner: "lennart"
|
||||
- id: "sport"
|
||||
- id: "default"
|
||||
owner: "lennart"
|
||||
- id: "family"
|
||||
owner: "shared"
|
||||
@@ -58,9 +56,9 @@ calendars:
|
||||
mode: "read-write"
|
||||
|
||||
aggregates:
|
||||
- id: "lennart"
|
||||
- id: "lennart_aggregate"
|
||||
owner: "lennart"
|
||||
sources: ["school", "sport"]
|
||||
sources: ["default", "family"]
|
||||
access:
|
||||
- group: "family"
|
||||
mode: "read-only"
|
||||
|
||||
@@ -407,10 +407,8 @@ func (b *DBBackend) filterCalendar(ctx context.Context, ownerName string, origin
|
||||
}
|
||||
|
||||
class := b.defaultClass;
|
||||
log.Printf("class: %s",class)
|
||||
if prop := child.Props.Get("CLASS"); prop != nil {
|
||||
class = strings.ToUpper(prop.Value)
|
||||
log.Printf("class: %s",class)
|
||||
}
|
||||
|
||||
switch class {
|
||||
@@ -432,7 +430,6 @@ func (b *DBBackend) filterCalendar(ctx context.Context, ownerName string, origin
|
||||
redacted.Props.SetText("SUMMARY", b.redactionText)
|
||||
filtered.Children = append(filtered.Children, redacted)
|
||||
case "PUBLIC":
|
||||
log.Printf("pub: %s", child.Name);
|
||||
filtered.Children = append(filtered.Children, child)
|
||||
}
|
||||
}
|
||||
@@ -527,7 +524,7 @@ func (b *DBBackend) GetCalendar(ctx context.Context, p string) (*caldav.Calendar
|
||||
return &cal, nil
|
||||
}
|
||||
|
||||
// CreateCalendar is disabled because we manage calendars via config.yaml.
|
||||
// CreateCalendar is disabled because calendars are managed via the config
|
||||
func (b *DBBackend) CreateCalendar(ctx context.Context, calendar *caldav.Calendar) error {
|
||||
return webdav.NewHTTPError(http.StatusForbidden, errors.New("calendar creation only via config"))
|
||||
}
|
||||
@@ -713,12 +710,12 @@ func (b *DBBackend) GetCalendarObject(ctx context.Context, p string, req *caldav
|
||||
// Re-apply labels for the virtual view
|
||||
for _, child := range filteredData.Children {
|
||||
if child.Name == "VEVENT" || child.Name == "VTODO" {
|
||||
summary := child.Props.Get("SUMMARY")
|
||||
descr := child.Props.Get("DESCRIPTION")
|
||||
val := ""
|
||||
if summary != nil {
|
||||
val = summary.Value
|
||||
if descr != nil {
|
||||
val = descr.Value
|
||||
}
|
||||
child.Props.SetText("SUMMARY", fmt.Sprintf("[%s] %s", sourceID, val))
|
||||
child.Props.SetText("DESCRIPTION", fmt.Sprintf("[%s]\n%s", sourceID, val))
|
||||
}
|
||||
}
|
||||
obj.Data = filteredData
|
||||
|
||||
Reference in New Issue
Block a user