progress
This commit is contained in:
12
README.md
12
README.md
@@ -21,5 +21,15 @@ DELETE FROM users WHERE name = 'bob';
|
|||||||
```sql
|
```sql
|
||||||
DELETE FROM calendars WHERE name = 'bob_calendar' AND owner_id = (SELECT id FROM users WHERE name = 'bob');
|
DELETE FROM calendars WHERE name = 'bob_calendar' AND owner_id = (SELECT id FROM users WHERE name = 'bob');
|
||||||
/* or */
|
/* 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:
|
server:
|
||||||
bind_address: "0.0.0.0:8080"
|
bind_address: "0.0.0.0:8080"
|
||||||
public_url: "http://localhost:8080"
|
public_url: "http://localhost:8080"
|
||||||
redaction_text: "[REDACED]"
|
redaction_text: "[-]"
|
||||||
default_class: "CONFIDENTIAL"
|
default_class: "CONFIDENTIAL"
|
||||||
|
|
||||||
database:
|
database:
|
||||||
@@ -42,9 +42,7 @@ users:
|
|||||||
password: "123"
|
password: "123"
|
||||||
|
|
||||||
calendars:
|
calendars:
|
||||||
- id: "school"
|
- id: "default"
|
||||||
owner: "lennart"
|
|
||||||
- id: "sport"
|
|
||||||
owner: "lennart"
|
owner: "lennart"
|
||||||
- id: "family"
|
- id: "family"
|
||||||
owner: "shared"
|
owner: "shared"
|
||||||
@@ -58,9 +56,9 @@ calendars:
|
|||||||
mode: "read-write"
|
mode: "read-write"
|
||||||
|
|
||||||
aggregates:
|
aggregates:
|
||||||
- id: "lennart"
|
- id: "lennart_aggregate"
|
||||||
owner: "lennart"
|
owner: "lennart"
|
||||||
sources: ["school", "sport"]
|
sources: ["default", "family"]
|
||||||
access:
|
access:
|
||||||
- group: "family"
|
- group: "family"
|
||||||
mode: "read-only"
|
mode: "read-only"
|
||||||
|
|||||||
@@ -407,10 +407,8 @@ func (b *DBBackend) filterCalendar(ctx context.Context, ownerName string, origin
|
|||||||
}
|
}
|
||||||
|
|
||||||
class := b.defaultClass;
|
class := b.defaultClass;
|
||||||
log.Printf("class: %s",class)
|
|
||||||
if prop := child.Props.Get("CLASS"); prop != nil {
|
if prop := child.Props.Get("CLASS"); prop != nil {
|
||||||
class = strings.ToUpper(prop.Value)
|
class = strings.ToUpper(prop.Value)
|
||||||
log.Printf("class: %s",class)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch class {
|
switch class {
|
||||||
@@ -432,7 +430,6 @@ func (b *DBBackend) filterCalendar(ctx context.Context, ownerName string, origin
|
|||||||
redacted.Props.SetText("SUMMARY", b.redactionText)
|
redacted.Props.SetText("SUMMARY", b.redactionText)
|
||||||
filtered.Children = append(filtered.Children, redacted)
|
filtered.Children = append(filtered.Children, redacted)
|
||||||
case "PUBLIC":
|
case "PUBLIC":
|
||||||
log.Printf("pub: %s", child.Name);
|
|
||||||
filtered.Children = append(filtered.Children, child)
|
filtered.Children = append(filtered.Children, child)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -527,7 +524,7 @@ func (b *DBBackend) GetCalendar(ctx context.Context, p string) (*caldav.Calendar
|
|||||||
return &cal, nil
|
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 {
|
func (b *DBBackend) CreateCalendar(ctx context.Context, calendar *caldav.Calendar) error {
|
||||||
return webdav.NewHTTPError(http.StatusForbidden, errors.New("calendar creation only via config"))
|
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
|
// Re-apply labels for the virtual view
|
||||||
for _, child := range filteredData.Children {
|
for _, child := range filteredData.Children {
|
||||||
if child.Name == "VEVENT" || child.Name == "VTODO" {
|
if child.Name == "VEVENT" || child.Name == "VTODO" {
|
||||||
summary := child.Props.Get("SUMMARY")
|
descr := child.Props.Get("DESCRIPTION")
|
||||||
val := ""
|
val := ""
|
||||||
if summary != nil {
|
if descr != nil {
|
||||||
val = summary.Value
|
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
|
obj.Data = filteredData
|
||||||
|
|||||||
Reference in New Issue
Block a user