More work on getting auth fetch verification working
This commit is contained in:
parent
7eac1db475
commit
9957ba8302
12 changed files with 434 additions and 205 deletions
|
@ -1505,6 +1505,7 @@ type IUserDo interface {
|
|||
GetPagedAllDeleted(pageNr uint) (result []models.User, err error)
|
||||
GetPagedAllNonDeleted(pageNr uint) (result []models.User, err error)
|
||||
GdprUsers() (err error)
|
||||
GetRemoteAccountByApUrl(url string) (result *models.User, err error)
|
||||
}
|
||||
|
||||
// Get a user by a username, ignoring all restrictions on that user
|
||||
|
@ -1636,6 +1637,30 @@ func (u userDo) GdprUsers() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// Get user by AP url
|
||||
//
|
||||
// SELECT * FROM @@table
|
||||
//
|
||||
// WHERE id in (
|
||||
// SELECT user_id FROM user_remote_links
|
||||
// WHERE ap_link = @url LIMIT 1
|
||||
// )
|
||||
//
|
||||
// LIMIT 1
|
||||
func (u userDo) GetRemoteAccountByApUrl(url string) (result *models.User, err error) {
|
||||
var params []interface{}
|
||||
|
||||
var generateSQL strings.Builder
|
||||
params = append(params, url)
|
||||
generateSQL.WriteString("SELECT * FROM users WHERE id in ( SELECT user_id FROM user_remote_links WHERE ap_link = ? LIMIT 1 ) LIMIT 1 ")
|
||||
|
||||
var executeSQL *gorm.DB
|
||||
executeSQL = u.UnderlyingDB().Raw(generateSQL.String(), params...).Take(&result) // ignore_security_alert
|
||||
err = executeSQL.Error
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (u userDo) Debug() IUserDo {
|
||||
return u.withDO(u.DO.Debug())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue