Skip to content

Commit

Permalink
Merge 68b91ce into 868f152
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyardrichter committed Jul 25, 2019
2 parents 868f152 + 68b91ce commit 47b1206
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arborist/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ func (resource *ResourceIn) createInDb(tx *sqlx.Tx) *ErrorResponse {
}

func (resource *ResourceIn) createRecursively(tx *sqlx.Tx) *ErrorResponse {
errResponse := resource.validate()
if errResponse != nil {
return errResponse
}
// arborist uses `/` for path separator; ltree in postgres uses `.`
path := formatPathForDb(resource.Path)
stmt := "INSERT INTO resource(path, description) VALUES ($1, $2)"
Expand Down
11 changes: 11 additions & 0 deletions arborist/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,17 @@ func (server *Server) handleUserRevokePolicy(w http.ResponseWriter, r *http.Requ

func (server *Server) handleUserListResources(w http.ResponseWriter, r *http.Request) {
username := mux.Vars(r)["username"]

// check if user exists at all first
user, err := userWithName(server.db, username)
if user == nil || err != nil {
msg := fmt.Sprintf("no user found with username: `%s`", username)
errResponse := newErrorResponse(msg, 404, nil)
errResponse.log.write(server.logger)
_ = errResponse.write(w, r)
return
}

service := ""
serviceQS, ok := r.URL.Query()["service"]
if ok {
Expand Down

0 comments on commit 47b1206

Please sign in to comment.