Commit Graph

43 Commits (release/v1.13)

Author SHA1 Message Date
6543 77ce08976d
Re-enable transfer repo back from org to user account ()
* re-enable transfer repo back from org to user account

* add test case
6543 edef62e69e
Backport: Repo Transfer permission checks () ()
* Backport: Repo Transfer permission checks ()

* update tests
6543 07629bd55c
Add Allow-/Block-List for Migrate & Mirrors () ()
* add black list and white list support for migrating repositories

* specify log message

* use blocklist/allowlist

* allways use lowercase to match url

* Apply allow/block

* Settings: use existing "migrations" section

* convert domains lower case

* dont store unused value

* Block private addresses for migration by default

* use proposed-upstream func to detect private IP addr

* add own error for blocked migration, add tests, imprufe api

* fix test

* fix-if-localhost-is-ipv4

* rename error & error message

* rename setting options

* Apply suggestions from code review

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
6543 fd60ebfe14
[API] Migration: Change ServiceType String ()
* use different structs for MigrateRepoOptions on UI and API

* Fix TokenAuth and rename UID to an understandable Name

* fix swagger doc

* simplify & mk redable

* R E F A C T O R:
migration has now internal 3 structs to store its options:
 * the Options for WebUI: modules/auth/repo_form.go
 * the Options for API: modules/structs/repo.go
 * the option struct with after validation for internal prossessing: modules/migrations/base/options.go

* Copyright Header

* Deprecate UID - add RepoOwner

* adopt repo.go -> migrate.go

* add comment about each struct purpose

* lint
6543 fb603825f5
Test ignore migration rate limitation error ()
zeripath 74bd9691c6
Re-attempt to delete temporary upload if the file is locked by another process ()
Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
赵智超 7744b36e56
Use a small size repo for migrate test ()
Signed-off-by: a1012112796 <1012112796@qq.com>
Cirno the Strongest cefbf73aea
Honor DEFAULT_PAGING_NUM for API ()
* Honor DEFAULT_PAGING_NUM for API

* set pagination to 10 for tests

* lint

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
6543 ad31d6b5e8
Fix release counter on API repository info ()
Use the same mechanism as the webpage for calculating the release count

Fix 
guillep2k 62a1322cf9
Fix "access" fixtures and tests ()
* Add fixture gen tool and fix "access" test

* Close file before exiting

* Add missing repo_unit for repo id: 5

* Fix count on TestAPIOrgRepos

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
6543 13bc82009c
API endpoint for repo transfer ()
* squash

* optimize

* fail before make any changes

* fix-header
David Svantesson 9cb418e623 Redirect issue if repo has configured external tracker. ()
* Redirect issue if repo has configured external tracker.

* Handle error

* Add tests for redirect

* Fix test consistency
zeripath 055f6d2296 Fix "data race" in testlogger ()
* Fix data race in testlogger

* Update git_helper_for_declarative_test.go
David Svantesson 69a255defb Team permission to create repository in organization ()
* Add team permission setting to allow creating repo in organization.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add test case for creating repo when have team creation access.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* build error: should omit comparison to bool constant

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add comment on exported functions

* Fix fixture consistency, fix existing unit tests

* Fix boolean comparison in xorm query.

* addCollaborator and changeCollaborationAccessMode separate steps

More clear to use different if-cases.

* Create and commit xorm session

* fix

* Add information of create repo permission in team sidebar

* Add migration step

* Clarify that repository creator will be administrator.

* Fix some things after merge

* Fix language text that use html

* migrations file

* Create repository permission -> Create repositories

* fix merge

* fix review comments
John Olheiser 74a6add4d9 Template Repositories ()
* Start work on templates

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Continue work

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix IsTemplate vs IsGenerated

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tabs vs spaces

* Tabs vs Spaces

* Add templates to API & start adding tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix integration tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Remove unused User

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move template tests to existing repos

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Minor re-check updates and cleanup

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* make fmt

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Test cleanup

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix optionalbool

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* make fmt

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Test fixes and icon change

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add new user and repo for tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tests (finally)

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update meta repo with env variables

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move generation to create page

Combine with repo create template
Modify API search to prioritize owner for repo

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tests and coverage

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix swagger and JS lint

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix API searching for own private repos

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Change wording

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix repo search test. User had a private repo that didn't show up

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Another search test fix

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Clarify git content

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Feedback updates

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add topics WIP

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Finish adding topics

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update locale

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Lunny Xiao f02138a148 Fix bug when migrate from API ()
* fix bug when migrate from API

* fix test

* fix test

* improve

* fix error message
guillep2k 72f6d5c882 Restrict repository indexing by glob match ()
* Restrict repository indexing by file extension

* Use REPO_EXTENSIONS_LIST_INCLUDE instead of REPO_EXTENSIONS_LIST_EXCLUDE and have a more flexible extension pattern

* Corrected to pass lint gosimple

* Add wildcard support to REPO_INDEXER_EXTENSIONS

* This reverts commit 72a650c8e4.

* Add wildcard support to REPO_INDEXER_EXTENSIONS (no make vendor)

* Simplify isIndexable() for better clarity

* Add gobwas/glob to vendors

* manually set appengine new release

* Implement better REPO_INDEXER_INCLUDE and REPO_INDEXER_EXCLUDE

* Add unit and integration tests

