【问题标题】:Google Apps Super Admin access to domain user calendarsGoogle Apps 超级管理员对域用户日历的访问权限
【发布时间】:2019-03-05 18:20:36
【问题描述】:

我有大量资源日历,我的用户需要根据他们的角色拥有不同程度的访问权限。我正在编写一个应用程序来管理这些 Acl 规则,但还想管理哪些日历出现在最终用户日历提要中(即我不想让他们突然看到所有 130 个资源日历并且必须过滤它们)

我需要使用 CalendarList api 访问,但是当我通过 users//calendarList 而不是使用超级管理员凭据授权的 users/me/calendarList 时,服务返回 404 响应。

我的目标是遍历我的共享日历资源列表,并为每位读者或 freeBusyReader 用户设置他们的 calendarListEntry.hidden 为 true。

【问题讨论】:

  • 您必须显示代码和确切的错误消息,以便我们提供帮助。
  • 好的,太好了。您可以在此处添加您的答案,以便遇到相同问题的其他人从中受益。

标签: google-calendar-api


【解决方案1】:

所以,我找到了答案。为了模拟用户,您必须在初始化服务帐户凭据时将“用户”设置为您希望模拟的电子邮件地址:

public static ServiceAccountCredential Credential(string[] Scopes, string impersonateEmail = null) { ServiceAccountCredential cred = ServiceAccountCredential.FromServiceAccountData(credential_stream); var initializer = new ServiceAccountCredential.Initializer(cred.Id) { User = string.IsNullOrEmpty(impersonateEmail)?service_acct:impersonateEmail, Key = cred.Key, Scopes = Scopes }; return new ServiceAccountCredential(initializer); }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 2019-06-17
    • 1970-01-01
    • 2019-05-18
    相关资源
    最近更新 更多