base

package
v0.0.0-...-6e00032 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: GPL-3.0, LGPL-3.0 Imports: 38 Imported by: 6

Documentation

Index

Constants

View Source
const CurrencyDisplayPattern = `(\w+)\s*(?:\((.*)\))?`
View Source
const (
	// MODULE_NAME is the name of this module
	MODULE_NAME = "base"
)

Variables

View Source
var (
	WarningMessage = types.Selection{
		"no-message": "No Message",
		"warning":    "Warning",
		"block":      "Blocking Message",
	}
	WarningHelp = `` /* 204-byte string literal not displayed */

)
View Source
var (
	// GroupSystem is given to users who are allowed to modify general settings
	GroupSystem *security.Group
	// GroupUser is the group for Employees
	GroupUser *security.Group
	// GroupMultiCurrency displays data to work in a multi-currency context
	GroupMultiCurrency *security.Group
	// GroupPartnerManager is given to users who are allowed to manage contacts
	GroupPartnerManager *security.Group
	// GroupMultiCompany displays data to work in a multi-company context
	GroupMultiCompany *security.Group
	// GroupPortal is granted to portal users
	GroupPortal *security.Group
	// GroupPublic is granted to external users
	GroupPublic *security.Group
	// GroupERPManager can modify access rights for other users
	GroupERPManager *security.Group
	// GroupTechnicalFeatures can see and modify technical parameters of the ERP
	GroupTechnicalFeatures *security.Group
)
View Source
var CompanyDependent = models.FieldContexts{
	"company": func(rs models.RecordSet) string {
		companyID := rs.Env().Context().GetInteger("force_company")
		if companyID == 0 {
			companyID = rs.Env().Context().GetInteger("company_id")
		}
		if companyID == 0 {
			return ""
		}
		return fmt.Sprintf("%d", companyID)
	},
}

CompanyDependent is a context to add to make a field depend on the user's current company. If a company ID is passed in the context under the key "force_company", then this company is used instead.

View Source
var SequenceFuncs = map[string]func(time.Time) string{
	"doy": func(t time.Time) string {
		return fmt.Sprintf("%d", t.YearDay())
	},
	"woy": func(t time.Time) string {
		_, woy := t.ISOWeek()
		return fmt.Sprintf("%d", woy)
	},
	"weekday": func(t time.Time) string {
		return fmt.Sprintf("%d", int(t.Weekday()))
	},
}

SequenceFuncs maps Hexya formats to functions that must be applied to a time.Time object

View Source
var Sequences = map[string]string{
	"year": "2006", "month": "01", "day": "02", "y": "06",
	"h24": "15", "h12": "03", "min": "04", "sec": "05",
}

Sequences maps Hexya formats to Go time format

Functions

func CompanyGetUserCurrency

func CompanyGetUserCurrency(env models.Environment) interface{}

CompanyGetUserCurrency returns the currency of the current user's company if it exists or the default currency otherwise

Types

type BaseAuthBackend

type BaseAuthBackend struct{}

BaseAuthBackend is the authentication backend of the Base module Users are authenticated against the User model in the database

func (*BaseAuthBackend) Authenticate

func (bab *BaseAuthBackend) Authenticate(login, secret string, context *types.Context) (uid int64, err error)

Authenticate the user defined by login and secret.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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