diff --git a/contrib/systemd/gitea.service b/contrib/systemd/gitea.service index d6a4377ec809..79c34564bc97 100644 --- a/contrib/systemd/gitea.service +++ b/contrib/systemd/gitea.service @@ -78,6 +78,13 @@ Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea #CapabilityBoundingSet=CAP_NET_BIND_SERVICE #AmbientCapabilities=CAP_NET_BIND_SERVICE ### +# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to +# set the following value to false to allow capabilities to be applied on gitea process. The following +# value if set to true sandboxes gitea service and prevent any processes from running with privileges +# in the host user namespace. +### +#PrivateUsers=false +### [Install] WantedBy=multi-user.target diff --git a/modules/context/org.go b/modules/context/org.go index 9f4ce485e5ee..d020befa4016 100644 --- a/modules/context/org.go +++ b/modules/context/org.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models/perm" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/structs" ) // Organization contains organization context @@ -69,6 +70,20 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { return } org := ctx.Org.Organization + + // Handle Visibility + if org.Visibility != structs.VisibleTypePublic && !ctx.IsSigned { + // We must be signed in to see limited or private organizations + ctx.NotFound("OrgAssignment", err) + return + } + + if org.Visibility == structs.VisibleTypePrivate { + requireMember = true + } else if ctx.IsSigned && ctx.Doer.IsRestricted { + requireMember = true + } + ctx.ContextUser = org.AsUser() ctx.Data["Org"] = org diff --git a/modules/git/repo_branch.go b/modules/git/repo_branch.go index 8e455480e727..17d243808e9c 100644 --- a/modules/git/repo_branch.go +++ b/modules/git/repo_branch.go @@ -7,6 +7,7 @@ package git import ( "context" + "errors" "fmt" "strings" ) @@ -72,7 +73,14 @@ func (repo *Repository) SetDefaultBranch(name string) error { // GetDefaultBranch gets default branch of repository. func (repo *Repository) GetDefaultBranch() (string, error) { stdout, _, err := NewCommand(repo.Ctx, "symbolic-ref", "HEAD").RunStdString(&RunOpts{Dir: repo.Path}) - return stdout, err + if err != nil { + return "", err + } + stdout = strings.TrimSpace(stdout) + if !strings.HasPrefix(stdout, BranchPrefix) { + return "", errors.New("the HEAD is not a branch: " + stdout) + } + return strings.TrimPrefix(stdout, BranchPrefix), nil } // GetBranch returns a branch by it's name diff --git a/options/gitignore/Bazel b/options/gitignore/Bazel index 4e1d5a2ba0a4..bc3afc20ba69 100644 --- a/options/gitignore/Bazel +++ b/options/gitignore/Bazel @@ -6,7 +6,7 @@ /bazel-* # Directories for the Bazel IntelliJ plugin containing the generated -# IntelliJ project files and plugin configuration. Separate directories are +# IntelliJ project files and plugin configuration. Seperate directories are # for the IntelliJ, Android Studio and CLion versions of the plugin. /.ijwb/ /.aswb/ diff --git a/options/license/GStreamer-exception-2005 b/options/license/GStreamer-exception-2005 new file mode 100644 index 000000000000..95ff750da325 --- /dev/null +++ b/options/license/GStreamer-exception-2005 @@ -0,0 +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. diff --git a/options/license/GStreamer-exception-2008 b/options/license/GStreamer-exception-2008 new file mode 100644 index 000000000000..28927e533ef7 --- /dev/null +++ b/options/license/GStreamer-exception-2008 @@ -0,0 +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. diff --git a/options/license/Minpack b/options/license/Minpack new file mode 100644 index 000000000000..132cc3f33fa7 --- /dev/null +++ b/options/license/Minpack @@ -0,0 +1,51 @@ +Minpack Copyright Notice (1999) University of Chicago. All rights reserved + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above +copyright notice, this list of conditions and the following +disclaimer. + +2. Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials +provided with the distribution. + +3. The end-user documentation included with the +redistribution, if any, must include the following +acknowledgment: + + "This product includes software developed by the + University of Chicago, as Operator of Argonne National + Laboratory. + +Alternately, this acknowledgment may appear in the software +itself, if and wherever such third-party acknowledgments +normally appear. + +4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" +WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE +UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND +THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE +OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY +OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR +USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF +THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) +DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION +UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL +BE CORRECTED. + +5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT +HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF +ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, +INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF +ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF +PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER +SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT +(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, +EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE +POSSIBILITY OF SUCH LOSS OR DAMAGES. diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index f84a72381ee5..b18bb0cbb820 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -2540,6 +2540,8 @@ users.delete_account=Eliminar conta de utilizador users.cannot_delete_self=Não se pode eliminar a si próprio users.still_own_repo=Este utilizador ainda possui um ou mais repositórios. Elimine ou transfira esses repositórios primeiro. users.still_has_org=Este utilizador é membro de uma organização. Remova, primeiro, o utilizador de todas as organizações. +users.purge=Eliminar utilizador +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. users.still_own_packages=Este utilizador ainda possui um ou mais pacotes. Elimine esses pacotes primeiro. users.deletion_success=A conta de utilizador foi eliminada. users.reset_2fa=Reinicializar a autenticação em dois passos diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go index 8dfe7e06d26f..80009f78e99c 100644 --- a/routers/api/v1/repo/release.go +++ b/routers/api/v1/repo/release.go @@ -224,6 +224,7 @@ func CreateRelease(ctx *context.APIContext) { rel.IsTag = false rel.Repo = ctx.Repo.Repository rel.Publisher = ctx.Doer + rel.Target = form.Target if err = release_service.UpdateRelease(ctx.Doer, ctx.Repo.GitRepo, rel, nil, nil, nil); err != nil { ctx.Error(http.StatusInternalServerError, "UpdateRelease", err) diff --git a/routers/init.go b/routers/init.go index 72ccf3526c1f..e640ca48453b 100644 --- a/routers/init.go +++ b/routers/init.go @@ -141,7 +141,6 @@ func GlobalInitInstalled(ctx context.Context) { mustInit(repo_service.Init) // Booting long running goroutines. - cron.NewContext(ctx) issue_indexer.InitIssueIndexer(false) code_indexer.Init() mustInit(stats_indexer.Init) @@ -160,6 +159,9 @@ func GlobalInitInstalled(ctx context.Context) { auth.Init() svg.Init() + + // Finally start up the cron + cron.NewContext(ctx) } // NormalRoutes represents non install routes diff --git a/routers/web/org/home.go b/routers/web/org/home.go index d565a0c24240..63243a391f0e 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -39,11 +39,6 @@ func Home(ctx *context.Context) { org := ctx.Org.Organization - if !organization.HasOrgOrUserVisible(ctx, org.AsUser(), ctx.Doer) { - ctx.NotFound("HasOrgOrUserVisible", nil) - return - } - ctx.Data["PageIsUserProfile"] = true ctx.Data["Title"] = org.DisplayName() if len(org.Description) != 0 { diff --git a/routers/web/web.go b/routers/web/web.go index ae273d99e4ff..fbece620b1c3 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -610,6 +610,12 @@ func RegisterRoutes(m *web.Route) { } // ***** START: Organization ***** + m.Group("/org", func() { + m.Group("/{org}", func() { + m.Get("/members", org.Members) + }, context.OrgAssignment()) + }, ignSignIn) + m.Group("/org", func() { m.Group("", func() { m.Get("/create", org.Create) @@ -625,7 +631,6 @@ func RegisterRoutes(m *web.Route) { m.Get("/pulls/{team}", user.Pulls) m.Get("/milestones", reqMilestonesDashboardPageEnabled, user.Milestones) m.Get("/milestones/{team}", reqMilestonesDashboardPageEnabled, user.Milestones) - m.Get("/members", org.Members) m.Post("/members/action/{action}", org.MembersAction) m.Get("/teams", org.Teams) }, context.OrgAssignment(true, false, true)) diff --git a/services/repository/adopt.go b/services/repository/adopt.go index 48f049cd2811..6d6611c705f8 100644 --- a/services/repository/adopt.go +++ b/services/repository/adopt.go @@ -143,8 +143,6 @@ func adoptRepository(ctx context.Context, repoPath string, u *user_model.User, r return fmt.Errorf("setDefaultBranch: %v", err) } } - - repo.DefaultBranch = strings.TrimPrefix(repo.DefaultBranch, git.BranchPrefix) } branches, _, _ := gitRepo.GetBranchNames(0, 0) found := false diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 06a9a3680354..3ff86259d53f 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -41,11 +41,9 @@ {{end}}

{{.locale.Tr "org.people"}} - {{if .IsOrganizationMember}} -
- {{.Org.NumMembers}} {{svg "octicon-chevron-right"}} -
- {{end}} +
+ {{.MembersTotal}} {{svg "octicon-chevron-right"}} +

{{$isMember := .IsOrganizationMember}}