Skip to content

Commit cfbdedc

Browse files
author
wangqijia
committed
Merge branch 'fix/v4.0.5' into 'master'
Fix/v4.0.5 See merge request public-server/server-sdk-go!8
2 parents b6c3a11 + fa8ccc1 commit cfbdedc

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

sdk/entrustgroup.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ type CreateEntrustGroupModel struct {
3737
// EntrustGroupModel Entrust group update model
3838
type EntrustGroupModel struct {
3939
GroupId string `json:"groupId"` // Group ID
40-
Name string `json:"name"` // Group name
4140
GroupProfile string `json:"groupProfile"` // Group basic information
4241
GroupExtProfile string `json:"groupExtProfile"` // Group extended information
4342
Permissions string `json:"permissions"` // Permission settings
@@ -273,9 +272,6 @@ func (rc *RongCloud) EntrustGroupCreate(group CreateEntrustGroupModel) (Response
273272
if group.Owner == "" {
274273
return result, RCErrorNew(1002, "Parameter 'owner' is required")
275274
}
276-
if err := rc.validateUserIds(group.UserIds); err != nil {
277-
return result, err
278-
}
279275

280276
req := httplib.Post(rc.rongCloudURI + "/entrust/group/create.json")
281277
req.SetTimeout(time.Second*rc.timeout, time.Second*rc.timeout)
@@ -284,7 +280,9 @@ func (rc *RongCloud) EntrustGroupCreate(group CreateEntrustGroupModel) (Response
284280
req.Param("groupId", group.GroupId)
285281
req.Param("name", group.Name)
286282
req.Param("owner", group.Owner)
287-
req.Param("userIds", strings.Join(removeDuplicates(group.UserIds), ","))
283+
if group.UserIds != nil {
284+
req.Param("userIds", strings.Join(removeDuplicates(group.UserIds), ","))
285+
}
288286
if group.GroupProfile != "" {
289287
req.Param("groupProfile", group.GroupProfile)
290288
}
@@ -322,9 +320,6 @@ func (rc *RongCloud) EntrustGroupUpdateProfile(group EntrustGroupModel) (Respons
322320
rc.fillHeader(req)
323321

324322
req.Param("groupId", group.GroupId)
325-
if group.Name != "" {
326-
req.Param("name", group.Name)
327-
}
328323
if group.GroupProfile != "" {
329324
req.Param("groupProfile", group.GroupProfile)
330325
}

sdk/entrustgroup_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ func TestRongCloud_EntrustGroupCreate(t *testing.T) {
2929
)
3030

3131
group := CreateEntrustGroupModel{
32-
GroupId: "entrust_group_002",
33-
Name: "Test Entrust Group",
34-
Owner: "user001",
35-
UserIds: []string{"user001", "user002", "user003"},
32+
GroupId: "entrust_group_002",
33+
Name: "Test Entrust Group",
34+
Owner: "user001",
35+
// UserIds: []string{"user001", "user002", "user003"},
3636
GroupProfile: `{"portraitUrl":"http://test_url"}`,
3737
GroupExtProfile: `{"ext_00":"ext_00v"}`,
3838
Permissions: `{"joinPerm":1}`,
@@ -53,7 +53,6 @@ func TestRongCloud_EntrustGroupUpdateProfile(t *testing.T) {
5353

5454
group := EntrustGroupModel{
5555
GroupId: "entrust_group_001",
56-
Name: "Updated Test Entrust Group",
5756
GroupProfile: `{"portraitUrl":"http://test_url_001"}`,
5857
GroupExtProfile: `{"ext_00":"ext_00v_001"}`,
5958
Permissions: `{"joinPerm":1}`,

0 commit comments

Comments
 (0)