Merge branch 'main' into feature/appstore
This commit is contained in:
@@ -246,6 +246,7 @@ func EditUser(ctx *context.APIContext) {
|
||||
MaxRepoCreation: optional.FromPtr(form.MaxRepoCreation),
|
||||
AllowCreateOrganization: optional.FromPtr(form.AllowCreateOrganization),
|
||||
AllowCreateDevcontainer: optional.FromPtr(form.AllowCreateDevcontainer),
|
||||
AllowCreateActRunner: optional.FromPtr(form.AllowCreateActRunner),
|
||||
IsRestricted: optional.FromPtr(form.Restricted),
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ func Install(ctx *context.Context) {
|
||||
form.DefaultKeepEmailPrivate = setting.Service.DefaultKeepEmailPrivate
|
||||
form.DefaultAllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization
|
||||
form.DefaultAllowCreateDevcontainer = setting.Service.DefaultAllowCreateDevcontainer
|
||||
form.DefaultAllowCreateActRunner = setting.Service.DefaultAllowCreateActRunner
|
||||
form.DefaultEnableTimetracking = setting.Service.DefaultEnableTimetracking
|
||||
form.NoReplyAddress = setting.Service.NoReplyAddress
|
||||
form.PasswordAlgorithm = hash.ConfigHashAlgorithm(setting.PasswordHashAlgo)
|
||||
@@ -492,6 +493,7 @@ func SubmitInstall(ctx *context.Context) {
|
||||
cfg.Section("service").Key("DEFAULT_KEEP_EMAIL_PRIVATE").SetValue(strconv.FormatBool(form.DefaultKeepEmailPrivate))
|
||||
cfg.Section("service").Key("DEFAULT_ALLOW_CREATE_ORGANIZATION").SetValue(strconv.FormatBool(form.DefaultAllowCreateOrganization))
|
||||
cfg.Section("service").Key("DEFAULT_ALLOW_CREATE_DEVCONTAINER").SetValue(strconv.FormatBool(form.DefaultAllowCreateDevcontainer))
|
||||
cfg.Section("service").Key("DEFAULT_ALLOW_CREATE_ACTRUNNER").SetValue(strconv.FormatBool(form.DefaultAllowCreateActRunner))
|
||||
cfg.Section("service").Key("DEFAULT_ENABLE_TIMETRACKING").SetValue(strconv.FormatBool(form.DefaultEnableTimetracking))
|
||||
cfg.Section("service").Key("NO_REPLY_ADDRESS").SetValue(form.NoReplyAddress)
|
||||
cfg.Section("cron.update_checker").Key("ENABLED").SetValue(strconv.FormatBool(form.EnableUpdateChecker))
|
||||
@@ -630,17 +632,24 @@ func SubmitInstall(ctx *context.Context) {
|
||||
|
||||
if form.K8sEnable {
|
||||
//K8s环境检测
|
||||
cfg.Section("devstar.devcontainer").Key("HOST").SetValue(form.Domain)
|
||||
} else {
|
||||
if !checkDocker(ctx, &form) {
|
||||
ctx.RenderWithErr("There is no docker environment", tplInstall, &form)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 注册Global Runners
|
||||
if setting.Runner.AutoStart {
|
||||
for i := 0; i < setting.Runner.Count; i++ {
|
||||
runners_service.RegistGlobalRunner(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
setting.ClearEnvConfigKeys()
|
||||
log.Info("First-time run install finished!")
|
||||
InstallDone(ctx)
|
||||
|
||||
|
||||
go func() {
|
||||
// Sleep for a while to make sure the user's browser has loaded the post-install page and its assets (images, css, js)
|
||||
// What if this duration is not long enough? That's impossible -- if the user can't load the simple page in time, how could they install or use Gitea in the future ....
|
||||
@@ -654,8 +663,6 @@ func SubmitInstall(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
runners_service.RegistGlobalRunner(otherCtx)
|
||||
|
||||
// Now get the http.Server from this request and shut it down
|
||||
// NB: This is not our hammerable graceful shutdown this is http.Server.Shutdown
|
||||
srv := ctx.Value(http.ServerContextKey).(*http.Server)
|
||||
|
||||
@@ -437,6 +437,7 @@ func EditUserPost(ctx *context.Context) {
|
||||
MaxRepoCreation: optional.Some(form.MaxRepoCreation),
|
||||
AllowCreateOrganization: optional.Some(form.AllowCreateOrganization),
|
||||
AllowCreateDevcontainer: optional.Some(form.AllowCreateDevcontainer),
|
||||
AllowCreateActRunner: optional.Some(form.AllowCreateActRunner),
|
||||
IsRestricted: optional.Some(form.Restricted),
|
||||
Visibility: optional.Some(form.Visibility),
|
||||
Language: optional.Some(form.Language),
|
||||
@@ -450,7 +451,6 @@ func EditUserPost(ctx *context.Context) {
|
||||
}
|
||||
return
|
||||
}
|
||||
log.Trace("Account profile updated by admin (%s): %s", ctx.Doer.Name, u.Name)
|
||||
|
||||
if form.Reset2FA {
|
||||
tf, err := auth.GetTwoFactorByUID(ctx, u.ID)
|
||||
|
||||
@@ -160,6 +160,7 @@ func Runners(ctx *context.Context) {
|
||||
ctx.Data["RunnerOwnerID"] = opts.OwnerID
|
||||
ctx.Data["RunnerRepoID"] = opts.RepoID
|
||||
ctx.Data["SortType"] = opts.Sort
|
||||
ctx.Data["AllowCreateActRunner"] = ctx.Doer.AllowCreateActRunner
|
||||
|
||||
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
||||
|
||||
@@ -300,6 +301,14 @@ func RegisterARunner(ctx *context.Context) {
|
||||
ctx.ServerError("getRunnersCtx", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 检查用户是否有权创建 runner
|
||||
if !ctx.Doer.AllowCreateActRunner {
|
||||
ctx.Flash.Error(ctx.Tr("actions.runners.create_runner_permission_denied"))
|
||||
ctx.Redirect(rCtx.RedirectLink)
|
||||
return
|
||||
}
|
||||
|
||||
token, err := actions_model.NewRunnerToken(ctx, rCtx.OwnerID, rCtx.RepoID)
|
||||
if err != nil {
|
||||
ctx.ServerError("NewRunnerToken", err)
|
||||
|
||||
Reference in New Issue
Block a user