collection

package
v0.0.0-...-4eef36e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allways

func Allways(ctx context.Context, ds *dsfetch.Fetch, elementIDs ...int) ([]int, error)

Allways is a restricter func that just returns true.

func ContextWithRestrictCache

func ContextWithRestrictCache(ctx context.Context) context.Context

ContextWithRestrictCache returns a context with restrict cache.

Types

type ActionWorker

type ActionWorker struct{}

ActionWorker handles permission for action_worker.

func (ActionWorker) MeetingID

func (a ActionWorker) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns no meeting.

func (ActionWorker) Modes

func (a ActionWorker) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the action_worker collection.

func (ActionWorker) Name

func (a ActionWorker) Name() string

Name returns the collection name.

type AgendaItem

type AgendaItem struct{}

AgendaItem handels permission for the agenda.

The user can see an agenda item if any of:
   The user has `agenda_item.can_manage` in the meeting
   The user has `agenda_item.can_see_internal` in the meeting and the item has `is_hidden` set to `false`.
   The user has `agenda_item.can_see` in the meeting and the item has `is_hidden` and `is_internal` set to `false`.

Mode A: The user can see the agenda item.

Mode B: The user has agenda_item.can_see_internal.

Mode C: The user has agenda_item.can_manage.

Mode D: The user has agenda_item.can_see_notes

func (AgendaItem) MeetingID

func (a AgendaItem) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (AgendaItem) Modes

func (a AgendaItem) Modes(mode string) FieldRestricter

Modes returns a map from all known modes to there restricter.

func (AgendaItem) Name

func (a AgendaItem) Name() string

Name returns the collection name.

type Assignment

type Assignment struct{}

Assignment handels restrictions for the assignment collection.

The user can see an assignment, if the user has assignment.can_see

Mode A: User can see the assignment.

func (Assignment) MeetingID

func (a Assignment) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Assignment) Modes

func (a Assignment) Modes(mode string) FieldRestricter

Modes returns the restricter for the a restriction mode.

func (Assignment) Name

func (a Assignment) Name() string

Name returns the collection name.

type AssignmentCandidate

type AssignmentCandidate struct{}

AssignmentCandidate handels the permissions for assignment_candiate collections.

The user can see an assignment candidate, if the user can see the linked assignment.

Mode A: The user can see the assignment candidate.

func (AssignmentCandidate) MeetingID

func (a AssignmentCandidate) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (AssignmentCandidate) Modes

Modes returns the restrictions modes for assignment_candidate.

func (AssignmentCandidate) Name

func (a AssignmentCandidate) Name() string

Name returns the collection name.

type CM

type CM struct {
	Collection string
	Mode       string
}

CM is the name of a collection and a mode.

func (CM) String

func (cm CM) String() string

type ChatGroup

type ChatGroup struct{}

ChatGroup handels restrictions for the collection chat_group.

A user can see a chat group if any of:

The user has the permission chat.can_manage in the respective meeting (dedicated by the key meeting_id).
The user is assigned to groups in common with chat_group/read_group_ids.
The user is assigned to groups in common with chat_group/write_group_ids.

Mode A: The user can see the chat_group.

func (ChatGroup) MeetingID

func (c ChatGroup) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ChatGroup) Modes

func (c ChatGroup) Modes(mode string) FieldRestricter

Modes give sthe FieldRestricter for a restriction_mode.

func (ChatGroup) Name

func (c ChatGroup) Name() string

Name ChatGroup the collection name.

type ChatMessage

type ChatMessage struct{}

ChatMessage handels restrictions for the collection chat_message.

A user can see a chat_message if they have the permission chat.can_manage or they are in the respective chat_group/read_group_ids (given by the key chat_group_id) or they have written the chat_message (dedicated by the key user_id).

Mode A: A user can see a chat_message.

func (ChatMessage) MeetingID

func (c ChatMessage) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ChatMessage) Modes

func (c ChatMessage) Modes(mode string) FieldRestricter

