glance-project/preg-service

基于CERN (P)re (REG)istration API的抽象层

v2.0.1 2024-07-19 08:42 UTC

This package is auto-updated.

Last update: 2024-08-29 08:03:31 UTC


README

这是PREG(预注册)API之上的抽象层。

入门指南

要使用此库,您需要在应用门户上注册一个应用程序。如果您不知道这意味着什么,请参阅CERN授权服务文档。确保已注册的应用程序具有OIDC SSO注册。该应用程序需要添加到‘grappa’组fence-api-read_{experiment}中,其中experiment是alice、atlas、cms或lhcb。

您的应用程序注册后,您将使用客户端ID客户端密钥

官方PREG API文档可以在以下URL找到

用法

使用应用程序凭据创建PREG提供者。

// Example of $inProduction. Adapt for your needs!

$preRegistrationProvider = PreRegistrationProvider::createWithAppCredentials(
    $clientId       = getenv("CLIENT_ID"),
    $clientName     = getenv("CLIENT_SECRET"),
    $experimentName = "lhcb",
    $inProduction   = getenv("ENVIRONMENT") === "PRODUCTION",
);

PreRegistrationProvider::getPreRegistrations()

获取实验的预注册。

$registrations = $preRegistrationProvider->getPreRegistrations();

echo($registrations[0]->personId());
echo($registrations[0]->documentId());

// Output:
// 123456
// 1234567

模式

预注册模式和其可用选项如下

personId                    => int
documentId                  => int
participationExperiment     => string (example: LHCb)
personNatureOfEmployment    => string ([ ADMINISTRATION, ENGINEERING, PHYSICS, SUMMERSTUDENT, TECHNICAL, OTHER ])
personEducationLevel        => string ([ BSCUNDERGRADUATE, MSCDIPLOMA, OTHER, PHD ])
personStudyingStatus        => string ([ CONCLUDED, STUDYING ])
personSeniorStatus          => ?string ([ SENIOR, NOTSENIOR, NULL]) ## this is an optional field, meaning that NULL does not indicate if the person is a senior or not.