Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannu Pölönen committed Jul 21, 2016
1 parent 8bc0293 commit e08b4fd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/classes/NostoAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,22 @@ public function getTokens()
* @inheritdoc
*/
public function isConnectedToNosto()
{
if (empty($this->tokens)) {
return false;
}
foreach (NostoApiToken::getMandatoryApiTokenNames() as $name) {
if ($this->getApiToken($name) === null) {
return false;
}
}
return true;
}

/**
* @inheritdoc
*/
public function hasMissingTokens()
{
if (empty($this->tokens)) {
return false;
Expand Down
13 changes: 13 additions & 0 deletions src/classes/api/NostoApiToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ public static function getApiTokenNames()
return self::$tokenNames;
}

/**
* Returns mandatory API token names.
*
* @return array the token names.
*/
public static function getMandatoryApiTokenNames()
{
return array(
self::API_SSO,
self::API_PRODUCTS
);
}

/**
* Returns the token name.
*
Expand Down

0 comments on commit e08b4fd

Please sign in to comment.