Add user to Resource.

This commit is contained in:
Yang Luo
2021-09-05 23:46:38 +08:00
parent 90ec8ec787
commit a1b16f88d1
6 changed files with 26 additions and 5 deletions

View File

@ -26,6 +26,7 @@ type Resource struct {
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
User string `xorm:"varchar(100)" json:"user"`
Provider string `xorm:"varchar(100)" json:"provider"`
Application string `xorm:"varchar(100)" json:"application"`
Tag string `xorm:"varchar(100)" json:"tag"`
@ -38,6 +39,10 @@ type Resource struct {
}
func GetResources(owner string) []*Resource {
if owner == "admin" {
owner = ""
}
resources := []*Resource{}
err := adapter.Engine.Desc("created_time").Find(&resources, &Resource{Owner: owner})
if err != nil {