Add Link API.

This commit is contained in:
Yang Luo
2021-04-19 01:14:41 +08:00
parent 6774b0379c
commit 36895801f0
14 changed files with 143 additions and 43 deletions

View File

@ -80,6 +80,22 @@ func getApplication(owner string, name string) *Application {
}
}
func GetDefaultApplication(owner string) *Application {
name := "app-built-in"
application := Application{Owner: owner, Name: name}
existed, err := adapter.engine.Get(&application)
if err != nil {
panic(err)
}
if existed {
extendApplication(&application)
return &application
} else {
return nil
}
}
func getApplicationByClientId(clientId string) *Application {
application := Application{}
existed, err := adapter.engine.Where("client_id=?", clientId).Get(&application)

View File

@ -15,6 +15,8 @@
package object
import (
"strings"
"github.com/casdoor/casdoor/util"
"xorm.io/core"
)
@ -41,6 +43,17 @@ func GetProviders(owner string) []*Provider {
return providers
}
func GetDefaultProviders(owner string) []*Provider {
providers := GetProviders(owner)
res := []*Provider{}
for _, provider := range providers {
if strings.Contains(provider.Name, "casdoor") {
res = append(res, provider)
}
}
return res
}
func getProvider(owner string, name string) *Provider {
provider := Provider{Owner: owner, Name: name}
existed, err := adapter.engine.Get(&provider)