Admin SDK Enterprise License Manager Service

سرویس Admin SDK Enterprise License Manager به شما امکان می دهد از Admin SDK Enterprise License Manager API در Apps Script استفاده کنید. این API به مدیران دامنه اجازه می دهد تا مجوزهای کاربر را اختصاص دهند، به روز کنند، بازیابی کنند و حذف کنند.

ارجاع

برای اطلاعات دقیق در مورد این سرویس، به مستندات مرجع Admin SDK Enterprise License Manager API مراجعه کنید. مانند همه سرویس‌های پیشرفته در Apps Script، سرویس Admin SDK Enterprise License Manager از همان اشیا، روش‌ها و پارامترهای API عمومی استفاده می‌کند. برای اطلاعات بیشتر، نحوه تعیین امضای روش را ببینید.

برای گزارش مشکلات و یافتن پشتیبانی دیگر، راهنمای پشتیبانی مدیر مجوز مدیریت SDK Enterprise را ببینید.

کد نمونه

کد نمونه زیر از نسخه 1 API استفاده می کند.

لیستی از تخصیص مجوز برای دامنه دریافت کنید

این نمونه تخصیص مجوزها، از جمله شناسه محصول و شناسه sku را برای کاربران در دامنه ثبت می کند. به استفاده از نشانه های صفحه برای دسترسی به لیست کامل نتایج توجه کنید.

advanced/adminSDK.gs
/**
 * Logs the license assignments, including the product ID and the sku ID, for
 * the users in the domain. Notice the use of page tokens to access the full
 * list of results.
 */
function getLicenseAssignments() {
  const productId = 'Google-Apps';
  const customerId = 'example.com';
  let assignments = [];
  let pageToken = null;
  do {
    const response = AdminLicenseManager.LicenseAssignments.listForProduct(productId, customerId, {
      maxResults: 500,
      pageToken: pageToken
    });
    assignments = assignments.concat(response.items);
    pageToken = response.nextPageToken;
  } while (pageToken);
  // Print the productId and skuId
  for (const assignment of assignments) {
    console.log('userId: %s, productId: %s, skuId: %s',
        assignment.userId, assignment.productId, assignment.skuId);
  }
}

درج یک مجوز برای یک کاربر

این نمونه نحوه درج تخصیص مجوز برای یک کاربر، برای یک شناسه محصول معین و ترکیب ID sku را نشان می دهد.

advanced/adminSDK.gs
/**
 * Insert a license assignment for a user, for a given product ID and sku ID
 * combination.
 * For more details follow the link
 * https://developers.google.com/admin-sdk/licensing/reference/rest/v1/licenseAssignments/insert
 */
function insertLicenseAssignment() {
  const productId = 'Google-Apps';
  const skuId = 'Google-Vault';
  const userId = 'marty@hoverboard.net';
  try {
    const results = AdminLicenseManager.LicenseAssignments
        .insert({userId: userId}, productId, skuId);
    console.log(results);
  } catch (e) {
    // TODO (developer) - Handle exception.
    console.log('Failed with an error %s ', e.message);
  }
}