Skip to content

Commit

Permalink
Merge pull request #48 from titouanfreville/issue-30-secureAPI
Browse files Browse the repository at this point in the history
linted
  • Loading branch information
titouanfreville authored Apr 8, 2017
2 parents a49097a + cf0fb08 commit bbec283
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions api/member_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func initMemberOverUser(userRoutes chi.Router) {
// 422: wrongEntity
// 503: databaseError
// default: genericError
userRoutes.Post("/role/:roleID", getMemberFromRole)
// swagger:route PUT user/{userID}/channel/{channelID} Members updateMember
//
// Update member
Expand All @@ -160,6 +159,7 @@ func initMemberOverUser(userRoutes chi.Router) {
// default: genericError
r.Delete("/", deleteMember)
})
userRoutes.Get("/role/:roleID", getMemberFromRole)
}

func memberContext(next http.Handler) http.Handler {
Expand Down Expand Up @@ -203,12 +203,12 @@ func memberContext(next http.Handler) http.Handler {
}
oldMember = datastores.Store().Member().GetByID(channel.IDChannel, userID, dbStore.db)
}
roleId, err := strconv.ParseUint(chi.URLParam(r, "roleID"), 10, 64)
roleID, err := strconv.ParseUint(chi.URLParam(r, "roleID"), 10, 64)
if err != nil {
roleName := chi.URLParam(r, "roleID")
role = datastores.Store().Role().GetByName(roleName, dbStore.db)
} else {
role = datastores.Store().Role().GetByID(roleId, dbStore.db)
role = datastores.Store().Role().GetByID(roleID, dbStore.db)
}
ctx = context.WithValue(ctx, oldMemberKey, oldMember)
ctx = context.WithValue(ctx, oldChannelKey, channel)
Expand Down
2 changes: 1 addition & 1 deletion api/user_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func initUserRoute(router chi.Router) {
// default: deleteMessage
r.Delete("/", deleteUser)
initUserParameterRoute(r)
initMemberOverUser(r)
//initMemberOverUser(r)
})
})
}
Expand Down

0 comments on commit bbec283

Please sign in to comment.