Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bumped js libs, added NC-31 support #71

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
php-versions: [ '8.1', '8.2', '8.3' ]

name: php-lint

Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and notifications about recent activity related to your assigned issues.]]></des
<bugs>https://github.com/nextcloud/integration_jira/issues</bugs>
<screenshot>https://raw.githubusercontent.com/nextcloud/integration_jira/main/img/screenshot1.jpg</screenshot>
<dependencies>
<nextcloud min-version="28" max-version="30"/>
<nextcloud min-version="28" max-version="31"/>
</dependencies>
<background-jobs>
<job>OCA\Jira\BackgroundJob\CheckOpenTickets</job>
Expand Down
18 changes: 11 additions & 7 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
use OCA\Jira\AppInfo\Application;
use OCA\Jira\Service\NetworkService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\IConfig;
use OCP\IL10N;

use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\PreConditionNotMetException;

class ConfigController extends Controller {

Expand All @@ -47,12 +50,11 @@ public function __construct(string $appName,
}

/**
* set config values
* @NoAdminRequired
*
* @param array $values
* @return DataResponse
* @throws PreConditionNotMetException
*/
#[NoAdminRequired]
public function setConfig(array $values): DataResponse {
foreach ($values as $key => $value) {
$this->config->setUserValue($this->userId, Application::APP_ID, $key, $value);
Expand Down Expand Up @@ -92,12 +94,13 @@ public function setAdminConfig(array $values): DataResponse {
}

/**
* @NoAdminRequired
* @param string $url
* @param string $login
* @param string $password
* @return DataResponse
* @throws PreConditionNotMetException
*/
#[NoAdminRequired]
public function connectToSoftware(string $url, string $login, string $password): DataResponse {
$forcedInstanceUrl = $this->config->getAppValue(Application::APP_ID, 'forced_instance_url');
$targetInstanceUrl = ($forcedInstanceUrl === '')
Expand All @@ -109,7 +112,7 @@ public function connectToSoftware(string $url, string $login, string $password):
$info = $this->networkService->basicRequest($targetInstanceUrl, $basicAuthHeader, 'rest/api/2/myself');
if (isset($info['displayName'])) {
$this->config->setUserValue($this->userId, Application::APP_ID, 'user_name', $info['displayName']);
// in self hosted version, key is the only account identifier
// in self-hosted version, key is the only account identifier
$this->config->setUserValue($this->userId, Application::APP_ID, 'user_key', strval($info['key']));
$this->config->setUserValue($this->userId, Application::APP_ID, 'url', $targetInstanceUrl);
$this->config->setUserValue($this->userId, Application::APP_ID, 'basic_auth_header', $basicAuthHeader);
Expand All @@ -121,13 +124,14 @@ public function connectToSoftware(string $url, string $login, string $password):

/**
* receive oauth code and get oauth access token
* @NoAdminRequired
* @NoCSRFRequired
*
* @param string $code
* @param string $state
* @return RedirectResponse
* @throws PreConditionNotMetException
*/
#[NoAdminRequired]
#[NoCSRFRequired]
public function oauthRedirect(string $code = '', string $state = ''): RedirectResponse {
$configState = $this->config->getUserValue($this->userId, Application::APP_ID, 'oauth_state');
$clientID = $this->config->getAppValue(Application::APP_ID, 'client_id');
Expand Down
Loading
Loading