-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Bastian Rihm <[email protected]>
- Loading branch information
1 parent
ed55562
commit 82c7d35
Showing
10 changed files
with
934 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package collection | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/OpenSlides/openslides-autoupdate-service/internal/restrict/perm" | ||
"github.com/OpenSlides/openslides-autoupdate-service/pkg/datastore/dsfetch" | ||
) | ||
|
||
// MotionEditor handels restrictions of the collection motion_editor. | ||
// | ||
// The user can see a motion_editor if he has `motion.can_manage_metadata` | ||
// | ||
// Mode A: The user can see the motion editor. | ||
type MotionEditor struct{} | ||
|
||
// Name returns the collection name. | ||
func (m MotionEditor) Name() string { | ||
return "motion_editor" | ||
} | ||
|
||
// MeetingID returns the meetingID for the object. | ||
func (m MotionEditor) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error) { | ||
meetingID, err := ds.MotionEditor_MeetingID(id).Value(ctx) | ||
if err != nil { | ||
return 0, false, fmt.Errorf("get meeting id: %w", err) | ||
} | ||
|
||
return meetingID, true, nil | ||
} | ||
|
||
// Modes returns the restrictions modes for the meeting collection. | ||
func (m MotionEditor) Modes(mode string) FieldRestricter { | ||
switch mode { | ||
case "A": | ||
return m.see | ||
} | ||
return nil | ||
} | ||
|
||
func (m MotionEditor) see(ctx context.Context, ds *dsfetch.Fetch, motionEditorIDs ...int) ([]int, error) { | ||
return meetingPerm(ctx, ds, m, motionEditorIDs, perm.MotionCanManageMetadata) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
internal/restrict/collection/motion_working_group_speaker.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package collection | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/OpenSlides/openslides-autoupdate-service/internal/restrict/perm" | ||
"github.com/OpenSlides/openslides-autoupdate-service/pkg/datastore/dsfetch" | ||
) | ||
|
||
// MotionWorkingGroupSpeaker handels restrictions of the collection motion_working_group_speaker. | ||
// | ||
// The user can see a motion_working_group_speaker if he has `motion.can_manage_metadata` | ||
// | ||
// Mode A: The user can see the motion working group speaker. | ||
type MotionWorkingGroupSpeaker struct{} | ||
|
||
// Name returns the collection name. | ||
func (m MotionWorkingGroupSpeaker) Name() string { | ||
return "motion_working_group_speaker" | ||
} | ||
|
||
// MeetingID returns the meetingID for the object. | ||
func (m MotionWorkingGroupSpeaker) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error) { | ||
meetingID, err := ds.MotionWorkingGroupSpeaker_MeetingID(id).Value(ctx) | ||
if err != nil { | ||
return 0, false, fmt.Errorf("get meeting id: %w", err) | ||
} | ||
|
||
return meetingID, true, nil | ||
} | ||
|
||
// Modes returns the restrictions modes for the meeting collection. | ||
func (m MotionWorkingGroupSpeaker) Modes(mode string) FieldRestricter { | ||
switch mode { | ||
case "A": | ||
return m.see | ||
} | ||
return nil | ||
} | ||
|
||
func (m MotionWorkingGroupSpeaker) see(ctx context.Context, ds *dsfetch.Fetch, motionWorkingGroupSpeakerIDs ...int) ([]int, error) { | ||
return meetingPerm(ctx, ds, m, motionWorkingGroupSpeakerIDs, perm.MotionCanManageMetadata) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.