Modes give sthe FieldRestricter for a restriction_mode.

func (ChatMessage) Name

func (c ChatMessage) Name() string

Name returns the collection name.

type Committee

type Committee struct{}

Committee handels permission for committees.

See user can see a committee, if he is in committee/user_ids or have the OML can_manage_users or higher.

Mode A: The user can see the committee.

Mode B: The user must have the OML `can_manage_organization` or higher or the CML `can_manage` in the committee.

func (Committee) MeetingID

func (c Committee) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Committee) Modes

func (c Committee) Modes(mode string) FieldRestricter

Modes returns a map from all known modes to there restricter.

func (Committee) Name

func (c Committee) Name() string

Name returns the collection name.

type FieldRestricter

type FieldRestricter func(ctx context.Context, ds *dsfetch.Fetch, id ...int) ([]int, error)

FieldRestricter is a function to restrict fields of a collection.

type Group

type Group struct{}

Group handels restrictions of the collection group.

The user can see a group, if the user can see the group's meeting.

Mode A: The user can see the group.

func (Group) MeetingID

func (g Group) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Group) Modes

func (g Group) Modes(mode string) FieldRestricter

Modes returns the field restricters for the collection group.

func (Group) Name

func (g Group) Name() string

Name returns the collection name.

type ImportPreview

type ImportPreview struct{}

ImportPreview handels restrictions of the collection import_preview.

Noone can see the import_preview

func (ImportPreview) MeetingID

func (i ImportPreview) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ImportPreview) Modes

func (i ImportPreview) Modes(mode string) FieldRestricter

Modes returns the field restricters for the collection.

func (ImportPreview) Name

func (i ImportPreview) Name() string

Name returns the collection name.

type ListOfSpeakers

type ListOfSpeakers struct{}

ListOfSpeakers handels the restriction for the list_of_speakers collection.

The user can see a list of speakers if the user has list_of_speakers.can_see or can_be_speaker.

Mode A: The user can see the list of speakers.

func (ListOfSpeakers) MeetingID

func (los ListOfSpeakers) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ListOfSpeakers) Modes

func (los ListOfSpeakers) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (ListOfSpeakers) Name

func (los ListOfSpeakers) Name() string

Name returns the collection name.

type Mediafile

type Mediafile struct{}

Mediafile handels permissions for the collection mediafile.

Every logged in user can see a medafile that belongs to the organization.

The user can see a mediafile of a meeting if any of:

The user is an admin of the meeting.
The user can see the meeting and used_as_logo_*_in_meeting_id or used_as_font_*_in_meeting_id is not empty.
The user has projector.can_see and there exists a mediafile/projection_ids with projection/current_projector_id set.
The user has mediafile.can_manage.
The user has mediafile.can_see and either:
    mediafile/is_public is true, or
    The user has groups in common with meeting/inherited_access_group_ids.

Mode A: The user can see the mediafile.

func (Mediafile) MeetingID

func (m Mediafile) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Mediafile) Modes

func (m Mediafile) Modes(mode string) FieldRestricter

Modes returns the field modes for the collection mediafile.

func (Mediafile) Name

func (m Mediafile) Name() string

Name returns the collection name.

type Meeting

type Meeting struct{}

Meeting handels restrictions of the collection meeting.

The user can see a meeting if one of the following is True:

`meeting/enable_anonymous`.
The user is in the meeting.
The user has the CML can_manage of the meeting's committee.
The user has the CML can_manage of any meeting and the meeting is a template meeting.
The user has the OML can_manage_organization.

Mode A: Always visible to everyone.

Mode B: The user can see the meeting.

Mode C: The user has meeting.can_see_frontpage.

Mode D: The user has meeting.can_see_livestream.

func (Meeting) MeetingID

func (m Meeting) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Meeting) Modes

func (m Meeting) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Meeting) Name

func (m Meeting) Name() string

Name returns the collection name.

type MeetingUser

type MeetingUser struct{}

MeetingUser handels permissions for the collection meeting_user.

