models

package
v0.0.0-...-e9593d0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_TESTING   = "testing"
	STATUS_REJECTED  = "rejected"
	STATUS_PUBLISHED = "published"
)
View Source
const (
	KARMA_UP         = "+"
	KARMA_DOWN       = "-"
	KARMA_MAINTAINER = "*"
	KARMA_BLOCK      = "v"
	KARMA_PUSH       = "^"
	KARMA_NONE       = "_"
	KARMA_FINALIZE   = "o"
	KARMA_CLEAR      = "x"
)
View Source
const (
	PERMISSION_ADMIN     = "kahinah.admin"
	PERMISSION_QA        = "kahinah.qa"
	PERMISSION_WHITELIST = "kahinah.whitelist"

	PERMISSION_ADVISORY = "kahinah.advisory"
	PERMISSION_API      = "kahinah.api"
)

Variables

View Source
var (
	Prefix = beego.AppConfig.String("database::db_prefix")
	DbType = beego.AppConfig.String("database::db_type")
	DbName = beego.AppConfig.String("database::db_name")
	DbHost = beego.AppConfig.String("database::db_host")
	DbUser = beego.AppConfig.String("database::db_user")
	DbPass = beego.AppConfig.String("database::db_pass")
)

Functions

func IsLoggedIn

func IsLoggedIn(controller *beego.Controller) string

func IssueAdvisory

func IssueAdvisory(advisory *Advisory)

func NextAdvisoryId

func NextAdvisoryId(prefix string) uint64

func PermAbortCheck

func PermAbortCheck(c *beego.Controller, perm string)

func PermCheck

func PermCheck(c *beego.Controller, perm string) bool

func PermRegister

func PermRegister(perm string)

Types

type Advisory

type Advisory struct {
	Id uint64 `orm:"auto;pk"`

	Platform   string
	Prefix     string
	AdvisoryId uint64

	Creator     *User  `orm:"rel(fk)"`
	Summary     string `orm:"type(text)"`
	Description string `orm:"type(text)"`

	Type string // type of advisory (bugfix, security, etc)

	BugsFixed string `orm:"type(text)"` // format: 123;234;534;123;133

	Requested time.Time `orm:"auto_now_add"`
	Issued    time.Time // will not be filled until advisory is approved
	Updated   time.Time `orm:"auto_now"`

	Updates []*BuildList `orm:"reverse(many)"`
}

advisories are automatically issued when one or more buildlists are upvoted.

type BuildList

type BuildList struct {
	// represent unique id
	Id uint64 `xml:"id,attr" orm:"auto;pk"`
	// represent platform
	Platform string `xml:"info>platform"`
	// represent the repo it's being saved to
	Repo string `xml:"info>platform>repo"`
	// represent the arch
	Architecture string `xml:"info>platform>arch"`
	// represent its name
	Name string `xml:"info>name"`
	// represents the user
	Submitter *User `xml:"info>submitter" orm:"rel(fk)"`
	// represents the update type (bugfix, new package, security, etc)
	Type string `xml:"type"`
	// represents the current status of this update
	Status string `xml:"status"`
	// lists packages
	Packages []*BuildListPkg `xml:"packages" orm:"reverse(many)"`
	// lists the changelog url
	Changelog string `xml:"changelog" orm:"type(text)"` // url
	// lists the builddate
	BuildDate time.Time `xml:"time"`
	// lists the updatetime
	Updated time.Time `xml:"updated" orm:"auto_now"`
	// lists the karma
	Karma []*Karma `xml:"karma" orm:"reverse(many)"`
	// shows the diff
	Diff string `xml:"diff" orm:"type(text)"`
	// shows the link to an advisory, if any
	Advisory *Advisory `xml:"advisory" orm:"null;rel(fk);on_delete(set_null)"`

	// abf specifics (abf is represented as the handler)
	HandleId       string `xml:"handle>id,attr"` // for the handler to identify the package in the buildsystem
	HandleProject  string `xml:"handle>project" orm:"type(text)"`
	HandleCommitId string `xml:"handle>commitid" orm:"type(text)"`
}

func (*BuildList) SourceEVR

func (l *BuildList) SourceEVR() string

type BuildListPkg

type BuildListPkg struct {
	Id      uint64     `orm:"auto;pk"`
	List    *BuildList `orm:"rel(fk)"`
	Name    string
	Type    string
	Epoch   int64
	Version string
	Release string
	Arch    string
	Url     string `orm:"type(text)"`
}

type GithubCheckController

type GithubCheckController struct {
	beego.Controller
}

func (*GithubCheckController) Get

func (this *GithubCheckController) Get()

type GithubLoginCallbackController

type GithubLoginCallbackController struct {
	beego.Controller
}

func (*GithubLoginCallbackController) Get

func (this *GithubLoginCallbackController) Get()

type GithubLoginController

type GithubLoginController struct {
	beego.Controller
}

func (*GithubLoginController) Get

func (this *GithubLoginController) Get()

type GithubLogoutController

type GithubLogoutController struct {
	beego.Controller
}

func (*GithubLogoutController) Get

func (this *GithubLogoutController) Get()

type Karma

type Karma struct {
	Id      uint64     `orm:"auto;pk"`
	List    *BuildList `orm:"rel(fk)"`
	User    *User      `orm:"rel(fk)"`
	Vote    string
	Comment string    `orm:"type(text)"`
	Time    time.Time `orm:"auto_now;type(datetime)"`
}

type User

type User struct {
	Id          uint64 `orm:"auto;pk"`
	Email       string `orm:"type(text)"`
	Integration string `orm:"type(text)"` // abf service user id

	ApiKey string `orm:"type(text)"`

	Permissions []*UserPermission `orm:"rel(m2m);on_delete(set_null)"`
	Karma       []*Karma          `orm:"reverse(many);on_delete(set_null)"`

	BuildLists []*BuildList `orm:"null;reverse(many);on_delete(set_null)"`
	Advisories []*Advisory  `orm:"null;reverse(many);on_delete(set_null)"`
}

func FindUser

func FindUser(email string) *User

Finds the user with the given email address. If a user doesn't exist, it creates one and returns it.

This is more commonly used with persona for login details, and with integrators to add buildlists.

func FindUserApi

func FindUserApi(apikey string) *User

func FindUserNoCreate

func FindUserNoCreate(email string) *User

func (*User) Save

func (u *User) Save()

func (*User) String

func (u *User) String() string

type UserPermission

type UserPermission struct {
	Id         uint64  `orm:"auto;pk"`
	Permission string  `orm:"type(text);unique"`
	Users      []*User `orm:"null;reverse(many);on_delete(set_null)"`
}

func PermGet

func PermGet(perm string) *UserPermission

func PermGetAll

func PermGetAll() []*UserPermission

func (*UserPermission) Save

func (u *UserPermission) Save()

Jump to

Keyboard shortcuts

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