Skip to content

Commit 65328d9

Browse files
committed
Merge remote-tracking branch 'origin/master' into update-outdated-comments-in-pull-request-label-style
* origin/master: [skip ci] Updated translations via Crowdin Fix diff skipping lines (go-gitea#13154) Update go-version v1.2.3 -> v1.2.4 (go-gitea#13169) Vendor Update Go Libs (go-gitea#13166) Prevent panics with missing storage (go-gitea#13164) Improve users management through the CLI (go-gitea#6001) (go-gitea#10492) Change order of possible-owner organizations to alphabetical (go-gitea#13160) Slightly simplify the queue settings code to help reduce the risk of problems (go-gitea#12976) [Vendor] Update go-ldap to v3.2.4 (go-gitea#13163) [skip ci] Updated translations via Crowdin Update external-renderers.en-us.md (go-gitea#13165)
2 parents 2457949 + 131278f commit 65328d9

File tree

737 files changed

+55950
-26478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

737 files changed

+55950
-26478
lines changed

cmd/admin.go

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,38 @@ var (
3030
Name: "admin",
3131
Usage: "Command line interface to perform common administrative operations",
3232
Subcommands: []cli.Command{
33-
subcmdCreateUser,
34-
subcmdChangePassword,
33+
subcmdUser,
3534
subcmdRepoSyncReleases,
3635
subcmdRegenerate,
3736
subcmdAuth,
3837
},
3938
}
4039

41-
subcmdCreateUser = cli.Command{
42-
Name: "create-user",
40+
subcmdUser = cli.Command{
41+
Name: "user",
42+
Usage: "Modify users",
43+
Subcommands: []cli.Command{
44+
microcmdUserCreate,
45+
microcmdUserList,
46+
microcmdUserChangePassword,
47+
microcmdUserDelete,
48+
},
49+
}
50+
51+
microcmdUserList = cli.Command{
52+
Name: "list",
53+
Usage: "List users",
54+
Action: runListUsers,
55+
Flags: []cli.Flag{
56+
cli.BoolFlag{
57+
Name: "admin",
58+
Usage: "List only admin users",
59+
},
60+
},
61+
}
62+
63+
microcmdUserCreate = cli.Command{
64+
Name: "create",
4365
Usage: "Create a new user in database",
4466
Action: runCreateUser,
4567
Flags: []cli.Flag{
@@ -83,7 +105,7 @@ var (
83105
},
84106
}
85107

86-
subcmdChangePassword = cli.Command{
108+
microcmdUserChangePassword = cli.Command{
87109
Name: "change-password",
88110
Usage: "Change a user's password",
89111
Action: runChangePassword,
@@ -101,6 +123,13 @@ var (
101123
},
102124
}
103125

126+
microcmdUserDelete = cli.Command{
127+
Name: "delete",
128+
Usage: "Delete specific user",
129+
Flags: []cli.Flag{idFlag},
130+
Action: runDeleteUser,
131+
}
132+
104133
subcmdRepoSyncReleases = cli.Command{
105134
Name: "repo-sync-releases",
106135
Usage: "Synchronize repository releases with tags",
@@ -377,6 +406,56 @@ func runCreateUser(c *cli.Context) error {
377406
return nil
378407
}
379408

409+
func runListUsers(c *cli.Context) error {
410+
if err := initDB(); err != nil {
411+
return err
412+
}
413+
414+
users, err := models.GetAllUsers()
415+
416+
if err != nil {
417+
return err
418+
}
419+
420+
w := tabwriter.NewWriter(os.Stdout, 5, 0, 1, ' ', 0)
421+
422+
if c.IsSet("admin") {
423+
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\n")
424+
for _, u := range users {
425+
if u.IsAdmin {
426+
fmt.Fprintf(w, "%d\t%s\t%s\t%t\n", u.ID, u.Name, u.Email, u.IsActive)
427+
}
428+
}
429+
} else {
430+
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\n")
431+
for _, u := range users {
432+
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin)
433+
}
434+
435+
}
436+
437+
w.Flush()
438+
return nil
439+
440+
}
441+
442+
func runDeleteUser(c *cli.Context) error {
443+
if !c.IsSet("id") {
444+
return fmt.Errorf("--id flag is missing")
445+
}
446+
447+
if err := initDB(); err != nil {
448+
return err
449+
}
450+
451+
user, err := models.GetUserByID(c.Int64("id"))
452+
if err != nil {
453+
return err
454+
}
455+
456+
return models.DeleteUser(user)
457+
}
458+
380459
func runRepoSyncReleases(c *cli.Context) error {
381460
if err := initDB(); err != nil {
382461
return err

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ FROM gitea/gitea:{{< version >}}
3636
COPY custom/app.ini /data/gitea/conf/app.ini
3737
[...]
3838
39-
RUN apk --no-cache add asciidoctor freetype freetype-dev gcc g++ libpng libffi-dev python-dev py-pip python3-dev py3-pip py3-pyzmq
39+
RUN apk --no-cache add asciidoctor freetype freetype-dev gcc g++ libpng libffi-dev py-pip python3-dev py3-pip py3-pyzmq
4040
# install any other package you need for your external renderers
4141
4242
RUN pip3 install --upgrade pip

docs/content/doc/usage/command-line.en-us.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,40 @@ Starts the server:
5555
Admin operations:
5656

5757
- Commands:
58-
- `create-user`
59-
- Options:
60-
- `--name value`: Username. Required. As of gitea 1.9.0, use the `--username` flag instead.
61-
- `--username value`: Username. Required. New in gitea 1.9.0.
62-
- `--password value`: Password. Required.
63-
- `--email value`: Email. Required.
64-
- `--admin`: If provided, this makes the user an admin. Optional.
65-
- `--access-token`: If provided, an access token will be created for the user. Optional. (default: false).
66-
- `--must-change-password`: If provided, the created user will be required to choose a newer password after
58+
- `user`:
59+
- `list`:
60+
- Options:
61+
- `--admin`: List only admin users. Optional.
62+
- Description: lists all users that exist
63+
- Examples:
64+
- `gitea admin user list`
65+
- `delete`:
66+
- Options:
67+
- `--id`: ID of user to be deleted. Required.
68+
- Examples:
69+
- `gitea admin user delete --id 1`
70+
- `create`:
71+
- Options:
72+
- `--name value`: Username. Required. As of gitea 1.9.0, use the `--username` flag instead.
73+
- `--username value`: Username. Required. New in gitea 1.9.0.
74+
- `--password value`: Password. Required.
75+
- `--email value`: Email. Required.
76+
- `--admin`: If provided, this makes the user an admin. Optional.
77+
- `--access-token`: If provided, an access token will be created for the user. Optional. (default: false).
78+
- `--must-change-password`: If provided, the created user will be required to choose a newer password after
6779
the initial login. Optional. (default: true).
68-
- ``--random-password``: If provided, a randomly generated password will be used as the password of
80+
- ``--random-password``: If provided, a randomly generated password will be used as the password of
6981
the created user. The value of `--password` will be discarded. Optional.
70-
- `--random-password-length`: If provided, it will be used to configure the length of the randomly
82+
- `--random-password-length`: If provided, it will be used to configure the length of the randomly
7183
generated password. Optional. (default: 12)
72-
- Examples:
73-
- `gitea admin create-user --username myname --password asecurepassword --email [email protected]`
74-
- `change-password`
75-
- Options:
76-
- `--username value`, `-u value`: Username. Required.
77-
- `--password value`, `-p value`: New password. Required.
78-
- Examples:
79-
- `gitea admin change-password --username myname --password asecurepassword`
84+
- Examples:
85+
- `gitea admin create-user --username myname --password asecurepassword --email [email protected]`
86+
- `change-password`:
87+
- Options:
88+
- `--username value`, `-u value`: Username. Required.
89+
- `--password value`, `-p value`: New password. Required.
90+
- Examples:
91+
- `gitea admin change-password --username myname --password asecurepassword`
8092
- `regenerate`
8193
- Options:
8294
- `hooks`: Regenerate git-hooks for all repositories

go.mod

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,109 +18,115 @@ require (
1818
gitea.com/macaron/session v0.0.0-20200902202411-e3a87877db6e
1919
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
2020
github.com/PuerkitoBio/goquery v1.5.1
21-
github.com/alecthomas/chroma v0.8.0
22-
github.com/blevesearch/bleve v1.0.10
21+
github.com/RoaringBitmap/roaring v0.5.1 // indirect
22+
github.com/alecthomas/chroma v0.8.1
23+
github.com/andybalholm/brotli v1.0.1 // indirect
24+
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
25+
github.com/blevesearch/bleve v1.0.12
2326
github.com/couchbase/gomemcached v0.0.0-20191004160342-7b5da2ec40b2 // indirect
2427
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d // indirect
2528
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
2629
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect
2730
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
2831
github.com/dgrijalva/jwt-go v3.2.0+incompatible
29-
github.com/dlclark/regexp2 v1.2.1 // indirect
32+
github.com/dlclark/regexp2 v1.4.0 // indirect
3033
github.com/dustin/go-humanize v1.0.0
31-
github.com/editorconfig/editorconfig-core-go/v2 v2.1.1
34+
github.com/editorconfig/editorconfig-core-go/v2 v2.3.7
3235
github.com/emirpasic/gods v1.12.0
3336
github.com/ethantkoenig/rupture v0.0.0-20180203182544-0a76f03a811a
3437
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect
3538
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
3639
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect
37-
github.com/gliderlabs/ssh v0.2.2
40+
github.com/gliderlabs/ssh v0.3.1
3841
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect
3942
github.com/go-enry/go-enry/v2 v2.5.2
4043
github.com/go-git/go-billy/v5 v5.0.0
41-
github.com/go-git/go-git/v5 v5.1.0
44+
github.com/go-git/go-git/v5 v5.2.0
45+
github.com/go-ldap/ldap/v3 v3.2.4
4246
github.com/go-redis/redis/v7 v7.4.0
4347
github.com/go-sql-driver/mysql v1.5.0
4448
github.com/go-swagger/go-swagger v0.25.0
4549
github.com/go-testfixtures/testfixtures/v3 v3.4.0
4650
github.com/gobwas/glob v0.2.3
4751
github.com/gogs/chardet v0.0.0-20191104214054-4b6791f73a28
4852
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
53+
github.com/golang/snappy v0.0.2 // indirect
4954
github.com/google/go-github/v32 v32.1.0
50-
github.com/google/uuid v1.1.1
55+
github.com/google/uuid v1.1.2
5156
github.com/gorilla/context v1.1.1
5257
github.com/hashicorp/go-retryablehttp v0.6.7 // indirect
5358
github.com/hashicorp/go-version v1.2.1
54-
github.com/huandu/xstrings v1.3.0
59+
github.com/huandu/xstrings v1.3.2
60+
github.com/imdario/mergo v0.3.11 // indirect
5561
github.com/issue9/assert v1.3.2 // indirect
5662
github.com/issue9/identicon v1.0.1
5763
github.com/jaytaylor/html2text v0.0.0-20160923191438-8fb95d837f7d
5864
github.com/jmhodges/levigo v1.0.0 // indirect
5965
github.com/kballard/go-shellquote v0.0.0-20170619183022-cd60e84ee657
6066
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
61-
github.com/klauspost/compress v1.10.11
67+
github.com/klauspost/compress v1.11.1
68+
github.com/klauspost/pgzip v1.2.5 // indirect
6269
github.com/lafriks/xormstore v1.3.2
6370
github.com/lib/pq v1.8.1-0.20200908161135-083382b7e6fc
6471
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
65-
github.com/markbates/goth v1.61.2
66-
github.com/mattn/go-colorable v0.1.7 // indirect
72+
github.com/markbates/goth v1.65.0
6773
github.com/mattn/go-isatty v0.0.12
6874
github.com/mattn/go-runewidth v0.0.9 // indirect
69-
github.com/mattn/go-sqlite3 v1.14.0
75+
github.com/mattn/go-sqlite3 v1.14.4
7076
github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81
7177
github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7
72-
github.com/mholt/archiver/v3 v3.3.0
73-
github.com/microcosm-cc/bluemonday v1.0.3-0.20191119130333-0a75d7616912
74-
github.com/minio/minio-go/v7 v7.0.4
78+
github.com/mholt/archiver/v3 v3.3.2
79+
github.com/microcosm-cc/bluemonday v1.0.4
80+
github.com/minio/minio-go/v7 v7.0.5
7581
github.com/mitchellh/go-homedir v1.1.0
7682
github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc
7783
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
7884
github.com/niklasfasching/go-org v1.3.2
7985
github.com/oliamb/cutter v0.2.2
80-
github.com/olivere/elastic/v7 v7.0.9
86+
github.com/olivere/elastic/v7 v7.0.20
8187
github.com/pelletier/go-toml v1.8.1
8288
github.com/pkg/errors v0.9.1
8389
github.com/pquerna/otp v1.2.0
84-
github.com/prometheus/client_golang v1.1.0
85-
github.com/prometheus/procfs v0.0.4 // indirect
90+
github.com/prometheus/client_golang v1.8.0
8691
github.com/quasoft/websspi v1.0.0
8792
github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001 // indirect
8893
github.com/sergi/go-diff v1.1.0
89-
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b // indirect
90-
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
94+
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
95+
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
9196
github.com/stretchr/testify v1.6.1
9297
github.com/syndtr/goleveldb v1.0.0
9398
github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481 // indirect
9499
github.com/tinylib/msgp v1.1.2 // indirect
95100
github.com/tstranex/u2f v1.0.0
101+
github.com/ulikunitz/xz v0.5.8 // indirect
96102
github.com/unknwon/com v1.0.1
97103
github.com/unknwon/i18n v0.0.0-20200823051745-09abd91c7f2c
98104
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141
99-
github.com/urfave/cli v1.20.0
100-
github.com/xanzy/go-gitlab v0.37.0
105+
github.com/urfave/cli v1.22.4
106+
github.com/willf/bitset v1.1.11 // indirect
107+
github.com/xanzy/go-gitlab v0.38.1
101108
github.com/yohcop/openid-go v1.0.0
102109
github.com/yuin/goldmark v1.2.1
103110
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
104111
github.com/yuin/goldmark-meta v0.0.0-20191126180153-f0638e958b60
105112
go.jolheiser.com/hcaptcha v0.0.4
106113
go.jolheiser.com/pwn v0.0.3
107-
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
108-
golang.org/x/net v0.0.0-20200904194848-62affa334b73
109-
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
110-
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff
114+
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee
115+
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
116+
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
117+
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
111118
golang.org/x/text v0.3.3
112119
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
113-
golang.org/x/tools v0.0.0-20200921210052-fa0125251cc4
120+
golang.org/x/tools v0.0.0-20200929161345-d7fc70abf50f
121+
google.golang.org/appengine v1.6.7 // indirect
114122
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
115-
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect
116123
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
117-
gopkg.in/ini.v1 v1.61.0
118-
gopkg.in/ldap.v3 v3.0.2
124+
gopkg.in/ini.v1 v1.62.0
119125
gopkg.in/yaml.v2 v2.3.0
120-
mvdan.cc/xurls/v2 v2.1.0
126+
mvdan.cc/xurls/v2 v2.2.0
121127
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
122128
xorm.io/builder v0.3.7
123129
xorm.io/xorm v1.0.5
124130
)
125131

126-
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.2.3
132+
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.2.4

0 commit comments

Comments
 (0)