A User can see a MeetingUser if he can see the user.

Mode A: The user can see the related user.

Mode B: The request user is the related user.

Mode D: Y can see these fields if at least one condition is true:

The request user has the OML can_manage_users or higher.
The request user has user.can_manage in the meeting

func (MeetingUser) MeetingID

func (m MeetingUser) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MeetingUser) Modes

func (m MeetingUser) Modes(mode string) FieldRestricter

Modes returns the field modes for the collection mediafile.

func (MeetingUser) Name

func (m MeetingUser) Name() string

Name returns the collection name.

type Motion

type Motion struct{}

Motion handels restrictions of the collection motion.

The user can see a motion if:

	The user has motion.can_see in the meeting, and
	For one `restriction` in the motion's state `state/restriction` field:
	    If: `restriction` is `is_submitter`: The user needs to be a submitter of the motion
	    Else: (a permission string): The user needs the permission
 And - for amendments (lead_motion_id != null) - the user can also see the lead motion.

Mode A: The user can see the motion or can see a referenced motion in motion/all_origin_ids and motion/all_derived_motion_ids.

Mode B: The user has the permission motion.can_manage_metadata in the motion's meeting.

Mode C: The user can see the motion.

Mode D: Never published to any user.

Mode E: If the motion states is_internal is true the user needs the permission motion.can_manage_metadata otherwise same as Mode C

func (Motion) MeetingID

func (m Motion) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Motion) Modes

func (m Motion) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Motion) Name

func (m Motion) Name() string

Name returns the collection name.

type MotionBlock

type MotionBlock struct{}

MotionBlock handels restrictions of the collection motion_block.

The user can see a motion block if any of:

The user has motion.can_manage.
The user has motion.can_see and the motion block has internal set to false.

Mode A: The user can see the motion block.

func (MotionBlock) MeetingID

func (m MotionBlock) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionBlock) Modes

func (m MotionBlock) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionBlock) Name

func (m MotionBlock) Name() string

Name returns the collection name.

type MotionCategory

type MotionCategory struct{}

MotionCategory handels restrictions of the collection motion_category.

The user can see a motion category if the user has motion.can_see.

Mode A: The user can see the motion category.

func (MotionCategory) MeetingID

func (m MotionCategory) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionCategory) Modes

func (m MotionCategory) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionCategory) Name

func (m MotionCategory) Name() string

Name returns the collection name.

type MotionChangeRecommendation

type MotionChangeRecommendation struct{}

MotionChangeRecommendation handels restrictions of the collection motion_change_recommendation.

The user can see a motion change recommendation if any of:

The user has motion.can_manage_metadata.
The user has motion.can_see AND
	motion_change_recommendation.internal is set to false AND
	motion_change_recommendation.motion_id.state_id.is_internal is set to false.

Mode A: The user can see the motion change recommendation.

func (MotionChangeRecommendation) MeetingID

func (m MotionChangeRecommendation) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionChangeRecommendation) Modes

Modes returns the restrictions modes for the meeting collection.

func (MotionChangeRecommendation) Name

Name returns the collection name.

type MotionComment

type MotionComment struct{}

MotionComment handels restrictions of the collection motion_comment.

The user can see a motion comment if

The user can see the linked motion and

	has at least one group in common with motion_comment_section/read_group_ids, or
	has at least one group in common with motion_comment_section/write_group_ids, or
	submitter_can_write is set to true for the corresponding comment section AND the user is the submitter of this motion

Or the user has motion.can_manage.

Mode A: The user can see the motion comment.

func (MotionComment) MeetingID

func (m MotionComment) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionComment) Modes

func (m MotionComment) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionComment) Name

func (m MotionComment) Name() string

Name returns the collection name.

type MotionCommentSection

type MotionCommentSection struct{}

MotionCommentSection handels restrictions of the collection motion_comment_section.

The user can see a motion comment section if any of:

The user has motion.can_see and
	has at least one group in common with motion_comment_section/read_group_ids or
	has at least one group in common with motion_comment_section/write_group_ids or
	submitter_can_write is set to true for this comment section

