perm

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: 4 Imported by: 0

Documentation

Overview

Code generated from models.yml DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithPermissionCache

func ContextWithPermissionCache(ctx context.Context, getter flow.Getter, uid int) context.Context

ContextWithPermissionCache adds a permission cache to the context.

func HasCommitteeManagementLevel

func HasCommitteeManagementLevel(ctx context.Context, ds *dsfetch.Fetch, userID int, committeeID int) (bool, error)

HasCommitteeManagementLevel returns true, if the user has the manager level in the given committeeID.

func HasOrganizationManagementLevel

func HasOrganizationManagementLevel(ctx context.Context, ds *dsfetch.Fetch, userID int, level OrganizationManagementLevel) (bool, error)

HasOrganizationManagementLevel returns true if the user has the level or a higher level

func ManagementLevelCommittees

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

ManagementLevelCommittees returns all committee-ids where the given user has the management level.

func RequestUserFromContext

func RequestUserFromContext(ctx context.Context) (int, error)

RequestUserFromContext returns the request user from the context.

Make sure to generate the context with 'ContextWithPermissionCache.

Types

type OrganizationManagementLevel

type OrganizationManagementLevel string

OrganizationManagementLevel are possible values from user/organization_management_level

const (
	OMLNone                  OrganizationManagementLevel = ""
	OMLSuperadmin            OrganizationManagementLevel = "superadmin"
	OMLCanManageOrganization OrganizationManagementLevel = "can_manage_organization"
	OMLCanManageUsers        OrganizationManagementLevel = "can_manage_users"
)

Organization management levels

type Permission

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

Permission holds the information which permissions and groups a user has.

func FromContext

func FromContext(ctx context.Context, meetingID int) (*Permission, error)

FromContext gets a meeting specific permission object from a context.

Make sure to generate the context with 'ContextWithPermissionCache.

func New

func New(ctx context.Context, ds *dsfetch.Fetch, userID, meetingID int) (*Permission, error)

New creates a new Permission object for a user in a specific meeting.

If the user is not a member of the meeting, nil is returned.

func (*Permission) Has

func (p *Permission) Has(perm TPermission) bool

Has returns true, if the permission object contains the given permissions.

It also returns true, if the user is a superadmin or an admin in the meeting.

func (*Permission) InGroup

func (p *Permission) InGroup(gid int) bool

InGroup returns true, if the user is in the given group (by group_id).

func (*Permission) IsAdmin

func (p *Permission) IsAdmin() bool

IsAdmin returns true, if the user is a meeting admin.

type TPermission

type TPermission string

TPermission is a type of all valid permission strings.

const (
	AgendaItemCanManage               TPermission = "agenda_item.can_manage"
	AgendaItemCanManageModeratorNotes TPermission = "agenda_item.can_manage_moderator_notes"
	AgendaItemCanSee                  TPermission = "agenda_item.can_see"
	AgendaItemCanSeeInternal          TPermission = "agenda_item.can_see_internal"
	AgendaItemCanSeeModeratorNotes    TPermission = "agenda_item.can_see_moderator_notes"
	AssignmentCanManage               TPermission = "assignment.can_manage"
	AssignmentCanNominateOther        TPermission = "assignment.can_nominate_other"
	AssignmentCanNominateSelf         TPermission = "assignment.can_nominate_self"
	AssignmentCanSee                  TPermission = "assignment.can_see"
	ChatCanManage                     TPermission = "chat.can_manage"
	ListOfSpeakersCanBeSpeaker        TPermission = "list_of_speakers.can_be_speaker"
	ListOfSpeakersCanManage           TPermission = "list_of_speakers.can_manage"
	ListOfSpeakersCanSee              TPermission = "list_of_speakers.can_see"
	MediafileCanManage                TPermission = "mediafile.can_manage"
	MediafileCanSee                   TPermission = "mediafile.can_see"
	MeetingCanManageLogosAndFonts     TPermission = "meeting.can_manage_logos_and_fonts"
	MeetingCanManageSettings          TPermission = "meeting.can_manage_settings"
	MeetingCanSeeAutopilot            TPermission = "meeting.can_see_autopilot"
	MeetingCanSeeFrontpage            TPermission = "meeting.can_see_frontpage"
	MeetingCanSeeHistory              TPermission = "meeting.can_see_history"
	MeetingCanSeeLivestream           TPermission = "meeting.can_see_livestream"
	MotionCanCreate                   TPermission = "motion.can_create"
	MotionCanCreateAmendments         TPermission = "motion.can_create_amendments"
	MotionCanForward                  TPermission = "motion.can_forward"
	MotionCanManage                   TPermission = "motion.can_manage"
	MotionCanManageMetadata           TPermission = "motion.can_manage_metadata"
	MotionCanManagePolls              TPermission = "motion.can_manage_polls"
	MotionCanSee                      TPermission = "motion.can_see"
	MotionCanSeeInternal              TPermission = "motion.can_see_internal"
	MotionCanSupport                  TPermission = "motion.can_support"
	PollCanManage                     TPermission = "poll.can_manage"
	ProjectorCanManage                TPermission = "projector.can_manage"
	ProjectorCanSee                   TPermission = "projector.can_see"
	TagCanManage                      TPermission = "tag.can_manage"
	UserCanManage                     TPermission = "user.can_manage"
	UserCanManagePresence             TPermission = "user.can_manage_presence"
	UserCanSee                        TPermission = "user.can_see"
	UserCanSeeSensitiveData           TPermission = "user.can_see_sensitive_data"
	UserCanUpdate                     TPermission = "user.can_update"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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