diff options
author | 无闻 <u@gogs.io> | 2015-02-12 21:34:27 -0500 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2015-02-12 21:34:27 -0500 |
commit | 7fda0cdb9399e7011e8369283ad81ff19752ca6c (patch) | |
tree | be2c19a1a439a7bc997b2ce28c95fe39d08f9351 /routers/user | |
parent | 0b3722c3592ce79b2d0a5ea461366587d91250a5 (diff) | |
parent | 6c1ee384f1a45ed97f39b085209bcb79cafd9145 (diff) |
Merge pull request #941 from phsmit/access_refactor
Access refactor
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/home.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/routers/user/home.go b/routers/user/home.go index 5b02154c..ce82ae77 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -103,8 +103,7 @@ func Dashboard(ctx *middleware.Context) { feeds := make([]*models.Action, 0, len(actions)) for _, act := range actions { if act.IsPrivate { - if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName, - models.READABLE); !has { + if has, _ := models.HasAccess(ctx.User, &models.Repository{Id: act.RepoId, IsPrivate: true}, models.ACCESS_MODE_READ); !has { continue } } @@ -211,8 +210,8 @@ func Profile(ctx *middleware.Context) { if !ctx.IsSigned { continue } - if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName, - models.READABLE); !has { + if has, _ := models.HasAccess(ctx.User, &models.Repository{Id: act.RepoId, IsPrivate: true}, + models.ACCESS_MODE_READ); !has { continue } } |