The user has motion.can_manage.

The user can see the motion comment section.

func (MotionCommentSection) MeetingID

func (m MotionCommentSection) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionCommentSection) Modes

Modes returns the restrictions modes for the meeting collection.

func (MotionCommentSection) Name

func (m MotionCommentSection) Name() string

Name returns the collection name.

type MotionEditor

type MotionEditor struct{}

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.

func (MotionEditor) MeetingID

func (m MotionEditor) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionEditor) Modes

func (m MotionEditor) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionEditor) Name

func (m MotionEditor) Name() string

Name returns the collection name.

type MotionState

type MotionState struct{}

MotionState handels restrictions of the collection motion_state.

The user can see a motion state if the user has motion.can_see.

Mode A: The user can see the motion state.

func (MotionState) MeetingID

func (m MotionState) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionState) Modes

func (m MotionState) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionState) Name

func (m MotionState) Name() string

Name returns the collection name.

type MotionStatuteParagraph

type MotionStatuteParagraph struct{}

MotionStatuteParagraph handels restrictions of the collection motion_statute_paragraph.

The user can see a motion statute paragraph if the user has motion.can_see.

Mode A: The user can see the motion statute paragraph.

func (MotionStatuteParagraph) MeetingID

func (m MotionStatuteParagraph) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionStatuteParagraph) Modes

Modes returns the restrictions modes for the meeting collection.

func (MotionStatuteParagraph) Name

func (m MotionStatuteParagraph) Name() string

Name returns the collection name.

type MotionSubmitter

type MotionSubmitter struct{}

MotionSubmitter handels restrictions of the collection motion_submitter.

The user can see a motion submitter if the user can see the linked motion.

Mode A: The user can see the motion submitter.

func (MotionSubmitter) MeetingID

func (m MotionSubmitter) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionSubmitter) Modes

func (m MotionSubmitter) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionSubmitter) Name

func (m MotionSubmitter) Name() string

Name returns the collection name.

type MotionWorkflow

type MotionWorkflow struct{}

MotionWorkflow handels restrictions of the collection motion_workflow.

The user can see a motion workflow if the user has motion.can_see.

Mode A: The user can see the motion workflow.

func (MotionWorkflow) MeetingID

func (m MotionWorkflow) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionWorkflow) Modes

func (m MotionWorkflow) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (MotionWorkflow) Name

func (m MotionWorkflow) Name() string

Name returns the collection name.

type MotionWorkingGroupSpeaker

type MotionWorkingGroupSpeaker struct{}

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.

func (MotionWorkingGroupSpeaker) MeetingID

func (m MotionWorkingGroupSpeaker) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (MotionWorkingGroupSpeaker) Modes

Modes returns the restrictions modes for the meeting collection.

func (MotionWorkingGroupSpeaker) Name

Name returns the collection name.

type Option

type Option struct{}

Option handels restrictions of the collection option.

The user can see an option if the user can see the linked poll.

Mode A: The user can see the option.

Mode B: The user can see the poll and (manage the linked poll or poll/state is published).

func (Option) MeetingID

func (o Option) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Option) Modes

func (o Option) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Option) Name

func (o Option) Name() string

Name returns the collection name.

type Organization

type Organization struct{}

Organization handels restrictions of the collection organization.

The user can always see an organization.

Mode A: The user can see the organization (always).

Mode B: The user must be logged in (no anonymous).

Mode C: The user has the OML can_manage_users or higher.

func (Organization) MeetingID

func (o Organization) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Organization) Modes

func (o Organization) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Organization) Name

func (o Organization) Name() string

Name returns the collection name.

type OrganizationTag

type OrganizationTag struct{}

OrganizationTag handels restrictions of the collection organization_tag.

A logged in user can always see an organization tag.

Mode A: The user can see the organization tag.

func (OrganizationTag) MeetingID

func (o OrganizationTag) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (OrganizationTag) Modes

func (o OrganizationTag) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (OrganizationTag) Name

func (o OrganizationTag) Name() string

Name returns the collection name.

type PersonalNote

type PersonalNote struct{}

PersonalNote handels restriction for the personal_node collection.

The user can see a personal node, if personal_note/user_id is the same as the id of the requested user.

The superadmin can not see personal_notes from other users.

Mode A: The user can see the personal note.

func (PersonalNote) MeetingID

func (p PersonalNote) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (PersonalNote) Modes

func (p PersonalNote) Modes(mode string) FieldRestricter

Modes returns the field restriction for each mode.

func (PersonalNote) Name

func (p PersonalNote) Name() string

Name returns the collection name.

func (PersonalNote) SuperAdmin

func (p PersonalNote) SuperAdmin(mode string) FieldRestricter

SuperAdmin restricts the super admin.

type PointOfOrderCategory

type PointOfOrderCategory struct{}

PointOfOrderCategory handels restriction for the point_of_order_category collection.

The user can see a point_of_order_category, if he can see the linked meeting.

Mode A: The user can see the point_of_order_category.

func (PointOfOrderCategory) MeetingID

func (p PointOfOrderCategory) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (PointOfOrderCategory) Modes

Modes returns the field restriction for each mode.

func (PointOfOrderCategory) Name

func (p PointOfOrderCategory) Name() string

Name returns the collection name.

type Poll

type Poll struct{}

Poll handels restrictions of the collection poll. If the user can see a poll depends on the content object:

motion: The user can see the linked motion.
assignment: The user can see the linked assignment.
topic: The user can see the topic.

If the user can manage the poll depends on the content object:

motion: The user needs motion.can_manage_polls.
assignment: The user needs assignment.can_manage.
topic: The user needs poll.can_manage.

Mode A: The user can see the poll.

Mode B: Depends on poll/state:

published: Accessible if the user can see the poll.
finished: Accessible if the user can manage the poll.
others: Not accessible for anyone.

Mode C: The poll is in the started state and

the user can manage the poll or
the user has the permissions `user.can_see` and `list_of_speakers.can_manage`.

Mode D: Same as Mode B, but for `finished`: Accessible if the user can manage the poll or the user has list_of_speakers.can_manage.

func (Poll) MeetingID

func (p Poll) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Poll) Modes

func (p Poll) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Poll) Name

func (p Poll) Name() string

Name returns the collection name.

type PollCandidate

type PollCandidate struct{}

PollCandidate handels restriction for the poll_candidate collection.

A user can see a poll candidate list, if he can see the linked poll_candidate_list.

Mode A: The user can see the poll candidate.

func (PollCandidate) MeetingID

func (p PollCandidate) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (PollCandidate) Modes

func (p PollCandidate) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (PollCandidate) Name

func (p PollCandidate) Name() string

Name returns the collection name.

type PollCandidateList

type PollCandidateList struct{}

PollCandidateList handels restriction for the poll_candidate_list collection.

A user can see a poll candidate list, if he can see the linked option.

Mode A: The user can see the poll candidate list.

func (PollCandidateList) MeetingID

func (p PollCandidateList) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (PollCandidateList) Modes

Modes returns the restrictions modes for the meeting collection.

func (PollCandidateList) Name

func (p PollCandidateList) Name() string

Name returns the collection name.

type Projection

type Projection struct{}

Projection handels the restriction for the projection collection.

The user can see a projection, if the user has projector.can_see.

Mode A: The user can see the projection.

func (Projection) MeetingID

func (p Projection) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Projection) Modes

func (p Projection) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Projection) Name

func (p Projection) Name() string

Name returns the collection name.

type Projector

type Projector struct{}

Projector handels the restriction for the projector collection.

The user can see a projector, if the user has projector.can_see.

If the projector has internal=true, then the user needs projector.can_manage

Mode A: The user can see the projector.

func (Projector) MeetingID

func (p Projector) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Projector) Modes

func (p Projector) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Projector) Name

