Skip to content

Commit 3f675f6

Browse files
committed
Merge branch 'master' into search_type
2 parents 33504f4 + b7deea0 commit 3f675f6

File tree

832 files changed

+56164
-27321
lines changed

Some content is hidden

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

832 files changed

+56164
-27321
lines changed

.eslintrc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ rules:
9999
import/no-amd: [0]
100100
import/no-anonymous-default-export: [0]
101101
import/no-commonjs: [0]
102-
import/no-cycle: [0]
102+
import/no-cycle: [2, {ignoreExternal: true}]
103103
import/no-default-export: [0]
104104
import/no-deprecated: [0]
105105
import/no-dynamic-require: [0]
@@ -117,7 +117,7 @@ rules:
117117
import/no-self-import: [2]
118118
import/no-unassigned-import: [0]
119119
import/no-unresolved: [2, {commonjs: true}]
120-
import/no-unused-modules: [0]
120+
import/no-unused-modules: [2, {unusedExports: true}]
121121
import/no-useless-path-segments: [2, {commonjs: true}]
122122
import/no-webpack-loader-syntax: [2]
123123
import/order: [0]
@@ -211,7 +211,7 @@ rules:
211211
no-mixed-operators: [0]
212212
no-mixed-spaces-and-tabs: [2]
213213
no-multi-assign: [0]
214-
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}]
214+
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true}}]
215215
no-multi-str: [2]
216216
no-negated-condition: [0]
217217
no-nested-ternary: [0]
@@ -336,6 +336,7 @@ rules:
336336
unicorn/explicit-length-check: [0]
337337
unicorn/filename-case: [0]
338338
unicorn/import-index: [0]
339+
unicorn/import-style: [0]
339340
unicorn/new-for-builtins: [2]
340341
unicorn/no-abusive-eslint-disable: [0]
341342
unicorn/no-array-instanceof: [0]
@@ -356,11 +357,13 @@ rules:
356357
unicorn/no-useless-undefined: [0]
357358
unicorn/no-zero-fractions: [2]
358359
unicorn/number-literal-case: [0]
360+
unicorn/numeric-separators-style: [0]
359361
unicorn/prefer-add-event-listener: [2]
360362
unicorn/prefer-array-find: [2]
361363
unicorn/prefer-dataset: [2]
362364
unicorn/prefer-event-key: [2]
363365
unicorn/prefer-includes: [2]
366+
unicorn/prefer-math-trunc: [2]
364367
unicorn/prefer-modern-dom-apis: [0]
365368
unicorn/prefer-negative-index: [2]
366369
unicorn/prefer-node-append: [0]
@@ -374,6 +377,7 @@ rules:
374377
unicorn/prefer-spread: [0]
375378
unicorn/prefer-starts-ends-with: [2]
376379
unicorn/prefer-string-slice: [0]
380+
unicorn/prefer-ternary: [0]
377381
unicorn/prefer-text-content: [2]
378382
unicorn/prefer-trim-start-end: [2]
379383
unicorn/prefer-type-error: [0]

.github/issue_template.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
- Gitea version (or commit ref):
1313
- Git version:
1414
- Operating system:
15+
<!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package -->
16+
<!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. --->
17+
<!-- If you are using a package or systemd tell us what distribution you are using -->
1518
- Database (use `[x]`):
1619
- [ ] PostgreSQL
1720
- [ ] MySQL
@@ -20,8 +23,10 @@
2023
- Can you reproduce the bug at https://try.gitea.io:
2124
- [ ] Yes (provide example URL)
2225
- [ ] No
23-
- [ ] Not relevant
2426
- Log gist:
27+
<!-- It really is important to provide pertinent logs -->
28+
<!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems -->
29+
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
2530

2631
## Description
2732

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7-
## [1.13.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.13.0-RC1) - 2020-10-14
7+
## [1.13.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.13.0-rc1) - 2020-10-14
88

99
* SECURITY
1010
* Mitigate Security vulnerability in the git hook feature (#13058)

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ RUN apk --no-cache add \
3737
openssh \
3838
s6 \
3939
sqlite \
40+
socat \
4041
su-exec \
4142
gnupg
4243

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Mura Li <[email protected]> (@typeless)
3737
jaqra <[email protected]> (@jaqra)
3838
David Svantesson <[email protected]> (@davidsvantesson)
3939
CirnoT <[email protected]> (@CirnoT)
40+
a1012112796 <[email protected]> (@a1012112796)

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

0 commit comments

Comments
 (0)