permissions

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAY_INVOICE_SCOPE       = "pay_invoice" // also covers pay_keysend and multi_* payment methods
	GET_BALANCE_SCOPE       = "get_balance"
	GET_INFO_SCOPE          = "get_info"
	MAKE_INVOICE_SCOPE      = "make_invoice"
	LOOKUP_INVOICE_SCOPE    = "lookup_invoice"
	LIST_TRANSACTIONS_SCOPE = "list_transactions"
	SIGN_MESSAGE_SCOPE      = "sign_message"
	NOTIFICATIONS_SCOPE     = "notifications" // covers all notification types
)

Variables

This section is empty.

Functions

func AllScopes

func AllScopes() []string

func NewPermissionsService

func NewPermissionsService(db *gorm.DB, eventPublisher events.EventPublisher) *permissionsService

func RequestMethodToScope

func RequestMethodToScope(requestMethod string) (string, error)

func RequestMethodsToScopes

func RequestMethodsToScopes(requestMethods []string) ([]string, error)

Types

type PermissionsService

type PermissionsService interface {
	HasPermission(app *db.App, requestMethod string, amount uint64) (result bool, code string, message string)
	GetBudgetUsage(appPermission *db.AppPermission) uint64
	GetPermittedMethods(app *db.App, lnClient lnclient.LNClient) []string
	PermitsNotifications(app *db.App) bool
}

TODO: does this need to be a service?

Jump to

Keyboard shortcuts

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