Skip to content

Commit 7fa3229

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated licenses and gitignores Comment on PrivateUsers option for gitea.service (go-gitea#20383) [skip ci] Updated translations via Crowdin Remove confusing TrimPrefix(... git.BranchPrefix) (go-gitea#20369) Set target on create release with existing tag (go-gitea#20381) Initialize cron last (go-gitea#20373) Allow access to the Public Organization Member lists with minimal permissions (go-gitea#20330)
2 parents 099187d + 17ce5f8 commit 7fa3229

File tree

14 files changed

+100
-16
lines changed

14 files changed

+100
-16
lines changed

contrib/systemd/gitea.service

+7
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
7878
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
7979
#AmbientCapabilities=CAP_NET_BIND_SERVICE
8080
###
81+
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
82+
# set the following value to false to allow capabilities to be applied on gitea process. The following
83+
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
84+
# in the host user namespace.
85+
###
86+
#PrivateUsers=false
87+
###
8188

8289
[Install]
8390
WantedBy=multi-user.target

modules/context/org.go

+15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"code.gitea.io/gitea/models/perm"
1313
user_model "code.gitea.io/gitea/models/user"
1414
"code.gitea.io/gitea/modules/setting"
15+
"code.gitea.io/gitea/modules/structs"
1516
)
1617

1718
// Organization contains organization context
@@ -69,6 +70,20 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
6970
return
7071
}
7172
org := ctx.Org.Organization
73+
74+
// Handle Visibility
75+
if org.Visibility != structs.VisibleTypePublic && !ctx.IsSigned {
76+
// We must be signed in to see limited or private organizations
77+
ctx.NotFound("OrgAssignment", err)
78+
return
79+
}
80+
81+
if org.Visibility == structs.VisibleTypePrivate {
82+
requireMember = true
83+
} else if ctx.IsSigned && ctx.Doer.IsRestricted {
84+
requireMember = true
85+
}
86+
7287
ctx.ContextUser = org.AsUser()
7388
ctx.Data["Org"] = org
7489

modules/git/repo_branch.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package git
77

