New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Disable or Reduce "Explore" Page #5080
Comments
Thank you for adding this immediately to the next milestone (0.12)! And also thank you for providing us such a great product for free! |
As a workaround i just added this to nginx server block:
But a more fine-grained solution would be great. I just migrated from gitlab and love gogs! Awesome project. |
Meanwhile, could you point me to any quick hacky solution? Don't mind if it's not perfect. I've tried to download the source code, checkout 0.11.86 branch, modify diff --git a/routes/home.go b/routes/home.go
index 9835b55..215cd70 100644
--- a/routes/home.go
+++ b/routes/home.go
@@ -131,6 +131,7 @@ func ExploreUsers(c *context.Context) {
c.Data["Title"] = c.Tr("explore")
c.Data["PageIsExplore"] = true
c.Data["PageIsExploreUsers"] = true
+ c.Data["PageIsAdmin"] = true
RenderUserSearch(c, &UserSearchOptions{
Type: models.USER_TYPE_INDIVIDUAL,
@@ -146,6 +147,7 @@ func ExploreOrganizations(c *context.Context) {
c.Data["Title"] = c.Tr("explore")
c.Data["PageIsExplore"] = true
c.Data["PageIsExploreOrganizations"] = true
+ c.Data["PageIsAdmin"] = true
RenderUserSearch(c, &UserSearchOptions{
Type: models.USER_TYPE_ORGANIZATION,
diff --git a/templates/explore/navbar.tmpl b/templates/explore/navbar.tmpl
index 465e73e..1bbb109 100644
--- a/templates/explore/navbar.tmpl
+++ b/templates/explore/navbar.tmpl
@@ -4,11 +4,13 @@
<a class="{{if .PageIsExploreRepositories}}active{{end}} item" href="{{AppSubURL}}/explore/repos">
<span class="octicon octicon-repo"></span> {{.i18n.Tr "explore.repos"}}
</a>
+ {{if .LoggedUser.IsAdmin}}
<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubURL}}/explore/users">
<span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}}
</a>
<a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubURL}}/explore/organizations">
<span class="octicon octicon-organization"></span> {{.i18n.Tr "explore.organizations"}}
</a>
+ {{end}}
</div>
</div> Recompile, but a normal user is still able to view the users list. Don't know if I'm missing something... |
Sorry for last comment, it works, but have to advise that url routes are still accessible. So at least not visible :) |
Thanks to go-gitea/gitea#2908 (comment) I was able to protect routes against url browsing too: --- a/cmd/web.go
+++ b/cmd/web.go
@@ -177,6 +177,7 @@ func runWeb(c *cli.Context) error {
ignSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: setting.Service.RequireSignInView})
ignSignInAndCsrf := context.Toggle(&context.ToggleOptions{DisableCSRF: true})
reqSignOut := context.Toggle(&context.ToggleOptions{SignOutRequired: true})
+ reqAdmin := context.Toggle(&context.ToggleOptions{SignInRequired: true, AdminRequired: true})
bindIgnErr := binding.BindIgnErr
@@ -191,8 +192,8 @@ func runWeb(c *cli.Context) error {
c.Redirect(setting.AppSubURL + "/explore/repos")
})
m.Get("/repos", routes.ExploreRepos)
- m.Get("/users", routes.ExploreUsers)
- m.Get("/organizations", routes.ExploreOrganizations)
+ m.Get("/users", reqAdmin, routes.ExploreUsers)
+ m.Get("/organizations", reqAdmin, routes.ExploreOrganizations)
}, ignSignIn)
m.Combo("/install", routes.InstallInit).Get(routes.Install).
Post(bindIgnErr(form.Install{}), routes.InstallPost)
@@ -261,8 +262,6 @@ func runWeb(c *cli.Context) error {
})
// ***** END: User *****
- reqAdmin := context.Toggle(&context.ToggleOptions{SignInRequired: true, AdminRequired: true})
-
// ***** START: Admin *****
m.Group("/admin", func() {
m.Get("", admin.Dashboard) |
"[Service] REQUIRE_SIGNIN_VIEW = true " is prefered. |
Please add a configuration option to disable the "Explore" page - even when signed in.
Reason: I want that the user sees only the repositories and collaborators he works on and hide everything else from him (including all other users and organizations which are not relevant for him).
Another possible solution would be to add a configuration option "hideUsers" and "hideOrganizations" which would display "Explore" page, but show only the "Repositories" subpage (because only user-related repositories are displayed).
The text was updated successfully, but these errors were encountered: