Skip to content

Commit 954f316

Browse files
authored
Merge branch 'main' into deps-api
2 parents e3a7e53 + 3dbdf36 commit 954f316

File tree

156 files changed

+2792
-852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2792
-852
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<a href="https://crowdin.com/project/gitea" title="Crowdin">
3737
<img src="https://badges.crowdin.net/gitea/localized.svg">
3838
</a>
39-
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
40-
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
39+
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
40+
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4141
</a>
4242
<a href="https://www.bountysource.com/teams/gitea" title="Bountysource">
4343
<img src="https://img.shields.io/bountysource/team/gitea/activity">

README_ZH.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<a href="https://crowdin.com/project/gitea" title="Crowdin">
3737
<img src="https://badges.crowdin.net/gitea/localized.svg">
3838
</a>
39-
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
40-
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
39+
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main" title="TODOs">
40+
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea/main">
4141
</a>
4242
<a href="https://img.shields.io/bountysource/team/gitea" title="Bountysource">
4343
<img src="https://img.shields.io/bountysource/team/gitea/activity">

build/generate-bindata.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ func needsUpdate(dir string, filename string) (bool, []byte) {
5858
}
5959

6060
func main() {
61-
if len(os.Args) != 4 {
61+
if len(os.Args) < 4 {
6262
log.Fatal("Insufficient number of arguments. Need: directory packageName filename")
6363
}
6464

6565
dir, packageName, filename := os.Args[1], os.Args[2], os.Args[3]
66+
var useGlobalModTime bool
67+
if len(os.Args) == 5 {
68+
useGlobalModTime, _ = strconv.ParseBool(os.Args[4])
69+
}
6670

6771
update, newHash := needsUpdate(dir, filename)
6872

@@ -74,10 +78,11 @@ func main() {
7478
fmt.Printf("generating bindata for %s\n", packageName)
7579
var fsTemplates http.FileSystem = http.Dir(dir)
7680
err := vfsgen.Generate(fsTemplates, vfsgen.Options{
77-
PackageName: packageName,
78-
BuildTags: "bindata",
79-
VariableName: "Assets",
80-
Filename: filename,
81+
PackageName: packageName,
82+
BuildTags: "bindata",
83+
VariableName: "Assets",
84+
Filename: filename,
85+
UseGlobalModTime: useGlobalModTime,
8186
})
8287
if err != nil {
8388
log.Fatalf("%v\n", err)

custom/conf/app.example.ini

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ PATH =
592592
;LARGE_OBJECT_THRESHOLD = 1048576
593593
;; Set to true to forcibly set core.protectNTFS=false
594594
;DISABLE_CORE_PROTECT_NTFS=false
595+
;; Disable the usage of using partial clones for git.
596+
;DISABLE_PARTIAL_CLONE = false
595597

596598
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
597599
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -786,11 +788,11 @@ PATH =
786788
;PULL_REQUEST_QUEUE_LENGTH = 1000
787789
;;
788790
;; Preferred Licenses to place at the top of the List
789-
;; The name here must match the filename in conf/license or custom/conf/license
791+
;; The name here must match the filename in options/license or custom/options/license
790792
;PREFERRED_LICENSES = Apache License 2.0,MIT License
791793
;;
792794
;; Disable the ability to interact with repositories using the HTTP protocol
793-
;;DISABLE_HTTP_GIT = false
795+
;DISABLE_HTTP_GIT = false
794796
;;
795797
;; Value for Access-Control-Allow-Origin header, default is not to present
796798
;; WARNING: This may be harmful to your website if you do not give it a right value.
@@ -1494,6 +1496,9 @@ PATH =
14941496
;;
14951497
;; Timeout for Sendmail
14961498
;SENDMAIL_TIMEOUT = 5m
1499+
;;
1500+
;; convert \r\n to \n for Sendmail
1501+
;SENDMAIL_CONVERT_CRLF = true
14971502

14981503
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14991504
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/clone-filter.en-us.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,9 @@ on the client is at least the same as on the server (or later). Login to
2727
Gitea server as admin and head to Site Administration -> Configuration to
2828
see Git version of the server.
2929

30-
By default, clone filters are disabled, which cause the server to ignore
31-
`--filter` option.
30+
By default, clone filters are enabled, unless `DISABLE_PARTIAL_CLONE` under
31+
`[git]` is set to `true`.
3232

33-
To enable clone filters on per-repo basis, edit the repo's `config` on
34-
repository location. Consult `ROOT` option on `repository` section of
35-
Gitea configuration (`app.ini`) for the exact location. For example, to
36-
enable clone filters for `some-repo`, edit
37-
`/var/gitea/data/gitea-repositories/some-user/some-repo.git/config` and add:
38-
39-
```ini
40-
[uploadpack]
41-
allowfilter = true
42-
```
43-
44-
To enable clone filters globally, add that config above to `~/.gitconfig`
45-
of user that run Gitea (for example `git`).
46-
47-
Alternatively, you can use `git config` to set the option.
48-
49-
To enable for a specific repo:
50-
51-
```bash
52-
cd /var/gitea/data/gitea-repositories/some-user/some-repo.git
53-
git config --local uploadpack.allowfilter true
54-
```
55-
To enable globally, login as user that run Gitea and:
56-
57-
```bash
58-
git config --global uploadpack.allowfilter true
59-
```
6033

6134
See [GitHub blog post: Get up to speed with partial clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/)
6235
for common use cases of clone filters (blobless and treeless clones), and

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
667667
command or full path).
668668
- `SENDMAIL_ARGS`: **_empty_**: Specify any extra sendmail arguments.
669669
- `SENDMAIL_TIMEOUT`: **5m**: default timeout for sending email through sendmail
670+
- `SENDMAIL_CONVERT_CRLF`: **true**: Most versions of sendmail prefer LF line endings rather than CRLF line endings. Set this to false if your version of sendmail requires CRLF line endings.
670671
- `SEND_BUFFER_LEN`: **100**: Buffer length of mailing queue. **DEPRECATED** use `LENGTH` in `[queue.mailer]`
671672

672673
## Cache (`cache`)
@@ -932,6 +933,8 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
932933
- `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
933934
- `LARGE_OBJECT_THRESHOLD`: **1048576**: (Go-Git only), don't cache objects greater than this in memory. (Set to 0 to disable.)
934935
- `DISABLE_CORE_PROTECT_NTFS`: **false** Set to true to forcibly set `core.protectNTFS` to false.
936+
- `DISABLE_PARTIAL_CLONE`: **false** Disable the usage of using partial clones for git.
937+
935938
## Git - Timeout settings (`git.timeout`)
936939
- `DEFAUlT`: **360**: Git operations default timeout seconds.
937940
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
date: "2021-12-13:10:10+08:00"
3+
title: "Permissions"
4+
slug: "permissions"
5+
weight: 14
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "usage"
11+
name: "Permissions"
12+
weight: 14
13+
identifier: "permissions"
14+
---
15+
16+
# Permissions
17+
18+
**Table of Contents**
19+
20+
{{< toc >}}
21+
22+
Gitea supports permissions for repository so that you can give different access for different people. At first, we need to know about `Unit`.
23+
24+
## Unit
25+
26+
In Gitea, we call a sub module of a repository `Unit`. Now we have following units.
27+
28+
| Name | Description | Permissions |
29+
| --------------- | ---------------------------------------------------- | ----------- |
30+
| Code | Access source code, files, commits and branches. | Read Write |
31+
| Issues | Organize bug reports, tasks and milestones. | Read Write |
32+
| PullRequests | Enable pull requests and code reviews. | Read Write |
33+
| Releases | Track project versions and downloads. | Read Write |
34+
| Uncyclo | Write and share documentation with collaborators. | Read Write |
35+
| ExternalUncyclo | Link to an external wiki | Read |
36+
| ExternalTracker | Link to an external issue tracker | Read |
37+
| Projects | The URL to the template repository | Read Write |
38+
| Settings | Manage the repository | Admin |
39+
40+
With different permissions, people could do different things with these units.
41+
42+
| Name | Read | Write | Admin |
43+
| --------------- | ------------------------------------------------- | ---------------------------- | ------------------------- |
44+
| Code | View code trees, files, commits, branches and etc. | Push codes. | - |
45+
| Issues | View issues and create new issues. | Add labels, assign, close | - |
46+
| PullRequests | View pull requests and create new pull requests. | Add labels, assign, close | - |
47+
| Releases | View releases and download files. | Create/Edit releases | - |
48+
| Uncyclo | View wiki pages. Clone the wiki repository. | Create/Edit wiki pages, push | - |
49+
| ExternalUncyclo | Link to an external wiki | - | - |
50+
| ExternalTracker | Link to an external issue tracker | - | - |
51+
| Projects | View the boards | Change issues across boards | - |
52+
| Settings | - | - | Manage the repository |
53+
54+
And there are some differences for permissions between individual repositories and organization repositories.
55+
56+
## Individual Repository
57+
58+
For individual repositories, the creators are the only owners of repositories and have no limit to change anything of this
59+
repository or delete it. Repositories owners could add collaborators to help maintain the repositories. Collaborators could have `Read`, `Write` and `Admin` permissions.
60+
61+
## Organization Repository
62+
63+
Different from individual repositories, the owner of organization repositories are the owner team of this organization.
64+
65+
### Team
66+
67+
A team in an organization has unit permissions settings. It can have members and repositories scope. A team could access all the repositories in this organization or special repositories changed by the owner team. A team could also be allowed to create new
68+
repositories.
69+
70+
The owner team will be created when the organization created and the creator will become the first member of the owner team.
71+
Notice Gitea will not allow a people is a member of organization but not in any team. The owner team could not be deleted and only
72+
members of owner team could create a new team. Admin team could be created to manage some of repositories, members of admin team
73+
could do anything with these repositories. Generate team could be created by the owner team to do the permissions allowed operations.

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.16
55
require (
66
cloud.google.com/go v0.78.0 // indirect
77
code.gitea.io/gitea-vet v0.2.1
8-
code.gitea.io/sdk/gitea v0.14.0
8+
code.gitea.io/sdk/gitea v0.15.1
99
gitea.com/go-chi/binding v0.0.0-20211013065440-d16dc407c2be
1010
gitea.com/go-chi/cache v0.0.0-20211013020926-78790b11abf1
1111
gitea.com/go-chi/captcha v0.0.0-20211013065431-70641c1a35d5
@@ -141,3 +141,5 @@ require (
141141
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
142142

143143
replace github.com/golang-jwt/jwt v3.2.1+incompatible => github.com/golang-jwt/jwt v3.2.2+incompatible
144+
145+
replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
3838
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
3939
code.gitea.io/gitea-vet v0.2.1 h1:b30by7+3SkmiftK0RjuXqFvZg2q4p68uoPGuxhzBN0s=
4040
code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE=
41-
code.gitea.io/sdk/gitea v0.14.0 h1:m4J352I3p9+bmJUfS+g0odeQzBY/5OXP91Gv6D4fnJ0=
42-
code.gitea.io/sdk/gitea v0.14.0/go.mod h1:89WiyOX1KEcvjP66sRHdu0RafojGo60bT9UqW17VbWs=
41+
code.gitea.io/sdk/gitea v0.15.1 h1:WJreC7YYuxbn0UDaPuWIe/mtiNKTvLN8MLkaw71yx/M=
42+
code.gitea.io/sdk/gitea v0.15.1/go.mod h1:klY2LVI3s3NChzIk/MzMn7G1FHrfU7qd63iSMVoHRBA=
4343
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
4444
gitea.com/go-chi/binding v0.0.0-20211013065440-d16dc407c2be h1:IzSwPVzd2hE6e67ujY8ReBCrQ5IFNd0uiBmC7Ux5IaY=
4545
gitea.com/go-chi/binding v0.0.0-20211013065440-d16dc407c2be/go.mod h1:/vR0YjlusOYvosKYW7QKcSnrY0nPLe4RQ/DGi3+i/Do=
@@ -802,6 +802,8 @@ github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 h1:uNwtsDp7
802802
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96/go.mod h1:mmIfjCSQlGYXmJ95jFN84AkQFnVABtKuJL8IrzwvUKQ=
803803
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de/go.mod h1:3q8WtuPQsoRbatJuy3nvq/hRSvuBJrHHr+ybPPiNvHQ=
804804
github.com/lunny/nodb v0.0.0-20160621015157-fc1ef06ad4af/go.mod h1:Cqz6pqow14VObJ7peltM+2n3PWOz7yTrfUuGbVFkzN0=
805+
github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0 h1:F/3FfGmKdiKFa8kL3YrpZ7pe9H4l4AzA1pbaOUnRvPI=
806+
github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0/go.mod h1:JEfTc3+2DF9Z4PXhLLvXL42zexJyh8rIq3OzUj/0rAk=
805807
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
806808
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
807809
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
@@ -1044,8 +1046,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
10441046
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
10451047
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
10461048
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
1047-
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU=
1048-
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
10491049
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
10501050
github.com/siddontang/go-snappy v0.0.0-20140704025258-d8f7bb82a96d/go.mod h1:vq0tzqLRu6TS7Id0wMo2N5QzJoKedVeovOpHjnykSzY=
10511051
github.com/siddontang/ledisdb v0.0.0-20190202134119-8ceb77e66a92/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=

integrations/api_repo_teams_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import (
1010
"testing"
1111

1212
repo_model "code.gitea.io/gitea/models/repo"
13+
"code.gitea.io/gitea/models/unit"
1314
"code.gitea.io/gitea/models/unittest"
1415
user_model "code.gitea.io/gitea/models/user"
1516
api "code.gitea.io/gitea/modules/structs"
17+
"code.gitea.io/gitea/modules/util"
1618

1719
"github.com/stretchr/testify/assert"
1820
)
@@ -36,7 +38,7 @@ func TestAPIRepoTeams(t *testing.T) {
3638
if assert.Len(t, teams, 2) {
3739
assert.EqualValues(t, "Owners", teams[0].Name)
3840
assert.False(t, teams[0].CanCreateOrgRepo)
39-
assert.EqualValues(t, []string{"repo.code", "repo.issues", "repo.pulls", "repo.releases", "repo.wiki", "repo.ext_wiki", "repo.ext_issues"}, teams[0].Units)
41+
assert.True(t, util.IsEqualSlice(unit.AllUnitKeyNames(), teams[0].Units), fmt.Sprintf("%v == %v", unit.AllUnitKeyNames(), teams[0].Units))
4042
assert.EqualValues(t, "owner", teams[0].Permission)
4143

4244
assert.EqualValues(t, "test_team", teams[1].Name)

0 commit comments

Comments
 (0)