summaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2019-11-06 10:37:14 +0100
committerLauris BH <lauris@nix.lv>2019-11-06 11:37:14 +0200
commit72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8 (patch)
tree3ac89c3c7b28572737b20dfe8cbeed259184d91b /models/org.go
parent0109229928d8603ebedc2364943538f788635370 (diff)
downloadgitea-72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8.tar.gz
gitea-72aa5a20ecf8aa3f7c110fd51c37994d950e0ba8.zip
Add team option to grant rights for all organization repositories (#8688)
* Add field IsAllRepositories to team * Add AllRepositories to team UI * Manage team with access to all repositories * Add field IsAllRepositories to team API * put backticks around table/column names * rename IsAllRepositories to IncludesAllRepositories * do not reload slice if already loaded * add repo to teams with access to all repositories when changing repo owner * improve tests for teams with access to all repositories * Merge branch 'master' * Change code for adding all repositories Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * fmt after merge * Change code in API EditTeam similar to EditTeamPost web interface Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Clarify that all repositories will be added Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * All repositories option under Permissions headline * New setting group 'Repository access' * Move check IncludeAllRepositories to removeRepository. * Revert "Move check IncludeAllRepositories to removeRepository." and add comment instead. This reverts commit 753b7d205be260b8be465b5291a02975a81f3093. * Clarify help text what options do.
Diffstat (limited to 'models/org.go')
-rw-r--r--models/org.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/models/org.go b/models/org.go
index 2cc302dac6..78b035b101 100644
--- a/models/org.go
+++ b/models/org.go
@@ -48,6 +48,9 @@ func (org *User) GetOwnerTeam() (*Team, error) {
}
func (org *User) getTeams(e Engine) error {
+ if org.Teams != nil {
+ return nil
+ }
return e.
Where("org_id=?", org.ID).
OrderBy("CASE WHEN name LIKE '" + ownerTeamName + "' THEN '' ELSE name END").
@@ -149,11 +152,12 @@ func CreateOrganization(org, owner *User) (err error) {
// Create default owner team.
t := &Team{
- OrgID: org.ID,
- LowerName: strings.ToLower(ownerTeamName),
- Name: ownerTeamName,
- Authorize: AccessModeOwner,
- NumMembers: 1,
+ OrgID: org.ID,
+ LowerName: strings.ToLower(ownerTeamName),
+ Name: ownerTeamName,
+ Authorize: AccessModeOwner,
+ NumMembers: 1,
+ IncludesAllRepositories: true,
}
if _, err = sess.Insert(t); err != nil {
return fmt.Errorf("insert owner team: %v", err)