Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motion editor #1083

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading