parent
e9e4b64500
commit
83e03c1257
1 changed files with 9 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -65,14 +66,15 @@ func WsUser(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// user must have read access to the repository
|
role, permerr := datastore.GetPerm(ctx, user, work.Repo)
|
||||||
// in order to pass this message along
|
if permerr != nil && permerr != sql.ErrNoRows {
|
||||||
if role, err := datastore.GetPerm(ctx, user, work.Repo); err != nil || role.Read == false {
|
// for debugging
|
||||||
if err != nil {
|
log.Printf("WS: Error getting permissions for repository %s. Error: %s\n", work.Repo.Name, permerr)
|
||||||
log.Printf("WS: Error getting permissions for repository %s. Error: %s\n", work.Repo.Name, err)
|
|
||||||
} else {
|
|
||||||
log.Printf("WS: No read access for repository %s\n", work.Repo.Name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// user must have read access to private the repository
|
||||||
|
// in order to pass this message along
|
||||||
|
if work.Repo.Private == true && role.Read == false {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue