Skip to content

Commit

Permalink
Motion editor (#1083)
Browse files Browse the repository at this point in the history
* Motion editor  and working group speaker are required users

Fixes #1080

* remove unneeded newline
  • Loading branch information
ostcar authored Nov 18, 2024
1 parent 40a5c32 commit 7dd50fd
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/restrict/collection/meeting_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
// X is linked in one of the relations vote_delegated_to_id or vote_delegations_from_ids of Y or
// there is a related object:
// There exists a motion which Y can see and X is a submitter/supporter.
// X is a motion/editor or motion_working_group_speaker that Y can see.
// There exists an option which Y can see and X is the linked content object.
// There exists an assignment candidate which Y can see and X is the linked user.
// There exists a speaker which Y can see and X is the linked user.
Expand Down Expand Up @@ -196,6 +197,20 @@ func (MeetingUser) RequiredObjects(ctx context.Context, ds *dsfetch.Fetch) []Use
false,
},

{
"motion editor",
ds.MeetingUser_MotionEditorIDs,
Collection(ctx, MotionEditor{}.Name()).Modes("A"),
false,
},

{
"motion working group speaker",
ds.MeetingUser_MotionWorkingGroupSpeakerIDs,
Collection(ctx, MotionWorkingGroupSpeaker{}.Name()).Modes("A"),
false,
},

{
"option",
ds.User_OptionIDs,
Expand Down
48 changes: 48 additions & 0 deletions internal/restrict/collection/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,54 @@ func TestUserModeA(t *testing.T) {
withPerms(30, perm.MotionCanSee),
)

testCase(
"motion editor",
t,
f,
true,
`---
user/1/meeting_user_ids: [10]
user/2/meeting_user_ids: [20]
meeting_user/10:
meeting_id: 30
meeting_user/20:
meeting_id: 30
user_id: 2
motion_editor_ids: [4]
motion_editor/4:
meeting_id: 30
`,
withRequestUser(1),
withElementID(2),
withPerms(30, perm.MotionCanManageMetadata),
)

testCase(
"motion working group speakder",
t,
f,
true,
`---
user/1/meeting_user_ids: [10]
user/2/meeting_user_ids: [20]
meeting_user/10:
meeting_id: 30
meeting_user/20:
meeting_id: 30
user_id: 2
motion_working_group_speaker_ids: [4]
motion_working_group_speaker/4:
meeting_id: 30
`,
withRequestUser(1),
withElementID(2),
withPerms(30, perm.MotionCanManageMetadata),
)

testCase(
"assignment candidate",
t,
Expand Down

0 comments on commit 7dd50fd

Please sign in to comment.