mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Add Link API.
This commit is contained in:
@ -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)
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user