diff options
Diffstat (limited to 'routers/api/v1/org/member.go')
-rw-r--r-- | routers/api/v1/org/member.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go index d818321790..7f82f19385 100644 --- a/routers/api/v1/org/member.go +++ b/routers/api/v1/org/member.go @@ -39,7 +39,7 @@ func listMembers(ctx *context.APIContext, publicOnly bool) { apiMembers := make([]*api.User, len(members)) for i, member := range members { - apiMembers[i] = convert.ToUser(member, ctx.User) + apiMembers[i] = convert.ToUser(member, ctx.Doer) } ctx.SetTotalCountHeader(count) @@ -72,13 +72,13 @@ func ListMembers(ctx *context.APIContext) { // "$ref": "#/responses/UserList" publicOnly := true - if ctx.User != nil { - isMember, err := ctx.Org.Organization.IsOrgMember(ctx.User.ID) + if ctx.Doer != nil { + isMember, err := ctx.Org.Organization.IsOrgMember(ctx.Doer.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrgMember", err) return } - publicOnly = !isMember && !ctx.User.IsAdmin + publicOnly = !isMember && !ctx.Doer.IsAdmin } listMembers(ctx, publicOnly) } @@ -139,12 +139,12 @@ func IsMember(ctx *context.APIContext) { if ctx.Written() { return } - if ctx.User != nil { - userIsMember, err := ctx.Org.Organization.IsOrgMember(ctx.User.ID) + if ctx.Doer != nil { + userIsMember, err := ctx.Org.Organization.IsOrgMember(ctx.Doer.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrgMember", err) return - } else if userIsMember || ctx.User.IsAdmin { + } else if userIsMember || ctx.Doer.IsAdmin { userToCheckIsMember, err := ctx.Org.Organization.IsOrgMember(userToCheck.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrgMember", err) @@ -154,7 +154,7 @@ func IsMember(ctx *context.APIContext) { ctx.NotFound() } return - } else if ctx.User.ID == userToCheck.ID { + } else if ctx.Doer.ID == userToCheck.ID { ctx.NotFound() return } @@ -230,7 +230,7 @@ func PublicizeMember(ctx *context.APIContext) { if ctx.Written() { return } - if userToPublicize.ID != ctx.User.ID { + if userToPublicize.ID != ctx.Doer.ID { ctx.Error(http.StatusForbidden, "", "Cannot publicize another member") return } @@ -270,7 +270,7 @@ func ConcealMember(ctx *context.APIContext) { if ctx.Written() { return } - if userToConceal.ID != ctx.User.ID { + if userToConceal.ID != ctx.Doer.ID { ctx.Error(http.StatusForbidden, "", "Cannot conceal another member") return } |