[API] Add Restricted Field to User (#14630)
* Expose Restricted field for User * Add Option to Change Restricted on User via adminEditUser API * Add test who change restricted & test if it changed it ... * make generate-swagger Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
ce0346448f
commit
8d5c795cc4
6 changed files with 36 additions and 6 deletions
|
@ -192,4 +192,18 @@ func TestAPIEditUser(t *testing.T) {
|
|||
errMap := make(map[string]interface{})
|
||||
json.Unmarshal(resp.Body.Bytes(), &errMap)
|
||||
assert.EqualValues(t, "email is not allowed to be empty string", errMap["message"].(string))
|
||||
|
||||
user2 := models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
|
||||
assert.Equal(t, false, user2.IsRestricted)
|
||||
bTrue := true
|
||||
req = NewRequestWithJSON(t, "PATCH", urlStr, api.EditUserOption{
|
||||
// required
|
||||
LoginName: "user2",
|
||||
SourceID: 0,
|
||||
// to change
|
||||
Restricted: &bTrue,
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
user2 = models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
|
||||
assert.Equal(t, true, user2.IsRestricted)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue