mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: only admin can specify user in BuyProduct() (#3287)
* fix: balance can be used without login * fix: balance can be used without login * fix: fix bug * fix: fix bug
This commit is contained in:
parent
dde936e935
commit
7ae067e369
@ -182,6 +182,10 @@ func (c *ApiController) BuyProduct() {
|
||||
paidUserName := c.Input().Get("userName")
|
||||
owner, _ := util.GetOwnerAndNameFromId(id)
|
||||
userId := util.GetId(owner, paidUserName)
|
||||
if paidUserName != "" && !c.IsAdmin() {
|
||||
c.ResponseError(c.T("general:Only admin user can specify user"))
|
||||
return
|
||||
}
|
||||
if paidUserName == "" {
|
||||
userId = c.GetSessionUsername()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user