mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.8 KiB
77 lines
2.8 KiB
11 years ago
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||
6 years ago
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||
11 years ago
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
4 years ago
|
package forms
|
||
11 years ago
|
|
||
|
import (
|
||
4 years ago
|
"net/http"
|
||
|
|
||
|
"code.gitea.io/gitea/modules/context"
|
||
6 years ago
|
"code.gitea.io/gitea/modules/structs"
|
||
4 years ago
|
"code.gitea.io/gitea/modules/web/middleware"
|
||
8 years ago
|
|
||
4 years ago
|
"gitea.com/go-chi/binding"
|
||
11 years ago
|
)
|
||
|
|
||
11 years ago
|
// ________ .__ __ .__
|
||
|
// \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
|
||
|
// / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
|
||
|
// / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
|
||
|
// \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
|
||
|
// \/ /_____/ \/ \/ \/ \/ \/
|
||
|
|
||
8 years ago
|
// CreateOrgForm form for creating organization
|
||
11 years ago
|
type CreateOrgForm struct {
|
||
5 years ago
|
OrgName string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
|
||
|
Visibility structs.VisibleType
|
||
|
RepoAdminChangeTeamAccess bool
|
||
11 years ago
|
}
|
||
|
|
||
8 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *CreateOrgForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
8 years ago
|
// UpdateOrgSettingForm form for updating organization settings
|
||
10 years ago
|
type UpdateOrgSettingForm struct {
|
||
5 years ago
|
Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
|
||
|
FullName string `binding:"MaxSize(100)"`
|
||
|
Description string `binding:"MaxSize(255)"`
|
||
|
Website string `binding:"ValidUrl;MaxSize(255)"`
|
||
|
Location string `binding:"MaxSize(50)"`
|
||
|
Visibility structs.VisibleType
|
||
|
MaxRepoCreation int
|
||
|
RepoAdminChangeTeamAccess bool
|
||
11 years ago
|
}
|
||
|
|
||
8 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *UpdateOrgSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
|
// ___________
|
||
|
// \__ ___/___ _____ _____
|
||
|
// | |_/ __ \\__ \ / \
|
||
|
// | |\ ___/ / __ \| Y Y \
|
||
|
// |____| \___ >____ /__|_| /
|
||
|
// \/ \/ \/
|
||
|
|
||
8 years ago
|
// CreateTeamForm form for creating team
|
||
11 years ago
|
type CreateTeamForm struct {
|
||
5 years ago
|
TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||
|
Description string `binding:"MaxSize(255)"`
|
||
|
Permission string
|
||
|
RepoAccess string
|
||
|
CanCreateOrgRepo bool
|
||
11 years ago
|
}
|
||
|
|
||
8 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *CreateTeamForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
11 years ago
|
}
|