-
Notifications
You must be signed in to change notification settings - Fork 20
/
speaker.go
35 lines (28 loc) · 885 Bytes
/
speaker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package collection
import (
"context"
"fmt"
"github.com/OpenSlides/openslides-autoupdate-service/internal/restrict/perm"
"github.com/OpenSlides/openslides-autoupdate-service/pkg/datastore"
)
// Speaker handels restrictions of the collection speaker.
type Speaker struct{}
// Modes returns the restrictions modes for the meeting collection.
func (s Speaker) Modes(mode string) FieldRestricter {
switch mode {
case "A":
return s.see
}
return nil
}
func (s Speaker) see(ctx context.Context, ds *datastore.Request, mperms *perm.MeetingPermission, speakerID int) (bool, error) {
los, err := ds.Speaker_ListOfSpeakersID(speakerID).Value(ctx)
if err != nil {
return false, fmt.Errorf("fetch los: %w", err)
}
see, err := ListOfSpeakers{}.see(ctx, ds, mperms, los)
if err != nil {
return false, fmt.Errorf("checking see of los %d: %w", los, err)
}
return see, nil
}