mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-25 21:00:01 +02:00
routers/repo/http.go: allow HTTP push/pull by token for #845
This commit is contained in:
parent
19525abfc4
commit
ba77a3b0b4
2 changed files with 32 additions and 54 deletions
|
@ -62,21 +62,6 @@ func ListAccessTokens(uid int64) ([]*AccessToken, error) {
|
|||
return tokens, nil
|
||||
}
|
||||
|
||||
// ListAllAccessTokens returns all access tokens
|
||||
func ListAllAccessTokens() ([]*AccessToken, error) {
|
||||
tokens := make([]*AccessToken, 0, 5)
|
||||
err := x.Desc("id").Find(&tokens)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, t := range tokens {
|
||||
t.HasUsed = t.Updated.After(t.Created)
|
||||
t.HasRecentActivity = t.Updated.Add(7 * 24 * time.Hour).After(time.Now())
|
||||
}
|
||||
return tokens, nil
|
||||
}
|
||||
|
||||
// DeleteAccessTokenById deletes access token by given ID.
|
||||
func DeleteAccessTokenById(id int64) error {
|
||||
_, err := x.Id(id).Delete(new(AccessToken))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue