Class CeitecCrmConnector

java.lang.Object
cz.metacentrum.perun.core.impl.modules.CeitecCrmConnector

public class CeitecCrmConnector extends Object
Connector class used to call CEITEC CRM API. It supports check for users existence and retrieval of existing or newly generated login and CN to be later set to a proper attributes.
Author:
Pavel Zlámal invalid input: '<'zlamal@cesnet.cz>
  • Constructor Details

    • CeitecCrmConnector

      public CeitecCrmConnector()
  • Method Details

    • checkCrmUserExists

      public boolean checkCrmUserExists(String ceitecId, List<String> eppns)
      Check whether user with specified ceitecID or EPPNs exists in CRM. If ceitecId is provided, EPPNs are ignored by the backend.
      Parameters:
      ceitecId - ID to check
      eppns - List of all users' EPPNs to check
      Returns:
      TRUE when CRM API response is 200, FALSE when 404, throws exception otherwise
    • getLogin

      public String getLogin(String ceitecId, List<String> eppns)
      Reads CEITEC "login" from user entry in CRM. "CEITEC\" prefix is dropped. Returns existing login if user is matched or NULL if not found.
      Parameters:
      ceitecId - CEITEC ID
      eppns - List of all users' EPPNs
      Returns:
      Existing login to be set to u:d:login-namespace:ceitec or NULL
    • getCn

      public String getCn(String ceitecId, List<String> eppns)
      Reads CN (common name) attribute from user entry in CRM. Returns existing CN if user is matched or NULL if not found.
      Parameters:
      ceitecId - CEITEC ID
      eppns - List of all users' EPPNs
      Returns:
      Existing CN to be set to u:d:cnCeitecAD or NULL
    • checkAttributeExist

      public boolean checkAttributeExist(String attributeName, String attributeValue)
      Check whether there is an existing User in CRM by unique attribute like "new_ceitec_login" or "ce_cn_ceitec_ad".
      Parameters:
      attributeName - Name of attribute to check
      attributeValue - Value of attribute to check
      Returns:
      TRUE when CRM API respond with non-empty list of users, false when no user with matching unique ID is found, throws exception otherwise.
    • isMigrationRunning

      public boolean isMigrationRunning()
      Reads configuration from /etc/perun/modules/Ceitec.yaml and returns TRUE if migration of CEITEC users is currently running.
      Returns:
      TRUE if migration is running, FALSE otherwise.