utils

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEffectiveUser

func CheckEffectiveUser(w http.ResponseWriter, r *http.Request, userService services.IUserService, fallback string) (*models.User, error)

CheckEffectiveUser extracts the requested user from a URL (like '/users/{user}'), compares it with the currently authorized user and writes an HTTP error if they differ. Fallback can be used to manually set a value for '{user}' if none is present.

func FilterColors

func FilterColors(all map[string]string, haystack models.SummaryItems) map[string]string

func GetBadgeParams

func GetBadgeParams(reqPath string, authorizedUser, requestedUser *models.User) (*models.KeyedInterval, *models.Filters, error)

func GetEffectiveProjectsList

func GetEffectiveProjectsList(user *models.User, heartbeatSrvc services.IHeartbeatService, aliasSrvc services.IAliasService) ([]string, error)

GetEffectiveProjectsList returns the user's projects, including all alias targets and excluding all remapped project names (alias sources) Example: "A" mapped to "AB" using an alias -> "A" itself should not appear as a project anymore -> Instead, the "virtual" project "AB" shall appear See https://github.com/muety/wakapi/issues/231

func LoadUserSummary

func LoadUserSummary(ss services.ISummaryService, r *http.Request) (*models.Summary, error, int)

func LoadUserSummaryByParams

func LoadUserSummaryByParams(ss services.ISummaryService, params *models.SummaryParams) (*models.Summary, error, int)

func ParseHeartbeats

func ParseHeartbeats(r *http.Request) ([]*models.Heartbeat, error)

func SetError

func SetError(r *http.Request, w http.ResponseWriter, message string)

func SetSuccess

func SetSuccess(r *http.Request, w http.ResponseWriter, message string)

func WithSessionMessages

func WithSessionMessages[T view.BasicViewModel](vm T, r *http.Request, w http.ResponseWriter) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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