diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-20 23:43:26 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-12-21 09:43:26 +0200 |
commit | 515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4 (patch) | |
tree | 3a7143fc376af4402ca9008876be3afdc0c18efc /routers/api/v1/api.go | |
parent | 529482135c8e9304dd7cdf08772eaba61d903894 (diff) | |
download | gitea-515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4.tar.gz gitea-515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4.zip |
Fix ignored errors when checking if organization, team member (#3177)
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r-- | routers/api/v1/api.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index f6ed844d4a..588a763616 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -177,7 +177,10 @@ func reqOrgMembership() macaron.Handler { return } - if !models.IsOrganizationMember(orgID, ctx.User.ID) { + if isMember, err := models.IsOrganizationMember(orgID, ctx.User.ID); err != nil { + ctx.Error(500, "IsOrganizationMember", err) + return + } else if !isMember { if ctx.Org.Organization != nil { ctx.Error(403, "", "Must be an organization member") } else { @@ -200,7 +203,10 @@ func reqOrgOwnership() macaron.Handler { return } - if !models.IsOrganizationOwner(orgID, ctx.User.ID) { + isOwner, err := models.IsOrganizationOwner(orgID, ctx.User.ID) + if err != nil { + ctx.Error(500, "IsOrganizationOwner", err) + } else if !isOwner { if ctx.Org.Organization != nil { ctx.Error(403, "", "Must be an organization owner") } else { |