mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Refactor GetDefaultApplication().
This commit is contained in:
@ -89,10 +89,9 @@ 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)
|
||||
func getApplicationByOrganization(organization string) *Application {
|
||||
application := Application{}
|
||||
existed, err := adapter.Engine.Where("organization=?", organization).Get(&application)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -106,6 +105,10 @@ func GetDefaultApplication(owner string) *Application {
|
||||
}
|
||||
}
|
||||
|
||||
func GetApplicationByUser(user *User) *Application {
|
||||
return getApplicationByOrganization(user.Owner)
|
||||
}
|
||||
|
||||
func getApplicationByClientId(clientId string) *Application {
|
||||
application := Application{}
|
||||
existed, err := adapter.Engine.Where("client_id=?", clientId).Get(&application)
|
||||
|
Reference in New Issue
Block a user