core

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright (C) 2023 Tim Bastin, l3montree UG (haftungsbeschränkt)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var V = validator.New()

Functions

func AccessControlMiddleware

func AccessControlMiddleware(obj accesscontrol.Object, act accesscontrol.Action) echo.MiddlewareFunc

func GetAsset

func GetAsset(c Context) models.Asset

func GetAssetSlug

func GetAssetSlug(c Context) (string, error)

func GetAuthAdminClient added in v0.4.19

func GetAuthAdminClient(c Context) *client.APIClient

func GetFlawID

func GetFlawID(c Context) (string, error)

func GetOrgSlug added in v0.5.1

func GetOrgSlug(c Context) (string, error)

func GetOryClient

func GetOryClient(c Context) *client.APIClient

func GetParam

func GetParam(c Context, param string) string

func GetProject

func GetProject(c Context) models.Project

func GetProjectSlug

func GetProjectSlug(c Context) (string, error)

func GetTenant

func GetTenant(c Context) models.Org

func InitLogger

func InitLogger()

InitLogger initializes the logger with a tint handler. tint is a simple logging library that allows to add colors to the log output. this is obviously not required, but it makes the logs easier to read.

func LoadConfig

func LoadConfig() error

func Ptr

func Ptr[T any](t T) *T

func SanitizeParam

func SanitizeParam(s string) string

func SetAuthAdminClient added in v0.4.19

func SetAuthAdminClient(c Context, i *client.APIClient)

func SetThirdPartyIntegration added in v0.4.19

func SetThirdPartyIntegration(c Context, i ThirdPartyIntegration)

Types

type AuthSession

type AuthSession interface {
	GetUserID() string
}

func GetSession

func GetSession(ctx Context) AuthSession

type Context

type Context = echo.Context

type DB

type DB = *gorm.DB

func DatabaseFactory

func DatabaseFactory() (DB, error)

type Environmental

type Environmental struct {
	ConfidentialityRequirements string
	IntegrityRequirements       string
	AvailabilityRequirements    string
}

func GetEnvironmental

func GetEnvironmental(ctx Context) Environmental

func GetEnvironmentalFromAsset

func GetEnvironmentalFromAsset(m models.Asset) Environmental

func SanitizeEnv

func SanitizeEnv(env Environmental) Environmental

type FilterQuery

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

func GetFilterQuery

func GetFilterQuery(ctx Context) []FilterQuery

func (FilterQuery) SQL

func (f FilterQuery) SQL() string

func (FilterQuery) Value

func (f FilterQuery) Value() any

type FlawEvent added in v0.5.1

type FlawEvent struct {
	Ctx   Context
	Event models.FlawEvent
}

type ManualMitigateEvent added in v0.5.1

type ManualMitigateEvent struct {
	Ctx Context
}

type MiddlewareFunc

type MiddlewareFunc = echo.MiddlewareFunc

type PageInfo

type PageInfo struct {
	PageSize int `json:"pageSize"`
	Page     int `json:"page"`
}

func GetPageInfo

func GetPageInfo(ctx Context) PageInfo

func (PageInfo) ApplyOnDB

func (p PageInfo) ApplyOnDB(db DB) DB

type Paged

type Paged[T any] struct {
	PageInfo
	Total int64 `json:"total"`
	Data  []T   `json:"data"`
}

func NewPaged

func NewPaged[T any](pageInfo PageInfo, total int64, data []T) Paged[T]

func (Paged[T]) Map

func (p Paged[T]) Map(f func(T) any) Paged[any]

type Repository added in v0.4.19

type Repository struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

type Server

type Server = *echo.Group

type SortQuery

type SortQuery struct {
	Field    string
	Operator string // asc or desc
}

func GetSortQuery

func GetSortQuery(ctx Context) []SortQuery

func (SortQuery) SQL

func (s SortQuery) SQL() string

type ThirdPartyIntegration added in v0.4.19

type ThirdPartyIntegration interface {
	IntegrationEnabled(ctx Context) bool

	WantsToHandleWebhook(ctx Context) bool
	HandleWebhook(ctx Context) error

	WantsToFinishInstallation(ctx Context) bool
	FinishInstallation(ctx Context) error

	ListRepositories(ctx Context) ([]Repository, error)

	HandleEvent(event any) error

	GetUsers(org models.Org) []User
}

func GetThirdPartyIntegration added in v0.4.19

func GetThirdPartyIntegration(c Context) ThirdPartyIntegration

type User added in v0.5.1

type User struct {
	Name      string  `json:"name"`
	ID        string  `json:"id"`
	AvatarURL *string `json:"avatarUrl"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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