@ -384,18 +384,18 @@ func registerRoutes(m *web.Route) {
return func ( ctx * context . Context ) {
return func ( ctx * context . Context ) {
// only check global disabled units when ignoreGlobal is false
// only check global disabled units when ignoreGlobal is false
if ! ignoreGlobal && unitType . UnitGlobalDisabled ( ) {
if ! ignoreGlobal && unitType . UnitGlobalDisabled ( ) {
ctx . NotFound ( unitType . String( ) , nil )
ctx . NotFound ( "Repo unit is is disabled: " + unitType . Log String( ) , nil )
return
return
}
}
if ctx . ContextUser == nil {
if ctx . ContextUser == nil {
ctx . NotFound ( unitType . String ( ) , nil )
ctx . NotFound ( "ContextUser is nil" , nil )
return
return
}
}
if ctx . ContextUser . IsOrganization ( ) {
if ctx . ContextUser . IsOrganization ( ) {
if ctx . Org . Organization . UnitPermission ( ctx , ctx . Doer , unitType ) < accessMode {
if ctx . Org . Organization . UnitPermission ( ctx , ctx . Doer , unitType ) < accessMode {
ctx . NotFound ( unitType . String ( ) , nil )
ctx . NotFound ( "ContextUser is org but doer has no access to unit" , nil )
return
return
}
}
}
}
@ -487,7 +487,7 @@ func registerRoutes(m *web.Route) {
m . Get ( "/organizations" , explore . Organizations )
m . Get ( "/organizations" , explore . Organizations )
m . Get ( "/code" , func ( ctx * context . Context ) {
m . Get ( "/code" , func ( ctx * context . Context ) {
if unit . TypeCode . UnitGlobalDisabled ( ) {
if unit . TypeCode . UnitGlobalDisabled ( ) {
ctx . NotFound ( unit . TypeCode . String ( ) , nil )
ctx . NotFound ( "Repo unit code is disabled" , nil )
return
return
}
}
} , explore . Code )
} , explore . Code )