security

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjPbehavior          = "api_pbehavior"
	ObjPbehaviorType      = "api_pbehaviortype"
	ObjPbehaviorReason    = "api_pbehaviorreason"
	ObjPbehaviorException = "api_pbehaviorexception"

	ObjAction = "api_action"

	ObjEntity         = "api_entity"
	ObjEntityService  = "api_entityservice"
	ObjEntityCategory = "api_entitycategory"
	ObjContextGraph   = "api_contextgraph"

	ObjView           = "api_view"
	ObjWidgetTemplate = "api_widgettemplate"
	ObjViewGroup      = "api_viewgroup"
	ObjPlaylist       = "api_playlist"

	PermAlarmRead   = "api_alarm_read"
	PermAlarmUpdate = "api_alarm_update"

	PermAcl = "api_acl"

	PermShareToken = "api_share_token"

	ObjStateSettings = "api_state_settings"

	PermDataStorageRead   = "api_datastorage_read"
	PermDataStorageUpdate = "api_datastorage_update"

	ObjEventFilter = "api_eventfilter"

	ObjBroadcastMessage = "api_broadcast_message"

	ObjAssociativeTable = "api_associative_table"

	PermUserInterfaceUpdate = "api_user_interface_update"
	PermUserInterfaceDelete = "api_user_interface_delete"

	PermEvent = "api_event"

	ObjIdleRule = "api_idlerule"

	PermNotification = "api_notification"

	PermMessageRateStatsRead = "api_message_rate_stats_read"

	PermHealthcheck = "api_healthcheck"

	ObjFile = "api_file"

	ObjFlappingRule = "api_flapping_rule"
	ObjResolveRule  = "api_resolve_rule"

	PermCorporatePattern = "api_corporate_pattern"

	PermExportConfigurations = "api_export_configurations"

	PermTechMetrics = "api_techmetrics"

	ObjLinkRule = "api_link_rule"

	ObjAlarmTag = "api_alarm_tag"

	PermMaintenance = "api_maintenance"

	ObjColorTheme = "api_color_theme"

	PermPrivateViewGroups = "api_private_view_groups"

	PermIcon = "api_icon"
)
View Source
const (
	OwnershipNone byte = iota
	OwnershipPublic
	OwnershipOwner
	OwnershipNotOwner
	OwnershipNotFound
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMethodConf

type AuthMethodConf struct {
	ExpirationInterval *datetime.DurationWithUnit `bson:"expiration_interval" json:"expiration_interval"`
	InactivityInterval *datetime.DurationWithUnit `bson:"inactivity_interval" json:"inactivity_interval"`
}

type OwnedObjectsProvider

type OwnedObjectsProvider interface {
	GetOwnedIDs(ctx context.Context, userID string) ([]string, error)
}

func NewViewOwnedObjectsProvider

func NewViewOwnedObjectsProvider(client libmongo.DbClient) OwnedObjectsProvider

type OwnershipStrategy

type OwnershipStrategy interface {
	IsOwner(ctx context.Context, id, userID string) (byte, error)
}

func NewViewGroupOwnershipStrategy

func NewViewGroupOwnershipStrategy(client libmongo.DbClient) OwnershipStrategy

func NewViewOwnerStrategy

func NewViewOwnerStrategy(client libmongo.DbClient, enforcer security.Enforcer, linkedViewPermission string) OwnershipStrategy

func NewViewTabOwnershipStrategy

func NewViewTabOwnershipStrategy(client libmongo.DbClient, enforcer security.Enforcer, linkedViewPermission string) OwnershipStrategy

func NewWidgetOwnershipStrategy

func NewWidgetOwnershipStrategy(client libmongo.DbClient, enforcer security.Enforcer, linkedViewPermission string) OwnershipStrategy

type PermCheck

type PermCheck struct {
	Obj string
	Act string
}

PermCheck defines the permission check configuration where Obj is an object and Act is an action

type PrivacySettings

type PrivacySettings struct {
	Author    string `bson:"author"`
	IsPrivate bool   `bson:"is_private"`
}

type TokenService

type TokenService interface {
	Create(ctx context.Context, user security.User, provider string) (string, error)
	CreateWithExpiration(ctx context.Context, user security.User, provider string, expiredAt time.Time) (string, error)
	Delete(ctx context.Context, token string) (bool, error)
	DeleteBy(ctx context.Context, user, provider string) error
	DeleteByUserIDs(ctx context.Context, ids []string) error
}

func NewTokenService

func NewTokenService(
	config security.Config,
	client mongo.DbClient,
	generator token.Generator,
	store TokenStore,
) TokenService

type TokenStore

type TokenStore interface {
	Save(ctx context.Context, token token.Token) error
	Delete(ctx context.Context, id string) (bool, error)
	DeleteBy(ctx context.Context, user, provider string) error
	DeleteByUserIDs(ctx context.Context, ids []string) error
}

type ViewTabPrivacySettings

type ViewTabPrivacySettings struct {
	PrivacySettings `bson:"inline"`
	View            string `bson:"view"`
}

Jump to

Keyboard shortcuts

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