Skip to content

Commit

Permalink
add support for user lookup by different indeces
Browse files Browse the repository at this point in the history
  • Loading branch information
stremovsky committed Aug 15, 2024
1 parent 0c797e5 commit 37febca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bunker.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (e mainEnv) setupRouter() *httprouter.Router {
router.POST("/v1/exp/start/:mode/:identity", e.expStart)
router.DELETE("/v1/exp/cancel/:mode/:identity", e.expCancel)

router.POST("/v1/sharedrecord/token/:token", e.newSharedRecord)
router.POST("/v1/sharedrecord/:mode/:identity", e.newSharedRecord)
router.GET("/v1/get/:record", e.getRecord)

router.GET("/v1/request/:request", e.getUserRequest)
Expand Down
8 changes: 5 additions & 3 deletions src/sharedrecords_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import (
)

func (e mainEnv) newSharedRecord(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
userTOKEN := ps.ByName("token")
event := audit("create shareable record by user token", userTOKEN, "token", userTOKEN)
identity := ps.ByName("identity")
mode := ps.ByName("mode")
event := audit("create shareable record by "+mode, identity, "token", identity)
defer func() { event.submit(e.db, e.conf) }()

if enforceUUID(w, userTOKEN, event) == false {
userTOKEN := e.loadUserToken(w, r, mode, identity, event)
if userTOKEN == "" {
return
}
if e.enforceAuth(w, r, event) == "" {
Expand Down

0 comments on commit 37febca

Please sign in to comment.