mirror of
https://github.com/go-gitea/gitea
synced 2025-01-31 05:47:44 +01:00
Allow admins and org owners to change org member public status
This commit is contained in:
parent
b348424c64
commit
d718e3f68c
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/models/organization"
|
"code.gitea.io/gitea/models/organization"
|
||||||
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
@ -236,7 +237,7 @@ 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 && !organization.IsUserOrgOwner(ctx, []*user_model.User{ctx.Doer}, ctx.Org.Organization.ID)[ctx.Doer.ID] {
|
||||||
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
|
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -278,7 +279,7 @@ 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 && !organization.IsUserOrgOwner(ctx, []*user_model.User{ctx.Doer}, ctx.Org.Organization.ID)[ctx.Doer.ID] {
|
||||||
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
|
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user