summaryrefslogtreecommitdiffstats
path: root/modules/context/org.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/context/org.go')
-rw-r--r--modules/context/org.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/context/org.go b/modules/context/org.go
index 9f4ce485e5..d020befa40 100644
--- a/modules/context/org.go
+++ b/modules/context/org.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models/perm"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/structs"
)
// Organization contains organization context
@@ -69,6 +70,20 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
return
}
org := ctx.Org.Organization
+
+ // Handle Visibility
+ if org.Visibility != structs.VisibleTypePublic && !ctx.IsSigned {
+ // We must be signed in to see limited or private organizations
+ ctx.NotFound("OrgAssignment", err)
+ return
+ }
+
+ if org.Visibility == structs.VisibleTypePrivate {
+ requireMember = true
+ } else if ctx.IsSigned && ctx.Doer.IsRestricted {
+ requireMember = true
+ }
+
ctx.ContextUser = org.AsUser()
ctx.Data["Org"] = org