Skip to content

Commit a0c29af

Browse files
authored
Merge pull request #23 from linuxfoundation/andrest/past-meeting-artifacts
[LFXV2-631] Store past meeting artifacts as independent objects
2 parents cf4e6f5 + 8bf13cf commit a0c29af

File tree

6 files changed

+108
-13
lines changed

6 files changed

+108
-13
lines changed

charts/lfx-v2-indexer-service/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ apiVersion: v2
66
name: lfx-v2-indexer-service
77
description: LFX Platform V2 Indexer Service chart
88
type: application
9-
version: 0.4.4
9+
version: 0.4.5
1010
appVersion: "latest"

internal/domain/services/indexer_service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func NewIndexerService(
8686
enrichers.NewPastMeetingEnricher(),
8787
enrichers.NewPastMeetingParticipantEnricher(),
8888
enrichers.NewPastMeetingRecordingEnricher(),
89+
enrichers.NewPastMeetingTranscriptEnricher(),
8990
enrichers.NewPastMeetingSummaryEnricher(),
9091
enrichers.NewGroupsIOServiceEnricher(),
9192
enrichers.NewGroupsIOMailingListEnricher(),

internal/enrichers/past_meeting_recording_enricher.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ func (e *PastMeetingRecordingEnricher) EnrichData(body *contracts.TransactionBod
2828

2929
// setAccessControl provides past meeting recording-specific access control logic
3030
func (e *PastMeetingRecordingEnricher) setAccessControl(body *contracts.TransactionBody, data map[string]any, objectType, objectID string) {
31-
pastMeetingLevelPermission := func(data map[string]any) string {
32-
if value, ok := data["past_meeting_uid"]; ok {
33-
if pastMeetingUID, ok := value.(string); ok {
34-
return fmt.Sprintf("%s:%s", constants.ObjectTypePastMeeting, pastMeetingUID)
31+
pastMeetingRecordingLevelPermission := func(data map[string]any) string {
32+
if value, ok := data["past_meeting_recording_uid"]; ok {
33+
if pastMeetingRecordingUID, ok := value.(string); ok {
34+
return fmt.Sprintf("%s:%s", constants.ObjectTypePastMeetingRecording, pastMeetingRecordingUID)
3535
}
3636
}
3737
return fmt.Sprintf("%s:%s", objectType, objectID)
@@ -46,7 +46,7 @@ func (e *PastMeetingRecordingEnricher) setAccessControl(body *contracts.Transact
4646
if accessCheckObject, ok := data["accessCheckObject"].(string); ok {
4747
accessObject = accessCheckObject
4848
} else if _, exists := data["accessCheckObject"]; !exists {
49-
accessObject = pastMeetingLevelPermission(data)
49+
accessObject = pastMeetingRecordingLevelPermission(data)
5050
}
5151

5252
if accessCheckRelation, ok := data["accessCheckRelation"].(string); ok {
@@ -58,7 +58,7 @@ func (e *PastMeetingRecordingEnricher) setAccessControl(body *contracts.Transact
5858
if historyCheckObject, ok := data["historyCheckObject"].(string); ok {
5959
historyObject = historyCheckObject
6060
} else if _, exists := data["historyCheckObject"]; !exists {
61-
historyObject = pastMeetingLevelPermission(data)
61+
historyObject = pastMeetingRecordingLevelPermission(data)
6262
}
6363

6464
if historyCheckRelation, ok := data["historyCheckRelation"].(string); ok {

internal/enrichers/past_meeting_summary_enricher.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ func (e *PastMeetingSummaryEnricher) EnrichData(body *contracts.TransactionBody,
2828

2929
// setAccessControl provides past meeting summary-specific access control logic
3030
func (e *PastMeetingSummaryEnricher) setAccessControl(body *contracts.TransactionBody, data map[string]any, objectType, objectID string) {
31-
pastMeetingLevelPermission := func(data map[string]any) string {
32-
if value, ok := data["past_meeting_uid"]; ok {
33-
if pastMeetingUID, ok := value.(string); ok {
34-
return fmt.Sprintf("%s:%s", constants.ObjectTypePastMeeting, pastMeetingUID)
31+
pastMeetingSummaryLevelPermission := func(data map[string]any) string {
32+
if value, ok := data["past_meeting_summary_uid"]; ok {
33+
if pastMeetingSummaryUID, ok := value.(string); ok {
34+
return fmt.Sprintf("%s:%s", constants.ObjectTypePastMeetingSummary, pastMeetingSummaryUID)
3535
}
3636
}
3737
return fmt.Sprintf("%s:%s", objectType, objectID)
@@ -46,7 +46,7 @@ func (e *PastMeetingSummaryEnricher) setAccessControl(body *contracts.Transactio
4646
if accessCheckObject, ok := data["accessCheckObject"].(string); ok {
4747
accessObject = accessCheckObject
4848
} else if _, exists := data["accessCheckObject"]; !exists {
49-
accessObject = pastMeetingLevelPermission(data)
49+
accessObject = pastMeetingSummaryLevelPermission(data)
5050
}
5151

5252
if accessCheckRelation, ok := data["accessCheckRelation"].(string); ok {
@@ -58,7 +58,7 @@ func (e *PastMeetingSummaryEnricher) setAccessControl(body *contracts.Transactio
5858
if historyCheckObject, ok := data["historyCheckObject"].(string); ok {
5959
historyObject = historyCheckObject
6060
} else if _, exists := data["historyCheckObject"]; !exists {
61-
historyObject = pastMeetingLevelPermission(data)
61+
historyObject = pastMeetingSummaryLevelPermission(data)
6262
}
6363

6464
if historyCheckRelation, ok := data["historyCheckRelation"].(string); ok {
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright The Linux Foundation and each contributor to LFX.
2+
// SPDX-License-Identifier: MIT
3+
4+
// Package enrichers provides data enrichment functionality for different object types.
5+
package enrichers
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/linuxfoundation/lfx-v2-indexer-service/internal/domain/contracts"
11+
"github.com/linuxfoundation/lfx-v2-indexer-service/pkg/constants"
12+
)
13+
14+
// PastMeetingTranscriptEnricher handles past meeting transcript-specific enrichment logic
15+
type PastMeetingTranscriptEnricher struct {
16+
defaultEnricher Enricher
17+
}
18+
19+
// ObjectType returns the object type this enricher handles.
20+
func (e *PastMeetingTranscriptEnricher) ObjectType() string {
21+
return e.defaultEnricher.ObjectType()
22+
}
23+
24+
// EnrichData enriches past meeting transcript-specific data
25+
func (e *PastMeetingTranscriptEnricher) EnrichData(body *contracts.TransactionBody, transaction *contracts.LFXTransaction) error {
26+
return e.defaultEnricher.EnrichData(body, transaction)
27+
}
28+
29+
// setAccessControl provides past meeting transcript-specific access control logic
30+
func (e *PastMeetingTranscriptEnricher) setAccessControl(body *contracts.TransactionBody, data map[string]any, objectType, objectID string) {
31+
pastMeetingTranscriptLevelPermission := func(data map[string]any) string {
32+
if value, ok := data["past_meeting_transcript_uid"]; ok {
33+
if pastMeetingTranscriptUID, ok := value.(string); ok {
34+
return fmt.Sprintf("%s:%s", constants.ObjectTypePastMeetingTranscript, pastMeetingTranscriptUID)
35+
}
36+
}
37+
return fmt.Sprintf("%s:%s", objectType, objectID)
38+
}
39+
40+
// Build access control values
41+
var accessObject, accessRelation string
42+
var historyObject, historyRelation string
43+
44+
// Set access control with past meeting transcript-specific logic
45+
// Only apply defaults when fields are completely missing from data
46+
if accessCheckObject, ok := data["accessCheckObject"].(string); ok {
47+
accessObject = accessCheckObject
48+
} else if _, exists := data["accessCheckObject"]; !exists {
49+
accessObject = pastMeetingTranscriptLevelPermission(data)
50+
}
51+
52+
if accessCheckRelation, ok := data["accessCheckRelation"].(string); ok {
53+
accessRelation = accessCheckRelation
54+
} else if _, exists := data["accessCheckRelation"]; !exists {
55+
accessRelation = "viewer"
56+
}
57+
58+
if historyCheckObject, ok := data["historyCheckObject"].(string); ok {
59+
historyObject = historyCheckObject
60+
} else if _, exists := data["historyCheckObject"]; !exists {
61+
historyObject = pastMeetingTranscriptLevelPermission(data)
62+
}
63+
64+
if historyCheckRelation, ok := data["historyCheckRelation"].(string); ok {
65+
historyRelation = historyCheckRelation
66+
} else if _, exists := data["historyCheckRelation"]; !exists {
67+
historyRelation = "writer"
68+
}
69+
70+
// Assign to body fields (deprecated fields)
71+
body.AccessCheckObject = accessObject
72+
body.AccessCheckRelation = accessRelation
73+
body.HistoryCheckObject = historyObject
74+
body.HistoryCheckRelation = historyRelation
75+
76+
// Build and assign the query strings
77+
if accessObject != "" && accessRelation != "" {
78+
body.AccessCheckQuery = contracts.JoinFgaQuery(accessObject, accessRelation)
79+
}
80+
if historyObject != "" && historyRelation != "" {
81+
body.HistoryCheckQuery = contracts.JoinFgaQuery(historyObject, historyRelation)
82+
}
83+
}
84+
85+
// NewPastMeetingTranscriptEnricher creates a new past meeting transcript enricher
86+
func NewPastMeetingTranscriptEnricher() Enricher {
87+
enricher := &PastMeetingTranscriptEnricher{}
88+
enricher.defaultEnricher = newDefaultEnricher(
89+
constants.ObjectTypePastMeetingTranscript,
90+
WithAccessControl(enricher.setAccessControl),
91+
)
92+
return enricher
93+
}

pkg/constants/messaging.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const (
5353
ObjectTypePastMeeting = "past_meeting"
5454
ObjectTypePastMeetingParticipant = "past_meeting_participant"
5555
ObjectTypePastMeetingRecording = "past_meeting_recording"
56+
ObjectTypePastMeetingTranscript = "past_meeting_transcript"
5657
ObjectTypePastMeetingSummary = "past_meeting_summary"
5758
ObjectTypeGroupsIOService = "groupsio_service"
5859
ObjectTypeGroupsIOMailingList = "groupsio_mailing_list"

0 commit comments

Comments
 (0)