diff --git a/client/src/components/common/AdministrationModal/UsersPane/ActionsStep.jsx b/client/src/components/common/AdministrationModal/UsersPane/ActionsStep.jsx
index 2b9732e2..862e451e 100644
--- a/client/src/components/common/AdministrationModal/UsersPane/ActionsStep.jsx
+++ b/client/src/components/common/AdministrationModal/UsersPane/ActionsStep.jsx
@@ -30,6 +30,7 @@ const StepTypes = {
EDIT_PASSWORD: 'EDIT_PASSWORD',
EDIT_ROLE: 'EDIT_ROLE',
API_KEY: 'API_KEY',
+ UNLINK_SSO: 'UNLINK_SSO',
ACTIVATE: 'ACTIVATE',
DEACTIVATE: 'DEACTIVATE',
DELETE: 'DELETE',
@@ -58,6 +59,16 @@ const ActionsStep = React.memo(({ userId, onClose }) => {
[userId, dispatch],
);
+ const handleUnlinkSsoConfirm = useCallback(() => {
+ dispatch(
+ entryActions.updateUser(userId, {
+ isSsoUser: false,
+ }),
+ );
+
+ onClose();
+ }, [userId, onClose, dispatch]);
+
const handleActivateConfirm = useCallback(() => {
dispatch(
entryActions.updateUser(userId, {
@@ -106,6 +117,10 @@ const ActionsStep = React.memo(({ userId, onClose }) => {
openStep(StepTypes.API_KEY);
}, [openStep]);
+ const handleUnlinkSsoClick = useCallback(() => {
+ openStep(StepTypes.UNLINK_SSO);
+ }, [openStep]);
+
const handleActivateClick = useCallback(() => {
openStep(StepTypes.ACTIVATE);
}, [openStep]);
@@ -142,6 +157,17 @@ const ActionsStep = React.memo(({ userId, onClose }) => {
);
case StepTypes.API_KEY:
return ;
+ case StepTypes.UNLINK_SSO:
+ return (
+
+ );
case StepTypes.ACTIVATE:
return (
{
context: 'title',
})}
+ {user.isSsoUser && !isCurrentUser && (
+
+
+ {t('action.unlinkSso', {
+ context: 'title',
+ })}
+
+ )}
{!isCurrentUser && (
<>
{
sails.log.info('Initializing OIDC client');
let issuer;
@@ -38,6 +50,8 @@ module.exports = function defineOidcHook(sails) {
issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
} catch (error) {
sails.log.warn(`Error while initializing OIDC client: ${error}`);
+
+ clientInitPromise = null;
return null;
}
@@ -54,9 +68,10 @@ module.exports = function defineOidcHook(sails) {
}
client = new issuer.Client(metadata);
- }
+ return client;
+ })();
- return client;
+ return clientInitPromise;
},
async getBootstrap() {
@@ -84,9 +99,5 @@ module.exports = function defineOidcHook(sails) {
isEnabled() {
return !!sails.config.custom.oidcIssuer;
},
-
- isActive() {
- return client !== null;
- },
};
};
diff --git a/server/utils/validators.js b/server/utils/validators.js
index 695b80a6..f586cc35 100644
--- a/server/utils/validators.js
+++ b/server/utils/validators.js
@@ -13,6 +13,8 @@ const ID_REGEX = /^[1-9][0-9]*$/;
const IDS_WITH_COMMA_REGEX = /^[1-9][0-9]*(,[1-9][0-9]*)*$/;
const USERNAME_REGEX = /^[a-zA-Z0-9]+((_|\.)?[a-zA-Z0-9])*$/;
+const is = (defaultValue) => (value) => value === defaultValue;
+
const isUrl = (value) =>
validator.isURL(value, {
protocols: ['http', 'https'],
@@ -61,6 +63,7 @@ module.exports = {
IDS_WITH_COMMA_REGEX,
USERNAME_REGEX,
+ is,
isUrl,
isIdInRange,
isIdsWithCommaInRange,