func (p Projector) Name() string

Name returns the collection name.

type ProjectorCountdown

type ProjectorCountdown struct{}

ProjectorCountdown handels the restriction for the projector_countdown collection.

The user can see a projector countdown, if the user has projector.can_see.

Group A: The user can see the projector countdown.

func (ProjectorCountdown) MeetingID

func (p ProjectorCountdown) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ProjectorCountdown) Modes

Modes returns the restrictions modes for the meeting collection.

func (ProjectorCountdown) Name

func (p ProjectorCountdown) Name() string

Name returns the collection name.

type ProjectorMessage

type ProjectorMessage struct{}

ProjectorMessage handels the restriction for the projector_message collection.

The user can see a projector message, if the user has projector.can_see.

Mode A: The user can see the projector message.

func (ProjectorMessage) MeetingID

func (p ProjectorMessage) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (ProjectorMessage) Modes

func (p ProjectorMessage) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (ProjectorMessage) Name

func (p ProjectorMessage) Name() string

Name returns the collection name.

type Restricter

type Restricter interface {
	Modes(mode string) FieldRestricter

	// MeetingID returns the meeting id for an object. Returns hasMeeting=false,
	// if the object does not belong to a meeting.
	MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (meetingID int, hasMeeting bool, err error)

	Name() string
}

Restricter returns a fieldRestricter for a restriction_mode.

The FieldRestricter is a function that tells, if a user can see fields in that mode.

func Collection

func Collection(ctx context.Context, collection string) Restricter

Collection returns the restricter for a collection

type Speaker

type Speaker struct{}

Speaker handels restrictions of the collection speaker.

The user can see a speaker if he has list_of_speakers.can_see or if user_id is the request_user.

Mode A: The user can see the speaker.

func (Speaker) MeetingID

func (s Speaker) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Speaker) Modes

func (s Speaker) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Speaker) Name

func (s Speaker) Name() string

Name returns the collection name.

type StructureLevel

type StructureLevel struct{}

StructureLevel handels restrictions of the collection structure_level.

The user can see a structure level if he has `list_of_speakers.can_see` OR `user.can_see`

Mode A: The user can see the speaker.

func (StructureLevel) MeetingID

func (s StructureLevel) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (StructureLevel) Modes

func (s StructureLevel) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (StructureLevel) Name

func (s StructureLevel) Name() string

Name returns the collection name.

type StructureLevelListOfSpeakers

type StructureLevelListOfSpeakers struct{}

StructureLevelListOfSpeakers handels restrictions of the collection structure_level_list_of_speakers.

The user can see a structure level if he has `list_of_speakers.can_see`

Mode A: The user can see the speaker.

func (StructureLevelListOfSpeakers) MeetingID

func (s StructureLevelListOfSpeakers) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (StructureLevelListOfSpeakers) Modes

Modes returns the restrictions modes for the meeting collection.

func (StructureLevelListOfSpeakers) Name

Name returns the collection name.

type Tag

type Tag struct{}

Tag handels the restrictions for the tag collection.

The user can see a tag, if the user can see the tag's meeting.

Mode A: The user can see the tag.

func (Tag) MeetingID

func (t Tag) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Tag) Modes

func (t Tag) Modes(mode string) FieldRestricter

Modes returns the field restriction for each mode.

func (Tag) Name

func (t Tag) Name() string

Name returns the collection name.

type Theme

type Theme struct{}

Theme handels the restrictions for the theme collection.

Every user can see a theme.

func (Theme) MeetingID

func (t Theme) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Theme) Modes

func (t Theme) Modes(mode string) FieldRestricter

Modes returns the field restriction for each mode.

func (Theme) Name

func (t Theme) Name() string

Name returns the collection name.

type Topic

type Topic struct{}

Topic handels the restrictions for the topic collection.

The user can see a topic, if the user can see the linked topic.

Mode A: The user can see the topic.

func (Topic) MeetingID

func (t Topic) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Topic) Modes

