Skip to content

Commit

Permalink
make error
Browse files Browse the repository at this point in the history
Signed-off-by: nabim777 <[email protected]>
  • Loading branch information
nabim777 committed Feb 6, 2025
1 parent d6b1a87 commit 3cc84d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Service/OpenProjectAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
class OpenProjectAPIService {
public const AUTH_METHOD_OAUTH = 'oauth2';
public const AUTH_METHOD_OIDC = 'oidc';
public const MINIMUM_VERSION_OIDC = 'v6.2.0';
public const MIN_SUPPORTED_OIDC_APP_VERSION = 'v6.2.0';
/**
* @var string
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getForm(): TemplateResponse {
'user_oidc_info' => [
'user_oidc_enabled' => $this->openProjectAPIService->isUserOIDCAppInstalledAndEnabled(),
'user_oidc_supported' => $this->openProjectAPIService->isUserOIDCAppSupported(),
'minimum_version_Oidc' => OpenProjectAPIService::MINIMUM_VERSION_OIDC
'minimum_version_Oidc' => OpenProjectAPIService::MIN_SUPPORTED_OIDC_APP_VERSION
],
];

Expand Down
13 changes: 5 additions & 8 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{{ authMethodsLabel.OIDC }}
</NcCheckboxRadioSwitch>
<p v-if="!isOIDCAppInstalledAndEnabled" class="oidc-app-check-description" v-html="getOIDCAppNotInstalledHintText" /> <!-- eslint-disable-line vue/no-v-html -->
<p v-if="isOIDCAppInstalledAndEnabled && !isOIDCAppSupported" class="error" v-html="getOIDCAppNotSupported" /> <!-- eslint-disable-line vue/no-v-html -->
<ErrorLabel v-if="isOIDCAppInstalledAndEnabled && !isOIDCAppSupported" :error="errorMessages.oidcUnspported" />
</div>
</div>
<div v-else>
Expand Down Expand Up @@ -530,6 +530,8 @@ import SettingsTitle from '../components/settings/SettingsTitle.vue'
import { F_MODES, FORM, USER_SETTINGS, AUTH_METHOD, AUTH_METHOD_LABEL } from '../utils.js'
import TermsOfServiceUnsigned from './admin/TermsOfServiceUnsigned.vue'
import dompurify from 'dompurify'
import { error as errorMessages } from '../constants/messages.js'
import ErrorLabel from './ErrorLabel.vue'
export default {
name: 'AdminSettings',
components: {
Expand All @@ -548,6 +550,7 @@ export default {
NcCheckboxRadioSwitch,
TermsOfServiceUnsigned,
NcNoteCard,
ErrorLabel,
},
data() {
return {
Expand Down Expand Up @@ -614,6 +617,7 @@ export default {
currentTargetedAudienceClientIdSelected: null,
},
registeredOidcProviders: [],
errorMessages,
}
},
computed: {
Expand Down Expand Up @@ -766,10 +770,6 @@ export default {
const htmlLink = `<a class="link" href="${url}" target="_blank" title="${linkText}">${linkText}</a>`
return t('integration_openproject', 'Please install the {htmlLink} app to be able to use Keycloak for authorization with OpenProject.', { htmlLink }, null, { escape: false, sanitize: false })
},
getOIDCAppNotSupported() {
const version = this.getMinimumOidcversion
return t('integration_openproject', 'Not an unsupported userOIDC need to be minimum {version}', { version })
},
getConfigureOIDCHintText() {
const linkText = t('integration_openproject', 'User OIDC app')
const htmlLink = `<a class="link" href="" target="_blank" title="${linkText}">${linkText}</a>`
Expand Down Expand Up @@ -838,9 +838,6 @@ export default {
isOIDCAppSupported() {
return this.state.user_oidc_info.user_oidc_supported
},
getMinimumOidcversion() {
return this.state.user_oidc_info.minimum_version_Oidc
}
},
created() {
this.init()
Expand Down
4 changes: 3 additions & 1 deletion src/constants/messages.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { translate as t } from '@nextcloud/l10n'
import APP_ID from './appID.js'
import { loadState } from '@nextcloud/initial-state'
const state = loadState('integration_openproject', 'admin-config')

export const error = {
featureNotAvailable: t(APP_ID, 'This feature is not available for this user account'),
opConnectionUnauthorized: t(APP_ID, 'Unauthorized to connect to OpenProject'),
oidcUnspported: t(APP_ID, 'Oidc not supported'),
oidcUnspported: t(APP_ID, 'Oidc not supported so required OIDC ' + state.user_oidc_info.minimum_version_Oidc),
}

0 comments on commit 3cc84d0

Please sign in to comment.