mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-06-22 10:02:15 +00:00
32 lines
801 B
Go
32 lines
801 B
Go
// Copyright 2026 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package permissions
|
|
|
|
import (
|
|
"forgejo.org/models/unit"
|
|
"forgejo.org/modules/log"
|
|
)
|
|
|
|
func MustEnableIssues(ctx Context) {
|
|
if !ctx.GetPermission().CanRead(unit.TypeIssues) {
|
|
if log.IsTrace() {
|
|
if ctx.GetIsSigned() {
|
|
log.Trace("Permission Denied: User %-v cannot read %-v in Repo %-v\n"+
|
|
"User in Repo has Permissions: %-+v",
|
|
ctx.GetDoer(),
|
|
unit.TypeIssues,
|
|
ctx.GetRepository(),
|
|
ctx.GetPermission())
|
|
} else {
|
|
log.Trace("Permission Denied: Anonymous user cannot read %-v in Repo %-v\n"+
|
|
"Anonymous user in Repo has Permissions: %-+v",
|
|
unit.TypeIssues,
|
|
ctx.GetRepository(),
|
|
ctx.GetPermission())
|
|
}
|
|
}
|
|
ctx.NotFound()
|
|
return
|
|
}
|
|
}
|