Ejemplo n.º 1
0
def get_project_members(project):
    users = []
    # try get members from keycloak
    keycloak_client = KeycloakClient()
    for username in keycloak_client.get_project_members(
            get_charge_code(project)):
        try:
            user = get_user_model().objects.get(username=username)
            users.append(user)
        except get_user_model().DoesNotExist:
            logger.exception(f"Could not get user model for {username}")
    return users
Ejemplo n.º 2
0
 def get_project_members(self, tas_project):
     users = []
     # try get members from keycloak
     keycloak_client = KeycloakClient()
     pi_username = tas_project.pi.username
     for username in keycloak_client.get_project_members(
             tas_project.chargeCode):
         if username == pi_username:
             role = "PI"
         else:
             role = "Standard"
         user = self.get_user(username, to_pytas_model=True, role=role)
         if user:
             users.append(user)
     return users