Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorAsanaAuthProvider.php
| Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | public function getDoorkeeperURIRef(PhutilURI $uri) { | ||||
| $uri_string = phutil_string_cast($uri); | $uri_string = phutil_string_cast($uri); | ||||
| $pattern = '(https://app\\.asana\\.com/0/(\\d+)/(\\d+))'; | $pattern = '(https://app\\.asana\\.com/0/(\\d+)/(\\d+))'; | ||||
| $matches = null; | $matches = null; | ||||
| if (!preg_match($pattern, $uri_string, $matches)) { | if (!preg_match($pattern, $uri_string, $matches)) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| if (strlen($uri->getFragment())) { | |||||
| return null; | |||||
| } | |||||
| if ($uri->getQueryParamsAsPairList()) { | |||||
| return null; | |||||
| } | |||||
| $context_id = $matches[1]; | $context_id = $matches[1]; | ||||
| $task_id = $matches[2]; | $task_id = $matches[2]; | ||||
| return id(new DoorkeeperURIRef()) | return id(new DoorkeeperURIRef()) | ||||
| ->setURI($uri) | ->setURI($uri) | ||||
| ->setApplicationType(DoorkeeperBridgeAsana::APPTYPE_ASANA) | ->setApplicationType(DoorkeeperBridgeAsana::APPTYPE_ASANA) | ||||
| ->setApplicationDomain(DoorkeeperBridgeAsana::APPDOMAIN_ASANA) | ->setApplicationDomain(DoorkeeperBridgeAsana::APPDOMAIN_ASANA) | ||||
| ->setObjectType(DoorkeeperBridgeAsana::OBJTYPE_TASK) | ->setObjectType(DoorkeeperBridgeAsana::OBJTYPE_TASK) | ||||
| ->setObjectID($task_id); | ->setObjectID($task_id); | ||||
| } | } | ||||
| } | } | ||||