def _check_entitlements_array()

in tools/plisttool/plisttool.py [0:0]


  def _check_entitlements_array(self,
                                entitlements,
                                profile_entitlements,
                                key_name,
                                target,
                                supports_wildcards=False,
                                allow_wildcards_in_entitlements=False):
    """Checks if the requested entitlements against the profile for a key

    Args:
      entitlements: The entitlements.
      profile_entitlements: The provisioning profiles entitlements (from the
          profile metadata).
      key_name: The key to check.
      target: The target to include in errors.
      supports_wildcards: True/False for if wildcards should be supported
          value from the profile_entitlements. This also means the entries
          are reverse DNS style.
    Raises:
      PlistToolError: For any issues found.
    """
    src_grps = entitlements.get(key_name)
    if not src_grps:
      return

    if not profile_entitlements:
      return  # Allow no profile_entitlements just for the plisttool_unittests.

    profile_grps = profile_entitlements.get(key_name)
    if not profile_grps:
      self._report(
          ENTITLEMENTS_HAS_GROUP_PROFILE_DOES_NOT % (target, key_name))
      return

    for src_grp in src_grps:
      if '*' in src_grp and not allow_wildcards_in_entitlements:
        self._report(
            ENTITLEMENTS_VALUE_HAS_WILDCARD % (target, key_name, src_grp))

      if not self._does_id_match_list(src_grp, profile_grps,
          allowed_supports_wildcards=supports_wildcards):
        self._report(
            ENTITLEMENTS_HAS_GROUP_ENTRY_PROFILE_DOES_NOT % (
              target, key_name, src_grp, '", "'.join(profile_grps)))