示例#1
0
def log(message):
try:
    # Do I exist as a user?
    if not adobe_tools.user_exists(email):
        log("Creating account for %s" % email)
        # Add the user
        success = adobe_tools.add_federated_user(
            email,
            email,
            firstname,
            lastname,
            country
        )
        if not success:
            log("Failed to create account for %s" % email)
            sys.exit(1)

    # Does the user already have the product?
    log("Checking to see if %s already has %s" % (email, target_product))
    already_have = adobe_tools.does_user_have_product(email, target_product)
    if already_have:
        log("User %s already has product %s" % (email, target_product))
        sys.exit(0)

    # Add desired product
    log("Adding %s entitlement to %s" % (target_product, email))
    result = adobe_tools.add_products([target_product], email)
    if not result:
        log("Failed to add product %s to %s" % (target_product, email))
        sys.exit(1)

    log("Done.")
except adobe_api.AdobeAPIBadStatusException as e:
    log("Encountered exception: %s" % e)
    log(
        "You were most likely rate limited - "
        "this will automatically try again later. "
        "Alternatively, please contact Help Desk."
    )
    exit(1)
示例#2
0
me = ldap_lookup()  # Replace this with your own user lookup method
email = me.email
firstname = me.first_name
lastname = me.last_name
country = 'US'


def log(message):
  """Log with tag."""
  tag = 'CPE-add_adobe'
  print (tag + ': %s' % str(message))


# Do I exist as a user?
if not adobe_tools.user_exists(email):
  log("Creating account for %s" % email)
  # Add the user
  success = adobe_tools.add_federated_user(email, email, firstname,
                                           lastname, country)
  if not success:
    log("Failed to create account for %s" % email)
    sys.exit(1)

# Does the user already have the product?
log("Checking to see if %s already has %s" % (email, target_product))
already_have = adobe_tools.does_user_have_product(email, target_product)
if already_have:
  log("User %s already has product %s" % (email, target_product))
  sys.exit(0)
示例#3
0
  cfuser = SCDynamicStoreCopyConsoleUser(None, None, None)
  return cfuser[0]

me = getconsoleuser()
email = me + "@domain.com"
firstname = me
lastname = me
country = 'US'


def log(message):
  """Log with tag."""
  print 'CPE-add_adobe: ' + str(message)

# Do I exist as a user?
if not adobe_tools.user_exists(email):
  log("Creating account for %s" % email)
  # Add the user
  success = adobe_tools.add_user(email, firstname, lastname, country)
  if not success:
    log("Failed to create account for %s" % email)
    sys.exit(1)

# Does the user already have the product?
log("Checking to see if %s already has %s" % (email, target_product))
already_have = adobe_tools.does_user_have_product(email, target_product)
if already_have:
  log("User %s already has product %s" % (email, target_product))
  sys.exit(0)

# Add desired product
示例#4
0
def log(message):
  """Log with tag."""
  tag = 'CPE-check_adobe'
  print (tag + ': %s' % str(message))


if email is None or email == '':
    # No user, could likely be root
    print("No email found for %s" % me.username)
    exit(0)

# Do I exist as a user?
user_exists = False
try:
    user_exists = adobe_tools.user_exists(email)
except Exception as e:
    log("EXCEPTION: %s" % e)
    # If any exceptions are generated, should assume not entitled
    exit(0)

if not user_exists:
    # User has no account, so obviously this isn't entitled
    log("User %s does not have an existing account." % email)
    exit(0)

# Does the user already have the product?
log("Checking to see if %s already has %s" % (email, target_product))
already_have = False
try:
    already_have = adobe_tools.does_user_have_product(target_product, email)
示例#5
0
def log(message):
    """Log with tag."""
    tag = 'CPE-check_adobe'
    print(tag + ': %s' % str(message))


if email is None or email == '':
    # No user, could likely be root
    print("No email found for %s" % me.username)
    exit(0)

# Do I exist as a user?
user_exists = False
try:
    user_exists = adobe_tools.user_exists(email)
except Exception as e:
    log("EXCEPTION: %s" % e)
    # If any exceptions are generated, should assume not entitled
    exit(0)

if not user_exists:
    # User has no account, so obviously this isn't entitled
    log("User %s does not have an existing account." % email)
    exit(0)

# Does the user already have the product?
log("Checking to see if %s already has %s" % (email, target_product))
already_have = False
try:
    already_have = adobe_tools.does_user_have_product(target_product, email)