mirror of
https://github.com/ceph/go-ceph
synced 2024-12-27 00:32:08 +00:00
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:
parent
8d946bafeb
commit
9edf093e7e
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user