ping now returns both user and token privileges and their string representation
This commit is contained in:
parent
61527882d1
commit
9bfbb50ffd
|
@ -88,7 +88,10 @@ func surpriseMe() string {
|
||||||
type pingResponse struct {
|
type pingResponse struct {
|
||||||
common.ResponseBase
|
common.ResponseBase
|
||||||
ID int `json:"user_id"`
|
ID int `json:"user_id"`
|
||||||
Privileges uint64 `json:"privileges"`
|
Privileges common.Privileges `json:"privileges"`
|
||||||
|
UserPrivileges common.UserPrivileges `json:"user_privileges"`
|
||||||
|
PrivilegesS string `json:"privileges_string"`
|
||||||
|
UserPrivilegesS string `json:"user_privileges_string"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PingGET is a message to check with the API that we are logged in, and know what are our privileges.
|
// PingGET is a message to check with the API that we are logged in, and know what are our privileges.
|
||||||
|
@ -103,7 +106,10 @@ func PingGET(md common.MethodData) common.CodeMessager {
|
||||||
}
|
}
|
||||||
|
|
||||||
r.ID = md.ID()
|
r.ID = md.ID()
|
||||||
r.Privileges = uint64(md.User.TokenPrivileges)
|
r.Privileges = md.User.TokenPrivileges
|
||||||
|
r.UserPrivileges = md.User.UserPrivileges
|
||||||
|
r.PrivilegesS = md.User.TokenPrivileges.String()
|
||||||
|
r.UserPrivilegesS = md.User.UserPrivileges.String()
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ SELECT users.id, users.username, register_datetime, privileges,
|
||||||
latest_activity, users_stats.username_aka,
|
latest_activity, users_stats.username_aka,
|
||||||
users_stats.country
|
users_stats.country
|
||||||
FROM users
|
FROM users
|
||||||
LEFT JOIN users_stats
|
INNER JOIN users_stats
|
||||||
ON users.id=users_stats.id
|
ON users.id=users_stats.id
|
||||||
WHERE ` + whereClause + ` AND ` + md.User.OnlyUserPublic(true) + `
|
WHERE ` + whereClause + ` AND ` + md.User.OnlyUserPublic(true) + `
|
||||||
LIMIT 1`
|
LIMIT 1`
|
||||||
|
@ -98,7 +98,7 @@ type modeData struct {
|
||||||
Level float64 `json:"level"`
|
Level float64 `json:"level"`
|
||||||
Accuracy float64 `json:"accuracy"`
|
Accuracy float64 `json:"accuracy"`
|
||||||
PP int `json:"pp"`
|
PP int `json:"pp"`
|
||||||
GlobalLeaderboardRank int `json:"global_leaderboard_rank"`
|
GlobalLeaderboardRank *int `json:"global_leaderboard_rank"`
|
||||||
}
|
}
|
||||||
type userFullResponse struct {
|
type userFullResponse struct {
|
||||||
common.ResponseBase
|
common.ResponseBase
|
||||||
|
|
Loading…
Reference in New Issue
Block a user