Skip to content

Commit aca1e3b

Browse files
committed
Merge remote-tracking branch 'origin/main' into action_indices
2 parents 2f2234e + f034ee6 commit aca1e3b

File tree

332 files changed

+3375
-1467
lines changed

Some content is hidden

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

332 files changed

+3375
-1467
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,9 @@ release-sources: | $(DIST_DIRS)
646646
echo $(VERSION) > $(STORED_VERSION_FILE)
647647
# bsdtar needs a ^ to prevent matching subdirectories
648648
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
649-
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
649+
# use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
650+
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./gitea-src-$(VERSION)/'" || echo "--transform 's|^./|gitea-src-$(VERSION)/|'"))
651+
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
650652
rm -f $(STORED_VERSION_FILE)
651653

652654
.PHONY: release-docs

build.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build vendor
6-
// +build vendor
76

87
package main
98

build/code-batch-process.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build ignore
6-
// +build ignore
76

87
package main
98

build/generate-bindata.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build ignore
6-
// +build ignore
76

87
package main
98

build/generate-emoji.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// license that can be found in the LICENSE file.
55

66
//go:build ignore
7-
// +build ignore
87

98
package main
109

build/generate-gitignores.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build ignore
2-
// +build ignore
32

43
package main
54

build/generate-licenses.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build ignore
2-
// +build ignore
32

43
package main
54

build/gitea-format-imports.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build ignore
6-
// +build ignore
76

87
package main
98

build/gocovmerge.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// merges them into one profile
88

99
//go:build ignore
10-
// +build ignore
1110

1211
package main
1312

cmd/admin.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
repo_module "code.gitea.io/gitea/modules/repository"
2626
"code.gitea.io/gitea/modules/setting"
2727
"code.gitea.io/gitea/modules/storage"
28+
"code.gitea.io/gitea/modules/util"
2829
auth_service "code.gitea.io/gitea/services/auth"
2930
"code.gitea.io/gitea/services/auth/source/oauth2"
3031
"code.gitea.io/gitea/services/auth/source/smtp"
@@ -114,6 +115,10 @@ var (
114115
Name: "access-token",
115116
Usage: "Generate access token for the user",
116117
},
118+
cli.BoolFlag{
119+
Name: "restricted",
120+
Usage: "Make a restricted user account",
121+
},
117122
},
118123
}
119124

@@ -551,25 +556,34 @@ func runCreateUser(c *cli.Context) error {
551556

552557
// If this is the first user being created.
553558
// Take it as the admin and don't force a password update.
554-
if n := user_model.CountUsers(); n == 0 {
559+
if n := user_model.CountUsers(nil); n == 0 {
555560
changePassword = false
556561
}
557562

558563
if c.IsSet("must-change-password") {
559564
changePassword = c.Bool("must-change-password")
560565
}
561566

567+
restricted := util.OptionalBoolNone
568+
569+
if c.IsSet("restricted") {
570+
restricted = util.OptionalBoolOf(c.Bool("restricted"))
571+
}
572+
562573
u := &user_model.User{
563574
Name: username,
564575
Email: c.String("email"),
565576
Passwd: password,
566-
IsActive: true,
567577
IsAdmin: c.Bool("admin"),
568578
MustChangePassword: changePassword,
569-
Theme: setting.UI.DefaultTheme,
570579
}
571580

572-
if err := user_model.CreateUser(u); err != nil {
581+
overwriteDefault := &user_model.CreateUserOverwriteOptions{
582+
IsActive: util.OptionalBoolTrue,
583+
IsRestricted: restricted,
584+
}
585+
586+
if err := user_model.CreateUser(u, overwriteDefault); err != nil {
573587
return fmt.Errorf("CreateUser: %v", err)
574588
}
575589

0 commit comments

Comments
 (0)