progress
This commit is contained in:
@@ -32,6 +32,13 @@ func NewMemBackend(cfg *config.Config) *MemBackend {
|
||||
calendarAccess: make(map[string]map[string]string),
|
||||
}
|
||||
|
||||
groupMembers := make(map[string][]string)
|
||||
for _, u := range cfg.Users {
|
||||
for _, g := range u.Groups {
|
||||
groupMembers[g] = append(groupMembers[g], u.Name)
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range cfg.Calendars {
|
||||
path := fmt.Sprintf("/%s/calendars/%s/", c.Owner, c.ID)
|
||||
cal := &caldav.Calendar{
|
||||
@@ -45,8 +52,22 @@ func NewMemBackend(cfg *config.Config) *MemBackend {
|
||||
|
||||
accessMap := make(map[string]string)
|
||||
for _, a := range c.Access {
|
||||
accessMap[a.User] = a.Mode
|
||||
b.userCalendars[a.User] = append(b.userCalendars[a.User], path)
|
||||
var tUsers []string
|
||||
if a.User != "" {
|
||||
tUsers = append(tUsers, a.User)
|
||||
}
|
||||
if a.Group != "" {
|
||||
tUsers = append(tUsers, groupMembers[a.Group]...)
|
||||
}
|
||||
if a.Groups != "" {
|
||||
tUsers = append(tUsers, groupMembers[a.Groups]...)
|
||||
}
|
||||
for _, u := range tUsers {
|
||||
if _, exists := accessMap[u]; !exists {
|
||||
b.userCalendars[u] = append(b.userCalendars[u], path)
|
||||
}
|
||||
accessMap[u] = a.Mode
|
||||
}
|
||||
}
|
||||
b.calendarAccess[path] = accessMap
|
||||
}
|
||||
@@ -121,7 +142,7 @@ func (b *MemBackend) filterCalendar(ctx context.Context, calendarPath string, or
|
||||
continue
|
||||
}
|
||||
|
||||
class := "PUBLIC"
|
||||
class := "CONFIDENTIAL"
|
||||
if prop := child.Props.Get("CLASS"); prop != nil {
|
||||
class = strings.ToUpper(prop.Value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user