Skip to content

Commit

Permalink
rewrite by using existing sub func
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Jul 28, 2019
1 parent 2494db4 commit 4f44e72
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions models/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,13 @@ type OrgUser struct {
}

func isOrganizationOwner(e Engine, orgID, uid int64) (bool, error) {
ownerTeam := &Team{
OrgID: orgID,
Name: ownerTeamName,
}
if has, err := e.Get(ownerTeam); err != nil {
ownerTeam, err := getTeam(e, orgID, ownerTeamName)
if err != nil {
if err == ErrTeamNotExist {
log.Error("Organization does not have owner team: %d", orgID)
return false, nil
}
return false, err
} else if !has {
log.Error("Organization does not have owner team: %d", orgID)
return false, nil
}
return isTeamMember(e, orgID, ownerTeam.ID, uid)
}
Expand Down

0 comments on commit 4f44e72

Please sign in to comment.