Organization owners see all repositories & teams

tokarchuk/v1.17
Florian Kaiser 9 years ago
parent 8c4588c4c9
commit 9cf95e4e37
  1. 15
      modules/middleware/org.go

@ -88,9 +88,16 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
// Team. // Team.
if ctx.Org.IsMember { if ctx.Org.IsMember {
if err := org.GetUserTeams(ctx.User.Id); err != nil { if ctx.Org.IsOwner {
ctx.Handle(500, "GetUserTeams", err) if err := org.GetTeams(); err != nil {
return ctx.Handle(500, "GetUserTeams", err)
return
}
} else {
if err := org.GetUserTeams(ctx.User.Id); err != nil {
ctx.Handle(500, "GetUserTeams", err)
return
}
} }
} }
@ -98,6 +105,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
if len(teamName) > 0 { if len(teamName) > 0 {
teamExists := false teamExists := false
for _, team := range org.Teams { for _, team := range org.Teams {
if strings.ToLower(team.Name) == strings.ToLower(teamName) { if strings.ToLower(team.Name) == strings.ToLower(teamName) {
teamExists = true teamExists = true
ctx.Org.Team = team ctx.Org.Team = team
@ -125,7 +133,6 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
return return
} }
} }
} }
func OrgAssignment(args ...bool) macaron.Handler { func OrgAssignment(args ...bool) macaron.Handler {

Loading…
Cancel
Save