1
0
Fork 0
forked from forgejo/forgejo

Fix ignored errors when checking if organization, team member (#3177)

This commit is contained in:
Ethan Koenig 2017-12-20 23:43:26 -08:00 committed by Lauris BH
parent 529482135c
commit 515cdaa85d
16 changed files with 281 additions and 144 deletions

View file

@ -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 {