88
import (
99
"context"
10+
"errors"
1011
"fmt"
1112
"strings"
1213
)
@@ -72,7 +73,14 @@ func (repo *Repository) SetDefaultBranch(name string) error {
7273
// GetDefaultBranch gets default branch of repository.
7374
func (repo *Repository) GetDefaultBranch() (string, error) {
7475
stdout, _, err := NewCommand(repo.Ctx, "symbolic-ref", "HEAD").RunStdString(&RunOpts{Dir: repo.Path})
75-
return stdout, err
76+
if err != nil {
77+
return "", err
78+
}
79+
stdout = strings.TrimSpace(stdout)
80+
if !strings.HasPrefix(stdout, BranchPrefix) {
81+
return "", errors.New("the HEAD is not a branch: " + stdout)
82+
}
83+
return strings.TrimPrefix(stdout, BranchPrefix), nil
7684
}
7785

7886
// GetBranch returns a branch by it's name

options/gitignore/Bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/bazel-*
77

88
# Directories for the Bazel IntelliJ plugin containing the generated
9-
# IntelliJ project files and plugin configuration. Separate directories are
9+
# IntelliJ project files and plugin configuration. Seperate directories are
1010
# for the IntelliJ, Android Studio and CLion versions of the plugin.
1111
/.ijwb/
1212
/.aswb/
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The Totem project hereby grant permission for non-gpl compatible GStreamer plugins to be used and distributed together with GStreamer and Totem. This permission are above and beyond the permissions granted by the GPL license Totem is covered by.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This project hereby grants permission for non-GPL compatible GStreamer plugins to be used and distributed together with GStreamer and this project. This permission is above and beyond the permissions granted by the GPL license by which this project is covered. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

options/license/Minpack

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
2+
3+
Redistribution and use in source and binary forms, with or
4+
without modification, are permitted provided that the
5+
following conditions are met:
6+
7+
1. Redistributions of source code must retain the above
8+
copyright notice, this list of conditions and the following
9+
disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials
14+
provided with the distribution.
15+
16+
3. The end-user documentation included with the
17+
redistribution, if any, must include the following
18+
acknowledgment:
19+
20+
"This product includes software developed by the
21+
University of Chicago, as Operator of Argonne National
22+
Laboratory.
23+
24+
Alternately, this acknowledgment may appear in the software
25+
itself, if and wherever such third-party acknowledgments
26+
normally appear.
27+
28+
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
29+
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
30+
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
31+
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
32+
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
33+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
34+
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
35+
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
36+
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
37+
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
38+
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
39+
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
40+
BE CORRECTED.
41+
42+
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
43+
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
44+
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
45+
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
46+
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
47+
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
48+
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
49+
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
50+
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
51+
POSSIBILITY OF SUCH LOSS OR DAMAGES.

options/locale/locale_pt-PT.ini

+2
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,8 @@ users.delete_account=Eliminar conta de utilizador
25402540
users.cannot_delete_self=Não se pode eliminar a si próprio
25412541
users.still_own_repo=Este utilizador ainda possui um ou mais repositórios. Elimine ou transfira esses repositórios primeiro.
25422542
users.still_has_org=Este utilizador é membro de uma organização. Remova, primeiro, o utilizador de todas as organizações.
2543+
users.purge=Eliminar utilizador
2544+
users.purge_help=Eliminar o utilizador à força, juntamente com todos os seus repositórios, organizações e pacotes. Também serão eliminados todos os seus comentários.
25432545
users.still_own_packages=Este utilizador ainda possui um ou mais pacotes. Elimine esses pacotes primeiro.
25442546
users.deletion_success=A conta de utilizador foi eliminada.
25452547
users.reset_2fa=Reinicializar a autenticação em dois passos

routers/api/v1/repo/release.go

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ func CreateRelease(ctx *context.APIContext) {
224224
rel.IsTag = false
225225
rel.Repo = ctx.Repo.Repository
226226
rel.Publisher = ctx.Doer
227+
rel.Target = form.Target
227228

228229
if err = release_service.UpdateRelease(ctx.Doer, ctx.Repo.GitRepo, rel, nil, nil, nil); err != nil {
229230
ctx.Error(http.StatusInternalServerError, "UpdateRelease", err)

routers/init.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ func GlobalInitInstalled(ctx context.Context) {
141141
mustInit(repo_service.Init)
142142

143143
// Booting long running goroutines.
144-
cron.NewContext(ctx)
145144
issue_indexer.InitIssueIndexer(false)
146145
code_indexer.Init()
147146
mustInit(stats_indexer.Init)
@@ -160,6 +159,9 @@ func GlobalInitInstalled(ctx context.Context) {
160159

161160
auth.Init()
162161
svg.Init()
162+
163+
// Finally start up the cron
164+
cron.NewContext(ctx)
163165
}
164166

165167
// NormalRoutes represents non install routes

routers/web/org/home.go

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ func Home(ctx *context.Context) {
3939

4040
org := ctx.Org.Organization
4141

42-
if !organization.HasOrgOrUserVisible(ctx, org.AsUser(), ctx.Doer) {
43-
ctx.NotFound("HasOrgOrUserVisible", nil)
44-
return
45-
}
46-
4742
ctx.Data["PageIsUserProfile"] = true
4843
ctx.Data["Title"] = org.DisplayName()
4944
if len(org.Description) != 0 {

routers/web/web.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,12 @@ func RegisterRoutes(m *web.Route) {
610610
}
611611

612612
// ***** START: Organization *****
613+
m.Group("/org", func() {
614+
m.Group("/{org}", func() {
615+
m.Get("/members", org.Members)
616+
}, context.OrgAssignment())
617+
}, ignSignIn)
618+
613619
m.Group("/org", func() {
614620
m.Group("", func() {
615621
m.Get("/create", org.Create)
@@ -625,7 +631,6 @@ func RegisterRoutes(m *web.Route) {
625631
m.Get("/pulls/{team}", user.Pulls)
626632
m.Get("/milestones", reqMilestonesDashboardPageEnabled, user.Milestones)
627633
m.Get("/milestones/{team}", reqMilestonesDashboardPageEnabled, user.Milestones)
628-
m.Get("/members", org.Members)
629634
m.Post("/members/action/{action}", org.MembersAction)
630635
m.Get("/teams", org.Teams)
631636
}, context.OrgAssignment(true, false, true))

services/repository/adopt.go

-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ func adoptRepository(ctx context.Context, repoPath string, u *user_model.User, r
143143
return fmt.Errorf("setDefaultBranch: %v", err)
144144
}
145145
}
146-
147-
repo.DefaultBranch = strings.TrimPrefix(repo.DefaultBranch, git.BranchPrefix)
148146
}
149147
branches, _, _ := gitRepo.GetBranchNames(0, 0)
150148
found := false

templates/org/home.tmpl

+3-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141
{{end}}
4242
<h4 class="ui top attached header df">
4343
<strong class="f1">{{.locale.Tr "org.people"}}</strong>
44-
{{if .IsOrganizationMember}}
45-
<div class="ui">
46-
<a class="text grey dif ac" href="{{.OrgLink}}/members"><span>{{.Org.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a>
47-
</div>
48-
{{end}}
44+
<div class="ui">
45+
<a class="text grey dif ac" href="{{.OrgLink}}/members"><span>{{.MembersTotal}}</span> {{svg "octicon-chevron-right"}}</a>
46+
</div>
4947
</h4>
5048
<div class="ui attached segment members">
5149
{{$isMember := .IsOrganizationMember}}

0 commit comments

Comments
 (0)