* Update app.ini.sample and reword config-cheat-sheet

* Add doc page and correct app.ini.sample

* Some polish on the doc

* Simplify code as suggested by @lafriks
zeripath 56ae539bed SearchRepositoryByName improvements and unification ()
Lunny Xiao 34eee25bd4
Move sdk structs to modules/structs ()
* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
Segev Finer 34548369e1 Add API for manipulating Git hooks ()
* Add API for manipulating Git hooks

Signed-off-by: Segev Finer <segev@codeocean.com>

* Replace code.gitea.io/sdk with PR branch temporarily for CI

* Switch back to code.gitea.io/sdk@master

* Return 403 instead of 404 on no permission to edit hooks in API

* Add tests for Git hooks API

* Update models/repo_list_test.go

Co-Authored-By: segevfiner <segev208@gmail.com>

* Update models/repo_list_test.go

Co-Authored-By: segevfiner <segev208@gmail.com>

* empty line
Mura Li 3186ef554c Support search operators for commits search ()
* Support searching commits with prefix syntax

For now, support auther: committer:
When more than one prefix is supplied is presented, the result is the union.
When different prefixes are supplied, the result is the intersection.

For example,
"author:alice author:bob"
=> the result is all commits authored by Alice OR Bob

"hello committer:alice"
=> the result is all commits committed by Alice AND has the keyword
'hello' in the message.

Note that there should NOT have any space after the colon(:) of the prefix.
For example,
"author:bill" => correct
"author: bill" => wrong

* Remove unneeded logging

* Add missing files of test repository

* Add missing repo_unit entries to test fixtures

* Update test cases

* Add tooltip for commits search button

* Update tooltip text

I have no idea about how to format it with line breaks.

* Make the usage example more real

* Add a test case

* Add new options struct for SearchCommits

* Prefer len(s) > 0 over s != ""

* Add NewSearchCommitsOptions
Bogdan Petrea 583968f274 Return 409 when creating repo if it already exists. ()
Lunny Xiao eabbddcd98
Restrict permission check on repositories and fix some problems ()
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
Daniel Balko 3379141d81 API: '/orgs/:org/repos': return private repos with read access () () ()
Signed-off-by: Daniel Balko <inxonic+github@gmail.com>
Bo-Yi Wu ea20adaa84
feat(repo): support search repository by topic name ()
* feat(repo): support search repository by topic name
B-OnTheGo e47df0b301 Enforce token on api routes [fixed critical security issue ] ()
SagePtr bf55276189 Fix redirect with non-ascii branch names () ()
* Fix redirect with non-ascii branch names ()

* Add integration tests for non-ascii branch redirect

* Fix mysql test and coverage test
Lauris BH 69e2ab1611 Allow administrator to create repository for any organization ()
Lauris BH 4a8ee0b5cc
Check that repositories can only be migrated to own user or organizations ()
* Repositories can only migrated to own user or organizations

* Add check for organization that user does not belong to

* Allow admin to migrate repositories for other users
David Schneiderbauer 0b3ea42847 hide issues from org private repos w/o team assignment ()
Morlinest ddb7f59ef4 Add search mode option to /api/repo/search ()
* Add repo type option to /api/repo/search

* Add tests and fix result of collaborative filter in specific condition

* Fix/optimize search & tests

* Improve integration tests

* Fix lint errors

* Fix unit tests

* Change and improve internal implementation of repo search

* Use NonexistentID

* Make search api more general

* Change mirror and fork search behaviour

* Fix tests & typo in comment
Morlinest ccd3577970 Fix repository search function ()
* Fix and remove FIXME

* Respect membership visibility

* Fix/rewrite searchRepositoryByName function

* Add unit tests

* Add integration tests

* Remove Searcher completely

* Remove trailing space
Morlinest c2346e4469 Add repository search unit and integration tests ()
* Add more repo search tests

* Fix repo search tests

* Always test returned repos length

* Add test with lower pagesize limit (test more pages)

* Add and fix /api/repo/search integration tests

* Simplify unit tests code

* Simplify and unify integration tests code

* Improve test coverage

* Temporary fix tests due to bugs in current repo search implementation

* Revert removing not nil Searcher

* Add more checks to tests

* Simplify privacy checks in /api/repo tests

* Temporary remove privacy check from repo search tests
Morlinest 80b430d7c0 Fix /api/repo/search integration tests ()
Ethan Koenig 49df677c47 Check for access in /repositories/:id ()
* Check for access in /repositories/:id

* Integration test
Aaron Walker 6a3c03762a API: support '/orgs/:org/repos' ()
* API: support '/orgs/:org/repos'
Ethan Koenig 93a1de4842 Fix repo API bug ()
Don't require token when not necessary
Ethan Koenig 8f1d62ad3b Fix GET /users/:username/repos endpoint ()
Ethan Koenig f1adaef458 Less verbose integration tests ()
* Helper functions for intergration test boilerplate
Ethan Koenig 4c0e567062 Fix improper setup for integration tests ()
Ethan Koenig 61716bd8f7 Display URLs in integration test logs ()
Lunny Xiao 0308d44a16 fix and improve integration test ()
Lunny Xiao 61b08b5c01 bug fixed for API to get user's repos ()
* bug fixed for API to get user's repos

* add tests and fix another place

* test user2 since user1 has no repos