Пример #1
0
 /**
  * Creates a new scope
  *
  * @param string $scope
  *
  * @param string $description
  *
  * @return Scope
  */
 public function createScope($scope, $description = null)
 {
     $scopeObject = new \OAuth2\ServerBundle\Entity\Scope();
     $scopeObject->setScope($scope);
     $scopeObject->setDescription($description);
     // Store Scope
     $this->em->persist($scopeObject);
     $this->em->flush();
     return $scopeObject;
 }
Пример #2
0
 public function setScopes($scopes)
 {
     if (!is_array($scopes)) {
         $scopes = explode(' ', $scopes);
     }
     $this->scopes = array();
     foreach ($scopes as $scope) {
         $scopeObj = new \OAuth2\ServerBundle\Entity\Scope();
         $scopeObj->setScope($scope);
         $scopeObj->setDescription($scope);
         $this->scopes[$scope] = $scopeObj;
     }
 }