Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add team option to grant rights for all organization repositories #8688

Merged
merged 27 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b8e90e
Add field IsAllRepositories to team
ngourdon Apr 28, 2019
b478a10
Add AllRepositories to team UI
ngourdon Apr 28, 2019
e5f6d9e
Manage team with access to all repositories
ngourdon Apr 28, 2019
7cca125
Add field IsAllRepositories to team API
ngourdon Apr 28, 2019
a02aa18
put backticks around table/column names
ngourdon Apr 30, 2019
8216a2a
rename IsAllRepositories to IncludesAllRepositories
ngourdon Apr 30, 2019
f698385
do not reload slice if already loaded
ngourdon Apr 30, 2019
0496588
add repo to teams with access to all repositories when changing repo …
ngourdon May 8, 2019
c097a29
improve tests for teams with access to all repositories
ngourdon May 8, 2019
3a3ccf8
Merge branch 'master'
ngourdon May 8, 2019
5fa75d4
Merge branch 'master'
ngourdon May 9, 2019
d262016
Merge branch 'master' into fix-6409
ngourdon May 12, 2019
8f297ca
Merge branch 'master' into fix-6409
ngourdon Jul 11, 2019
550cbcc
Change code for adding all repositories
davidsvantesson Oct 5, 2019
5316bdf
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
davidsvantesson Oct 5, 2019
c1a2e26
fmt after merge
davidsvantesson Oct 5, 2019
cfeb1c3
Change code in API EditTeam similar to EditTeamPost web interface
davidsvantesson Oct 5, 2019
06ac307
Clarify that all repositories will be added
davidsvantesson Oct 5, 2019
3f291df
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
davidsvantesson Oct 25, 2019
5f6a701
All repositories option under Permissions headline
davidsvantesson Oct 25, 2019
c4546cd
New setting group 'Repository access'
davidsvantesson Oct 26, 2019
ee52d2d
Merge remote-tracking branch 'upstream/master' into team-grant-all-re…
davidsvantesson Oct 26, 2019
753b7d2
Move check IncludeAllRepositories to removeRepository.
davidsvantesson Nov 2, 2019
7c7fa0d
Revert "Move check IncludeAllRepositories to removeRepository." and a…
davidsvantesson Nov 2, 2019
30faed9
Merge branch 'master' into team-grant-all-repos
davidsvantesson Nov 2, 2019
ad2d925
Clarify help text what options do.
davidsvantesson Nov 3, 2019
4a509e8
Merge branch 'master' into team-grant-all-repos
lafriks Nov 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into team-grant-all-repos
# Conflicts:
#	models/migrations/migrations.go
#	models/migrations/v90.go
#	models/repo.go
  • Loading branch information
davidsvantesson committed Oct 5, 2019
commit 5316bdfd857c6350fae183d4e7ea1dccbaac25b0
19 changes: 19 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,26 @@ var migrations = []Migration{
// v89 -> v90
NewMigration("add original author/url migration info to issues, comments, and repo ", addOriginalMigrationInfo),
// v90 -> v91
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
// v91 -> v92
NewMigration("add index on owner_id of repository and type, review_id of comment", addIndexOnRepositoryAndComment),
// v92 -> v93
NewMigration("remove orphaned repository index statuses", removeLingeringIndexStatus),
// v93 -> v94
NewMigration("add email notification enabled preference to user", addEmailNotificationEnabledToUser),
// v94 -> v95
NewMigration("add enable_status_check, status_check_contexts to protected_branch", addStatusCheckColumnsForProtectedBranches),
// v95 -> v96
NewMigration("add table columns for cross referencing issues", addCrossReferenceColumns),
// v96 -> v97
NewMigration("delete orphaned attachments", deleteOrphanedAttachments),
// v97 -> v98
NewMigration("add repo_admin_change_team_access to user", addRepoAdminChangeTeamAccessColumnForUser),
// v98 -> v99
NewMigration("add original author name and id on migrated release", addOriginalAuthorOnMigratedReleases),
// v99 -> v100
NewMigration("add includes_all_repositories to teams", addTeamIncludesAllRepositories),

}

// Migrate database to current version
Expand Down
23 changes: 8 additions & 15 deletions models/migrations/v90.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@

package migrations

import (
"github.com/go-xorm/xorm"
)
import "github.com/go-xorm/xorm"

func addTeamIncludesAllRepositories(x *xorm.Engine) error {

type Team struct {
ID int64 `xorm:"pk autoincr"`
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
}

if err := x.Sync2(new(Team)); err != nil {
return err
func changeSomeColumnsLengthOfRepo(x *xorm.Engine) error {
type Repository struct {
ID int64 `xorm:"pk autoincr"`
Description string `xorm:"TEXT"`
Website string `xorm:"VARCHAR(2048)"`
OriginalURL string `xorm:"VARCHAR(2048)"`
}

_, err := x.Exec("UPDATE `team` SET `includes_all_repositories` = ? WHERE `name`=?",
true, "Owners")
return err
return x.Sync2(new(Repository))
}
25 changes: 25 additions & 0 deletions models/migrations/v99.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2019 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.

package migrations

import (
"github.com/go-xorm/xorm"
)

func addTeamIncludesAllRepositories(x *xorm.Engine) error {

type Team struct {
ID int64 `xorm:"pk autoincr"`
IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
}

if err := x.Sync2(new(Team)); err != nil {
return err
}

_, err := x.Exec("UPDATE `team` SET `includes_all_repositories` = ? WHERE `name`=?",
true, "Owners")
return err
}
5 changes: 5 additions & 0 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,11 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err
return fmt.Errorf("updateUser: %v", err)
}

if _, err = e.Incr("num_repos").ID(u.ID).Update(new(User)); err != nil {
return fmt.Errorf("increment user total_repos: %v", err)
}
u.NumRepos++

// Give access to all members in teams with access to all repositories.
if u.IsOrganization() {
if err := u.GetTeams(); err != nil {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.