Ejemplo n.º 1
0
 /**
  * Returns all scope names which are valid for the app and the user. The
  * scopes are a comma seperated list. All scopes which are listed in the
  * $exclude array are excluded
  *
  * @param integer $appId
  * @param integer $userId
  * @param string $scopes
  * @param array $exclude
  * @return array
  */
 public function getValidScopes($appId, $userId, $scopes, array $exclude = array())
 {
     $scopes = explode(',', $scopes);
     $scopes = $this->appScopeTable->getValidScopes($appId, $scopes, $exclude);
     $scopes = $this->userScopeTable->getValidScopes($userId, $scopes, $exclude);
     return $scopes;
 }
Ejemplo n.º 2
0
 public function insertScopes($appId, $scopes)
 {
     if (!empty($scopes) && is_array($scopes)) {
         $scopes = $this->scopeTable->getByNames($scopes);
         foreach ($scopes as $scope) {
             $this->appScopeTable->create(array('appId' => $appId, 'scopeId' => $scope['id']));
         }
     }
 }