rgw/admin: include caps in User Struct for createUser()

The caps is option in RGW for providing special permissions for
the ceph user, include it on the User{} so that it can be send in
the request for CreateUser().

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
This commit is contained in:
Jiffin Tony Thottan 2021-08-10 00:24:02 +05:30 committed by mergify[bot]
parent 8d946bafeb
commit 9edf093e7e
2 changed files with 5 additions and 1 deletions

View File

@ -33,6 +33,7 @@ type User struct {
PurgeData *int `url:"purge-data"`
GenerateStat *bool `url:"stats"`
Stat UserStat `json:"stats"`
UserCaps string `url:"user-caps"`
}
// UserCapSpec represents a user capability which gives access to certain ressources

View File

@ -95,7 +95,8 @@ func (suite *RadosGWTestSuite) TestUser() {
})
suite.T().Run("user creation success", func(t *testing.T) {
user, err := co.CreateUser(context.Background(), User{ID: "leseb", DisplayName: "This is leseb", Email: "leseb@example.com"})
usercaps := "users=read"
user, err := co.CreateUser(context.Background(), User{ID: "leseb", DisplayName: "This is leseb", Email: "leseb@example.com", UserCaps: usercaps})
assert.NoError(suite.T(), err)
assert.Equal(suite.T(), "leseb@example.com", user.Email)
})
@ -104,6 +105,8 @@ func (suite *RadosGWTestSuite) TestUser() {
user, err := co.GetUser(context.Background(), User{ID: "leseb"})
assert.NoError(suite.T(), err)
assert.Equal(suite.T(), "leseb@example.com", user.Email)
assert.Equal(suite.T(), "users", user.Caps[0].Type)
assert.Equal(suite.T(), "read", user.Caps[0].Perm)
})
suite.T().Run("modify user email", func(t *testing.T) {