Documentation ¶
Overview ¶
Code generated with generated/main.go DO NOT EDIT.
Index ¶
- func AllFields(fqfields []FQField, result map[string]bool, f func(FQField) (bool, error)) error
- func HasPerm(ctx context.Context, dp dataprovider.DataProvider, userID int, meetingID int, ...) (bool, error)
- func LogNotAllowedf(format string, a ...interface{})
- type Action
- type ActionFunc
- type Collection
- type CollectionFunc
- type Connecter
- type ConnecterFunc
- type FQField
- type HandlerStore
- type Permission
- type TPermission
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFields ¶
AllFields checks all fqfields by the given function f.
It asumes, that if a user can see one field of the object, he can see all fields. So the check is only called once per fqid.
func HasPerm ¶
func HasPerm(ctx context.Context, dp dataprovider.DataProvider, userID int, meetingID int, permission TPermission) (bool, error)
HasPerm tells if the given user has a speficic permission in the meeting.
It is a shortcut for calling p := perm.New(...);p.Has(...).
func LogNotAllowedf ¶
func LogNotAllowedf(format string, a ...interface{})
LogNotAllowedf logs the permission failer.
Types ¶
type Action ¶
type Action interface { // IsAllowed tells, if the user has the permission for the object this // method is called on. IsAllowed(ctx context.Context, userID int, payload map[string]json.RawMessage) (bool, error) }
Action is an object with the method IsAllowed.
type ActionFunc ¶
type ActionFunc func(ctx context.Context, userID int, payload map[string]json.RawMessage) (bool, error)
ActionFunc is a function with the IsAllowed signature.
type Collection ¶
type Collection interface {
RestrictFQFields(ctx context.Context, userID int, fqfields []FQField, result map[string]bool) error
}
Collection is an object with a method to restrict fqfields.
type CollectionFunc ¶
type CollectionFunc func(ctx context.Context, userID int, fqfields []FQField, result map[string]bool) error
CollectionFunc is a function with the Collection.RestrictFQFields signature.
func (CollectionFunc) RestrictFQFields ¶
func (f CollectionFunc) RestrictFQFields(ctx context.Context, userID int, fqfields []FQField, result map[string]bool) error
RestrictFQFields calls the function.
type Connecter ¶
type Connecter interface {
Connect(store HandlerStore)
}
Connecter can connect Actions and Collections to a HandlerStore.
type ConnecterFunc ¶
type ConnecterFunc func(store HandlerStore)
ConnecterFunc is a function that implements the Connecter interface.
func (ConnecterFunc) Connect ¶
func (f ConnecterFunc) Connect(store HandlerStore)
Connect calls itself.
type FQField ¶
FQField contains all parts of a fqfield.
func ParseFQField ¶
ParseFQField creates an FQField object from a fqfield string.
type HandlerStore ¶
type HandlerStore interface { RegisterRestricter(name string, collection Collection) RegisterAction(name string, action Action) }
HandlerStore holds collections and actions.
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
Permission holds the information which permissions and groups a user has.
func New ¶
func New(ctx context.Context, dp dataprovider.DataProvider, 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.
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" AgendaItemCanSee TPermission = "agenda_item.can_see" AgendaItemCanSeeInternal TPermission = "agenda_item.can_see_internal" AssignmentCanManage TPermission = "assignment.can_manage" AssignmentCanNominateOther TPermission = "assignment.can_nominate_other" AssignmentCanNominateSelf TPermission = "assignment.can_nominate_self" AssignmentCanSee TPermission = "assignment.can_see" 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" 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" ProjectorCanManage TPermission = "projector.can_manage" ProjectorCanSee TPermission = "projector.can_see" TagCanManage TPermission = "tag.can_manage" UserCanChangeOwnPassword TPermission = "user.can_change_own_password" UserCanManage TPermission = "user.can_manage" UserCanSee TPermission = "user.can_see" UserCanSeeExtraData TPermission = "user.can_see_extra_data" )