[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/auth/controller/ -> PhabricatorAuthSSHKeyController.php (source)

   1  <?php
   2  
   3  abstract class PhabricatorAuthSSHKeyController
   4    extends PhabricatorAuthController {
   5  
   6    protected function newKeyForObjectPHID($object_phid) {
   7      $viewer = $this->getViewer();
   8  
   9      $object = id(new PhabricatorObjectQuery())
  10        ->setViewer($viewer)
  11        ->withPHIDs(array($object_phid))
  12        ->requireCapabilities(
  13          array(
  14            PhabricatorPolicyCapability::CAN_VIEW,
  15            PhabricatorPolicyCapability::CAN_EDIT,
  16          ))
  17        ->executeOne();
  18      if (!$object) {
  19        return null;
  20      }
  21  
  22      // If this kind of object can't have SSH keys, don't let the viewer
  23      // add them.
  24      if (!($object instanceof PhabricatorSSHPublicKeyInterface)) {
  25        return null;
  26      }
  27  
  28      return id(new PhabricatorAuthSSHKey())
  29        ->setObjectPHID($object_phid)
  30        ->attachObject($object);
  31    }
  32  
  33  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1