Skip to content

Commit

Permalink
Merge branch 'pu/ps/sentry/9828' into '2024.11'
Browse files Browse the repository at this point in the history
tweak(Admin/Frontend/Cli): improve error/return handling of createJwtAccessRoute

See merge request tine20/tine20!4752
  • Loading branch information
pschuele committed Jan 15, 2024
2 parents 241bb2a + b2dbbc1 commit a17c158
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tine20/Admin/Frontend/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,21 @@ class Admin_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
),
);

public function createJwtAccessRoute(Zend_Console_Getopt $_opts)
public function createJwtAccessRoute(Zend_Console_Getopt $_opts): int
{
$this->_checkAdminRight();

$args = $this->_parseArgs($_opts, ['account', 'route']);

$accountId = Tinebase_User::getInstance()->getFullUserByLoginName($args['account'])->getId();
try {
$accountId = Tinebase_User::getInstance()->getFullUserByLoginName($args['account'])->getId();
} catch (Tinebase_Exception_NotFound $tenf) {
echo $tenf->getMessage() . "\n";
return 1;
}
$route = (array)$args['route'];

//create new private and public key
// create new private and public key
$new_key_pair = openssl_pkey_new(array(
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
Expand All @@ -76,6 +81,8 @@ public function createJwtAccessRoute(Zend_Console_Getopt $_opts)
Admin_Controller_JWTAccessRoutes::getInstance()->create($jwtAccessRoute);

echo PHP_EOL . $token . PHP_EOL;

return 0;
}

/**
Expand Down

0 comments on commit a17c158

Please sign in to comment.