Skip to content

Commit c0d0e44

Browse files
authored
Merge pull request #30 from linuxfoundation/tbramwell/LFXV2-1555-fix-vote-response-fga-tuples
[LFXV2-1555] fix: align vote_response FGA tuples with model
2 parents 8bdb9ec + bed73cd commit c0d0e44

4 files changed

Lines changed: 7 additions & 13 deletions

File tree

docs/api-contracts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ x-scope: manage:voting
11571157

11581158
**Endpoint**: `POST /vote_responses/{vote_response_uid}/resend`
11591159

1160-
**Required permission**: `writer` on `vote:{vote_response_uid}`
1160+
**Required permission**: `owner` on `vote_response:{vote_response_uid}`
11611161

11621162
**Headers**:
11631163

docs/event-processing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ The voting service implements NATS KV bucket event processing to automatically s
148148
- `poll_id``vote_uid` (parent reference)
149149
- Integer ranked choice ranks
150150
- Mapped project UIDs
151-
- User-specific permissions (writer/viewer)
151+
- User-specific permissions (owner)
152152

153153
**Example Ranked Choice Transformation**:
154154

docs/fga-contract.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,15 @@ On delete, only `uid` is sent — all FGA tuples for `vote:{uid}` are removed by
7777

7878
| Relation | Value | Condition |
7979
|---|---|---|
80-
| `writer` | `Username` (Auth0 username) | Only when `Username` is non-empty |
81-
| `viewer` | `Username` (Auth0 username) | Only when `Username` is non-empty |
80+
| `owner` | `Username` (Auth0 username) | Only when `Username` is non-empty |
8281

8382
### References
8483

8584
| Reference | Value | Condition |
8685
|---|---|---|
87-
| `project` | `ProjectUID` | Only when `ProjectUID` is non-empty |
8886
| `vote` | `VoteUID` | Only when `VoteUID` is non-empty |
8987

90-
> The update message is skipped entirely if `Username`, `ProjectUID`, and `VoteUID` are all empty.
88+
> The update message is skipped entirely if `Username` and `VoteUID` are both empty.
9189
9290
### Delete
9391

@@ -102,6 +100,6 @@ On delete, only `uid` is sent — all FGA tuples for `vote_response:{uid}` are r
102100
| Create vote | `vote` | `lfx.fga-sync.update_access` | Skipped if both `ProjectUID` and `CommitteeUID` are empty |
103101
| Update vote | `vote` | `lfx.fga-sync.update_access` | Skipped if both `ProjectUID` and `CommitteeUID` are empty |
104102
| Delete vote | `vote` | `lfx.fga-sync.delete_access` | Always sent |
105-
| Create vote response | `vote_response` | `lfx.fga-sync.update_access` | Skipped if `Username`, `ProjectUID`, and `VoteUID` are all empty |
106-
| Update vote response | `vote_response` | `lfx.fga-sync.update_access` | Skipped if `Username`, `ProjectUID`, and `VoteUID` are all empty |
103+
| Create vote response | `vote_response` | `lfx.fga-sync.update_access` | Skipped if `Username` and `VoteUID` are both empty |
104+
| Update vote response | `vote_response` | `lfx.fga-sync.update_access` | Skipped if `Username` and `VoteUID` are both empty |
107105
| Delete vote response | `vote_response` | `lfx.fga-sync.delete_access` | Always sent |

internal/infrastructure/eventing/nats_publisher.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,10 @@ func (p *NATSPublisher) sendVoteResponseIndexerMessage(ctx context.Context, subj
220220
func (p *NATSPublisher) sendVoteResponseAccessMessage(data *domain.VoteResponseData) error {
221221
relations := map[string][]string{}
222222
if data.Username != "" {
223-
relations["writer"] = []string{data.Username}
224-
relations["viewer"] = []string{data.Username}
223+
relations["owner"] = []string{data.Username}
225224
}
226225

227226
references := map[string][]string{}
228-
if data.ProjectUID != "" {
229-
references["project"] = []string{data.ProjectUID}
230-
}
231227
if data.VoteUID != "" {
232228
references["vote"] = []string{data.VoteUID}
233229
}

0 commit comments

Comments
 (0)