mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
Allow to set organization visibility (public, internal, private) (#1763)
This commit is contained in:
parent
ae3a913122
commit
64ce159a6e
27 changed files with 388 additions and 28 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -23,6 +24,7 @@ const (
|
|||
// Create render the page for create organization
|
||||
func Create(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_org")
|
||||
ctx.Data["DefaultOrgVisibilityMode"] = setting.Service.DefaultOrgVisibilityMode
|
||||
if !ctx.User.CanCreateOrganization() {
|
||||
ctx.ServerError("Not allowed", errors.New(ctx.Tr("org.form.create_org_not_allowed")))
|
||||
return
|
||||
|
@ -45,9 +47,10 @@ func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
|||
}
|
||||
|
||||
org := &models.User{
|
||||
Name: form.OrgName,
|
||||
IsActive: true,
|
||||
Type: models.UserTypeOrganization,
|
||||
Name: form.OrgName,
|
||||
IsActive: true,
|
||||
Type: models.UserTypeOrganization,
|
||||
Visibility: form.Visibility,
|
||||
}
|
||||
|
||||
if err := models.CreateOrganization(org, ctx.User); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue