/users/whatid using querystring param name
This commit is contained in:
parent
3a199b8c41
commit
8114329d38
|
@ -29,7 +29,7 @@ func Start(conf common.Conf, db *sql.DB) *gin.Engine {
|
||||||
// Read privilege required
|
// Read privilege required
|
||||||
gv1.GET("/users", Method(v1.UsersGET, db, common.PrivilegeRead))
|
gv1.GET("/users", Method(v1.UsersGET, db, common.PrivilegeRead))
|
||||||
gv1.GET("/users/self", Method(v1.UserSelfGET, db, common.PrivilegeRead))
|
gv1.GET("/users/self", Method(v1.UserSelfGET, db, common.PrivilegeRead))
|
||||||
gv1.GET("/users/whatid/:username", Method(v1.UserWhatsTheIDGET, db, common.PrivilegeRead))
|
gv1.GET("/users/whatid", Method(v1.UserWhatsTheIDGET, db, common.PrivilegeRead))
|
||||||
gv1.GET("/users/full/:id", Method(v1.UserFullGET, db, common.PrivilegeRead))
|
gv1.GET("/users/full/:id", Method(v1.UserFullGET, db, common.PrivilegeRead))
|
||||||
gv1.GET("/users/userpage/:id", Method(v1.UserUserpageGET, db, common.PrivilegeRead))
|
gv1.GET("/users/userpage/:id", Method(v1.UserUserpageGET, db, common.PrivilegeRead))
|
||||||
gv1.GET("/badges", Method(v1.BadgesGET, db, common.PrivilegeRead))
|
gv1.GET("/badges", Method(v1.BadgesGET, db, common.PrivilegeRead))
|
||||||
|
|
|
@ -125,7 +125,7 @@ func UserWhatsTheIDGET(md common.MethodData) common.CodeMessager {
|
||||||
r whatIDResponse
|
r whatIDResponse
|
||||||
allowed int
|
allowed int
|
||||||
)
|
)
|
||||||
err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ? LIMIT 1", md.C.Param("username")).Scan(&r.ID, &allowed)
|
err := md.DB.QueryRow("SELECT id, allowed FROM users WHERE username = ? LIMIT 1", md.C.Query("name")).Scan(&r.ID, &allowed)
|
||||||
if err != nil || (allowed != 1 && !md.User.Privileges.HasPrivilegeViewUserAdvanced()) {
|
if err != nil || (allowed != 1 && !md.User.Privileges.HasPrivilegeViewUserAdvanced()) {
|
||||||
return common.SimpleResponse(404, "That user could not be found!")
|
return common.SimpleResponse(404, "That user could not be found!")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user