func (t Topic) Modes(mode string) FieldRestricter

Modes returns the field restriction for each mode.

func (Topic) Name

func (t Topic) Name() string

Name returns the collection name.

type Unknown

type Unknown struct {
	// contains filtered or unexported fields
}

Unknown is a collection that does not exist in the models.yml

func (Unknown) MeetingID

func (u Unknown) MeetingID(context.Context, *dsfetch.Fetch, int) (int, bool, error)

MeetingID is not a thing on a unknown meeting

func (Unknown) Modes

func (u Unknown) Modes(string) FieldRestricter

Modes on an unknown field can not be seen.

func (Unknown) Name

func (u Unknown) Name() string

Name returns the collection name.

type User

type User struct{}

User handels the restrictions for the user collection.

Y is the request user and X the user, that is requested.

The user Y can see a user X, if at least one condition is true:

Y==X
Y has the OML can_manage_users or higher.
There exists a committee where Y has the CML can_manage and X is in committee/user_ids.
X is in a group of a meeting where Y has user.can_see.
There is a related object:
    There exists a motion which Y can see and X is a submitter/supporter.
    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.
    There exists a poll where Y can see the poll/voted_ids and X is part of that list.
    There exists a vote which Y can see and X is linked in user_id or delegated_user_id.
    There exists a chat_message which Y can see and X has sent it (specified by chat_message/user_id).
X is linked in one of the relations vote_delegated_to_id or vote_delegations_from_ids of Y.

Mode A: Y can see X.

Mode B:

Y==X
Y has the OML can_manage_users or higher.
There exists a committee where Y has the CML can_manage and X is in committee/user_ids.
X is in a group of a meeting where Y has user.can_see_sensitive_data.

Mode D: Y can see these fields if at least one condition is true:

Y has the OML can_manage_users or higher.
X is in a group of a meeting where Y has user.can_manage.

Mode E: Y can see these fields if at least one condition is true:

Y has the OML can_manage_users or higher.
There exists a committee where Y has the CML can_manage and X is in committee/user_ids.
X is in a group of a meeting where Y has user.can_manage.
Y==X.

Mode F: Y has the OML can_manage_users or higher.

Mode G: No one. Not even the superadmin.

Mode H: Like D but the fields are not visible, if the request has a lower organization management level then the requested user.

func (User) MeetingID

func (User) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (User) Modes

func (u User) Modes(mode string) FieldRestricter

Modes returns the field restriction for each mode.

func (User) Name

func (u User) Name() string

Name returns the collection name.

func (User) RequiredObjects

func (User) RequiredObjects(ctx context.Context, ds *dsfetch.Fetch) []UserRequiredObject

RequiredObjects returns all references to other objects from the user.

func (User) SuperAdmin

func (User) SuperAdmin(mode string) FieldRestricter

SuperAdmin restricts the super admin.

type UserRequiredObject

type UserRequiredObject struct {
	Name     string
	ElemFunc func(int) *dsfetch.ValueIntSlice
	SeeFunc  FieldRestricter
	OnUser   bool // Tells, if the relation is via meeting_user_id or user_id
}

UserRequiredObject represents the reference from a user to other objects.

type Vote

type Vote struct{}

Vote handels restrictions of the collection vote. The user can see a vote if any of:

The associated poll/state is published.
The user can manage the associated poll.
The user's id is equal to vote/user_id.
The user's id is equal to vote/delegated_user_id.

Group A: The user can see the vote.

Group B: Depends on poll/state:

published: Accessible if the user can see the vote.
finished: Accessible if the user can manage the associated poll.
others: Not accessible for anyone.

func (Vote) MeetingID

func (v Vote) MeetingID(ctx context.Context, ds *dsfetch.Fetch, id int) (int, bool, error)

MeetingID returns the meetingID for the object.

func (Vote) Modes

func (v Vote) Modes(mode string) FieldRestricter

Modes returns the restrictions modes for the meeting collection.

func (Vote) Name

func (v Vote) Name() string

Name returns the collection name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL