mirror of
https://github.com/go-gitea/gitea.git
synced 2025-01-04 09:17:43 +03:00
Merge 046151ef90
into d45456b1b5
This commit is contained in:
commit
b7529c030e
@ -240,9 +240,16 @@ func PublicizeMember(ctx *context.APIContext) {
|
|||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if userToPublicize.ID != ctx.Doer.ID {
|
if userToPublicize.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin {
|
||||||
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
|
isOwner, err := ctx.Org.Organization.IsOwnedBy(ctx, ctx.Doer.ID)
|
||||||
return
|
if err != nil {
|
||||||
|
ctx.Error(http.StatusInternalServerError, "IsOwnedBy", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !isOwner {
|
||||||
|
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToPublicize.ID, true)
|
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToPublicize.ID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -282,9 +289,16 @@ func ConcealMember(ctx *context.APIContext) {
|
|||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if userToConceal.ID != ctx.Doer.ID {
|
if userToConceal.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin {
|
||||||
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
|
isOwner, err := ctx.Org.Organization.IsOwnedBy(ctx, ctx.Doer.ID)
|
||||||
return
|
if err != nil {
|
||||||
|
ctx.Error(http.StatusInternalServerError, "IsOwnedBy", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !isOwner {
|
||||||
|
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToConceal.ID, false)
|
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToConceal.ID, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user