管理使用者存取權

透過集合功能整理內容 你可以依據偏好儲存及分類內容。

管理員可以建立 Google Ads Query Language 陳述式,查詢與客戶 ID 相關聯的所有 CustomerUserAccess 實體,藉此取得具有帳戶存取權的使用者名單。一般查詢如下:

SELECT
  customer_user_access.user_id,
  customer_user_access.email_address,
  customer_user_access.access_role,
  customer_user_access.access_creation_date_time,
  customer_user_access.inviter_user_email_address
FROM customer_user_access

您也可以稽核有權存取您帳戶的使用者、修改其存取層級,以及移除使用者帳戶。進一步瞭解帳戶存取層級

以下程式碼範例示範如何修改使用者的存取角色。這個呼叫假設您已執行上述查詢,指出正確的使用者存取權。

private void ModifyUserAccess(GoogleAdsClient client, long customerId, long userId,
    AccessRole accessRole)
{
    // Get the CustomerUserAccessService.
    CustomerUserAccessServiceClient userAccessService = client.GetService(
        Services.V12.CustomerUserAccessService);

    // Creates the modified user access.
    CustomerUserAccess userAccess = new CustomerUserAccess()
    {
        ResourceName = ResourceNames.CustomerUserAccess(customerId, userId),
        AccessRole = accessRole
    };

    // Creates the operation.
    CustomerUserAccessOperation operation = new CustomerUserAccessOperation()
    {
        Update = userAccess,
        UpdateMask = FieldMasks.AllSetFieldsOf(userAccess)
    };

    // Updates the user access.
    MutateCustomerUserAccessResponse response =
        userAccessService.MutateCustomerUserAccess(
            customerId.ToString(), operation);

    // Displays the result.
    Console.WriteLine($"Successfully modified customer user access with " +
        $"resource name '{response.Result.ResourceName}'.");
}