diff options
author | Florian Kaiser <florian.kaiser@fnkr.net> | 2016-02-02 19:29:35 +0000 |
---|---|---|
committer | Florian Kaiser <florian.kaiser@fnkr.net> | 2016-02-05 15:49:01 +0000 |
commit | 90e9e3c89d01c58b68c71f47249a6190c04797a0 (patch) | |
tree | a0cb8dc319ac6cdd37068f0c644a162a79c4d4b4 /routers | |
parent | d4583ebd4b2c1508ce01ea0e7f62dacd223db5c1 (diff) | |
download | gitea-90e9e3c89d01c58b68c71f47249a6190c04797a0.tar.gz gitea-90e9e3c89d01c58b68c71f47249a6190c04797a0.zip |
Only show repositories on organization dashboard, that the user has access to
Diffstat (limited to 'routers')
-rw-r--r-- | routers/user/home.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/routers/user/home.go b/routers/user/home.go index 61cda33be2..e1f942df8f 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -109,10 +109,20 @@ func Dashboard(ctx *middleware.Context) { ctx.Data["CollaborativeRepos"] = collaborateRepos } - repos, err := models.GetRepositories(ctxUser.Id, true) - if err != nil { - ctx.Handle(500, "GetRepositories", err) - return + var repos []*models.Repository + if ctxUser.IsOrganization() { + if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil { + ctx.Handle(500, "GetUserRepositories", err) + return + } + repos = ctxUser.Repos + } else { + var err error + repos, err = models.GetRepositories(ctxUser.Id, true) + if err != nil { + ctx.Handle(500, "GetRepositories", err) + return + } } ctx.Data["Repos"] = repos @@ -120,7 +130,7 @@ func Dashboard(ctx *middleware.Context) { mirrors := make([]*models.Repository, 0, 5) for _, repo := range repos { if repo.IsMirror { - if err = repo.GetMirror(); err != nil { + if err := repo.GetMirror(); err != nil { ctx.Handle(500, "GetMirror: "+repo.Name, err) return } |