fix(licenses): RequireUnitReader allows LicensedReadOnly #427
@@ -78,6 +78,10 @@ func RequireUnitWriter(unitTypes ...unit.Type) func(ctx *Context) {
|
||||
// RequireUnitReader returns a middleware for requiring repository write to one of the unit permission
|
||||
func RequireUnitReader(unitTypes ...unit.Type) func(ctx *Context) {
|
||||
return func(ctx *Context) {
|
||||
// Licensed read-only mode grants read access to all units.
|
||||
if ctx.Data["LicensedReadOnly"] == true {
|
||||
return
|
||||
}
|
||||
for _, unitType := range unitTypes {
|
||||
if ctx.Repo.Permission.CanRead(unitType) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user