Google Chat(Spaces)将成员添加为管理员

huangapple go评论44阅读模式
英文:

Google Chat (Spaces) Add Member as Manager

问题

我试图将不同的用户添加到 Google Space 并将其角色设置为成员(Members)或管理员(Managers)。但当我尝试将角色设置为 ROLE_MANAGER 时,它总是默认为 ROLE_MEMBER。根据参考文档的说明,"role" 是只读的,目前似乎无法更改。

然而,当我查看Google APIs Node.js Client的文档时,在悬停在该函数上时,它确实说明我可以在 RequestBody 的一部分中指定角色:

// 请求体元数据
requestBody: {
  // 请求体参数
  // {
  //   "createTime": "my_createTime",
  //   "member": {},
  //   "name": "my_name",
  //   "role": "my_role",
  //   "state": "my_state"
  // }
},

一个示例是:

const res = await chat.spaces.members.create({
  parent: 'spaces/XXXXXXXXXXXXX',
  requestBody: {
    member: {
      name: member,
      type: 'HUMAN',
    },
    role: 'ROLE_MANAGER',
  },
});
console.log(res);

有没有人知道是否有其他方法可以将用户添加到 Space 并将其角色设置为 "ROLE_MANAGER"?

英文:

I am attempting to add different users to a Google Space and set their roles as Members or Managers. When I try to set the role to ROLE_MANAGER, it always defaults to ROLE_MEMBER. In reading the reference and seeing that "role" is output only, this appears impossible currently.

However, when I view the documentation from Google APIs Node.js Client when I hover over the function , it does state that I can specify the role as part of RequestBody:

 // Request body metadata
    requestBody: {
      // request body parameters
      // {
      //   "createTime": "my_createTime",
      //   "member": {},
      //   "name": "my_name",
      //   "role": "my_role",
      //   "state": "my_state"
      // }
    },

An example of this is:

const res = await chat.spaces.members.create({
		parent: 'spaces/XXXXXXXXXXXXX',
		requestBody: {
			member: {
				name: member,
				type: 'HUMAN',
			},
			role: 'ROLE_MANAGER',
		},
	});
	console.log(res);

Does anyone know if there is another way to set the role to "ROLE_MANAGER" for a user being added to a Space?

答案1

得分: 1

No, 在添加用户到聊天空间时,目前无法分配“ROLE_MANAGER”角色。

如您所提到的文档中所述:

仅输出。用户在聊天空间内的角色,确定了他们在空间中被允许执行的操作。

此修订明确禁止分配“ROLE_MANAGER”角色。

不过,您可以选择从Google Chat API支持处请求此功能。

英文:

No, there is no way to assign the role 'ROLE_MANAGER' when adding a user to the chat space at yet.

As stated in the document you mentioned:

> Output only. User's role within a Chat space, which determines their permitted actions in the space.

This revision clarifies the prohibition on assigning the 'ROLE_MANAGER' role.

However, you have the option to request this feature from google chat API support.

huangapple
  • 本文由 发表于 2023年7月20日 10:46:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76726371.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定