summaryrefslogtreecommitdiffstats
path: root/cmd/admin.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/admin.go')
-rw-r--r--cmd/admin.go35
1 files changed, 17 insertions, 18 deletions
diff --git a/cmd/admin.go b/cmd/admin.go
index 6c2a8626c4..2cf63d384a 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -13,9 +13,8 @@ import (
"strings"
"text/tabwriter"
- "code.gitea.io/gitea/models"
asymkey_model "code.gitea.io/gitea/models/asymkey"
- "code.gitea.io/gitea/models/auth"
+ auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
@@ -593,12 +592,12 @@ func runCreateUser(c *cli.Context) error {
}
if c.Bool("access-token") {
- t := &models.AccessToken{
+ t := &auth_model.AccessToken{
Name: "gitea-admin",
UID: u.ID,
}
- if err := models.NewAccessToken(t); err != nil {
+ if err := auth_model.NewAccessToken(t); err != nil {
return err
}
@@ -700,12 +699,12 @@ func runGenerateAccessToken(c *cli.Context) error {
return err
}
- t := &models.AccessToken{
+ t := &auth_model.AccessToken{
Name: c.String("token-name"),
UID: user.ID,
}
- if err := models.NewAccessToken(t); err != nil {
+ if err := auth_model.NewAccessToken(t); err != nil {
return err
}
@@ -779,9 +778,9 @@ func runRepoSyncReleases(_ *cli.Context) error {
}
func getReleaseCount(id int64) (int64, error) {
- return models.GetReleaseCountByRepoID(
+ return repo_model.GetReleaseCountByRepoID(
id,
- models.FindReleasesOptions{
+ repo_model.FindReleasesOptions{
IncludeTags: true,
},
)
@@ -844,8 +843,8 @@ func runAddOauth(c *cli.Context) error {
return err
}
- return auth.CreateSource(&auth.Source{
- Type: auth.OAuth2,
+ return auth_model.CreateSource(&auth_model.Source{
+ Type: auth_model.OAuth2,
Name: c.String("name"),
IsActive: true,
Cfg: parseOAuth2Config(c),
@@ -864,7 +863,7 @@ func runUpdateOauth(c *cli.Context) error {
return err
}
- source, err := auth.GetSourceByID(c.Int64("id"))
+ source, err := auth_model.GetSourceByID(c.Int64("id"))
if err != nil {
return err
}
@@ -944,7 +943,7 @@ func runUpdateOauth(c *cli.Context) error {
oAuth2Config.CustomURLMapping = customURLMapping
source.Cfg = oAuth2Config
- return auth.UpdateSource(source)
+ return auth_model.UpdateSource(source)
}
func parseSMTPConfig(c *cli.Context, conf *smtp.Source) error {
@@ -1015,8 +1014,8 @@ func runAddSMTP(c *cli.Context) error {
smtpConfig.Auth = "PLAIN"
}
- return auth.CreateSource(&auth.Source{
- Type: auth.SMTP,
+ return auth_model.CreateSource(&auth_model.Source{
+ Type: auth_model.SMTP,
Name: c.String("name"),
IsActive: active,
Cfg: &smtpConfig,
@@ -1035,7 +1034,7 @@ func runUpdateSMTP(c *cli.Context) error {
return err
}
- source, err := auth.GetSourceByID(c.Int64("id"))
+ source, err := auth_model.GetSourceByID(c.Int64("id"))
if err != nil {
return err
}
@@ -1056,7 +1055,7 @@ func runUpdateSMTP(c *cli.Context) error {
source.Cfg = smtpConfig
- return auth.UpdateSource(source)
+ return auth_model.UpdateSource(source)
}
func runListAuth(c *cli.Context) error {
@@ -1067,7 +1066,7 @@ func runListAuth(c *cli.Context) error {
return err
}
- authSources, err := auth.Sources()
+ authSources, err := auth_model.Sources()
if err != nil {
return err
}
@@ -1105,7 +1104,7 @@ func runDeleteAuth(c *cli.Context) error {
return err
}
- source, err := auth.GetSourceByID(c.Int64("id"))
+ source, err := auth_model.GetSourceByID(c.Int64("id"))
if err != nil {
return err
}