Browse Source

Fix index links and permitions for unloged users

communities
meskio 1 year ago
parent
commit
d4c070c9f9
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 6
      server/community.go
  2. 4
      tmpl/index.html

6
server/community.go

@ -103,6 +103,12 @@ func (s *server) communitiesHandler(w http.ResponseWriter, r *http.Request) {
func (s *server) userCommunitiesHandler(w http.ResponseWriter, r *http.Request) {
response := s.newResponse("communities", w, r)
if response.User == "" {
log.Println("Attemp to list own community without being logged")
s.forbiddenHandler(w, r)
return
}
communities, err := s.ldap.UserGroups(response.User)
if err != nil {
log.Println("An error ocurred retrieving community list: ", err)

4
tmpl/index.html

@ -44,8 +44,8 @@
<p>Bienvenida a lowry, nuestro burócrata preferido. ¿qué quieres hacer hoy?</p>
<ul class="list-group">
<li class="list-group-item"><a href="/password/">Cambiar la contraseña</a></li>
<li class="list-group-item"><a href="/community/">Ver mis colectividades</a></li>
<li class="list-group-item"><a href="/community/add/">Crear una colectividad</a></li>
<li class="list-group-item"><a href="/communities/mine/">Ver mis colectividades</a></li>
<li class="list-group-item"><a href="/communities/add/">Crear una colectividad</a></li>
{{if eq (printf "%v" .Role) "sindominante"}}
<li class="list-group-item"><a href="/adduser/">Invitar amiga a SinDominio</a></li>
{{end}}

Loading…
Cancel
Save