add descriptive wording

This commit is contained in:
wh1te909
2024-11-04 20:33:19 +00:00
parent ec5ef65911
commit 2690e9daef
4 changed files with 56 additions and 17 deletions

View File

@@ -13,7 +13,7 @@
<q-tab name="webhooks" label="Web Hooks" /> <q-tab name="webhooks" label="Web Hooks" />
<q-tab name="retention" label="Retention" /> <q-tab name="retention" label="Retention" />
<q-tab name="apikeys" label="API Keys" /> <q-tab name="apikeys" label="API Keys" />
<q-tab name="sso" label="SSO Integration" /> <q-tab name="sso" label="Single Sign-On" />
<!-- <q-tab name="openai" label="Open AI" /> --> <!-- <q-tab name="openai" label="Open AI" /> -->
</q-tabs> </q-tabs>
</template> </template>

View File

@@ -6,9 +6,9 @@ For details, see: https://license.tacticalrmm.com/ee
<template> <template>
<q-dialog ref="dialogRef" @hide="onDialogHide"> <q-dialog ref="dialogRef" @hide="onDialogHide">
<q-card class="q-dialog-plugin" style="width: 50"> <q-card class="q-dialog-plugin" style="width: 35vw; max-width: 35vw">
<q-bar> <q-bar>
{{ props.provider ? "Edit SSO Provider" : "Add SSO Provider" }} {{ props.provider ? "Edit OIDC Provider" : "Add OIDC Provider" }}
<q-space /> <q-space />
<q-btn dense flat icon="close" v-close-popup> <q-btn dense flat icon="close" v-close-popup>
<q-tooltip class="bg-white text-primary">Close</q-tooltip> <q-tooltip class="bg-white text-primary">Close</q-tooltip>
@@ -20,22 +20,29 @@ For details, see: https://license.tacticalrmm.com/ee
<q-input <q-input
:readonly="!!props.provider" :readonly="!!props.provider"
:disable="!!props.provider" :disable="!!props.provider"
label="Name" label="Provider Name"
outlined outlined
dense dense
v-model="localProvider.name" v-model="localProvider.name"
:rules="[(val) => !!val || '*Required']" :rules="[
(val) => !!val || '*Required',
(val) =>
/^[a-zA-Z0-9_-]+$/.test(val) ||
'Only letters, numbers, hyphens, and underscores are allowed',
]"
hint="A unique identifier for the SSO provider. Avoid spaces and special characters, as this will be part of the callback URL."
/> />
</q-card-section> </q-card-section>
<!-- url --> <!-- url -->
<q-card-section> <q-card-section>
<q-input <q-input
label="Server URL" label="Issuer URL"
outlined outlined
dense dense
v-model="localProvider.server_url" v-model="localProvider.server_url"
:rules="[(val) => !!val || '*Required']" :rules="[(val) => !!val || '*Required']"
hint="The OpenID Connect Issuer URL provided by the SSO provider. This is typically the base URL where the provider hosts their OIDC configuration."
/> />
</q-card-section> </q-card-section>
@@ -73,7 +80,7 @@ For details, see: https://license.tacticalrmm.com/ee
<q-card-section> <q-card-section>
<tactical-dropdown <tactical-dropdown
label="Default Role" label="Default User Role"
:options="roleOptions" :options="roleOptions"
outlined outlined
dense dense
@@ -81,7 +88,7 @@ For details, see: https://license.tacticalrmm.com/ee
mapOptions mapOptions
filled filled
v-model="localProvider.role" v-model="localProvider.role"
hint="The role to assign the user on first sign-in" hint="The role assigned to users upon first sign-in through this provider."
/> />
</q-card-section> </q-card-section>

View File

@@ -14,9 +14,14 @@ For details, see: https://license.tacticalrmm.com/ee
color="grey-5" color="grey-5"
icon="fas fa-plus" icon="fas fa-plus"
text-color="black" text-color="black"
label="Add SSO Provider" label="Add OIDC Provider"
@click="addSSOProvider" @click="addSSOProvider"
/> :disable="!ssoSettings.sso_enabled"
>
<q-tooltip v-if="!ssoSettings.sso_enabled" class="text-caption"
>Enable SSO in the settings to allow adding a provider.</q-tooltip
>
</q-btn>
</div> </div>
<q-separator /> <q-separator />
<q-table <q-table
@@ -29,7 +34,7 @@ For details, see: https://license.tacticalrmm.com/ee
hide-pagination hide-pagination
virtual-scroll virtual-scroll
:rows-per-page-options="[0]" :rows-per-page-options="[0]"
no-data-label="No SSO Providers added yet" no-data-label="No OIDC Providers added yet"
:loading="loading" :loading="loading"
> >
<template v-slot:top> <template v-slot:top>
@@ -127,7 +132,11 @@ For details, see: https://license.tacticalrmm.com/ee
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { QTableColumn, useQuasar, copyToClipboard } from "quasar"; import { QTableColumn, useQuasar, copyToClipboard } from "quasar";
import { fetchSSOProviders, removeSSOProvider } from "@/ee/sso/api/sso"; import {
fetchSSOProviders,
removeSSOProvider,
fetchSSOSettings,
} from "@/ee/sso/api/sso";
import { notifySuccess } from "@/utils/notify"; import { notifySuccess } from "@/utils/notify";
import { truncateText } from "@/utils/format"; import { truncateText } from "@/utils/format";
import { getBaseUrl } from "@/boot/axios"; import { getBaseUrl } from "@/boot/axios";
@@ -147,6 +156,7 @@ const store = useStore();
const loading = ref(false); const loading = ref(false);
const providers = ref([] as SSOProvider[]); const providers = ref([] as SSOProvider[]);
const ssoSettings = ref({} as SSOSettingsType);
const columns: QTableColumn[] = [ const columns: QTableColumn[] = [
{ {
@@ -178,6 +188,14 @@ const columns: QTableColumn[] = [
}, },
]; ];
async function getSSOSettings() {
try {
ssoSettings.value = await fetchSSOSettings();
} catch (e) {
console.error(e);
}
}
async function getSSOProviders() { async function getSSOProviders() {
loading.value = true; loading.value = true;
try { try {
@@ -232,12 +250,17 @@ function getCallbackURL(provider: SSOProvider) {
function openSSOSettings() { function openSSOSettings() {
$q.dialog({ $q.dialog({
component: SSOSettings, component: SSOSettings,
}).onOk((ssoSettings: SSOSettingsType) => { }).onOk((updatedSSOSettings: SSOSettingsType) => {
store.commit("setBlockLocalUserLogon", ssoSettings.block_local_user_logon); store.commit(
"setBlockLocalUserLogon",
updatedSSOSettings.block_local_user_logon,
);
ssoSettings.value = { ...updatedSSOSettings };
}); });
} }
onMounted(async () => { onMounted(async () => {
await getSSOSettings();
await getSSOProviders(); await getSSOProviders();
}); });
</script> </script>

View File

@@ -28,10 +28,16 @@ For details, see: https://license.tacticalrmm.com/ee
<q-card-section> <q-card-section>
<q-checkbox <q-checkbox
dense dense
label="Block Local Logon" label="Block Local User Login"
v-model="ssoSettings.block_local_user_logon" v-model="ssoSettings.block_local_user_logon"
:disable="!ssoSettings.sso_enabled" :disable="!ssoSettings.sso_enabled"
/> hint="When enabled, only users with SSO accounts can log in, with the exception of local superuser accounts."
>
<q-tooltip class="text-caption"
>When enabled, only users with SSO accounts can log in, with the
exception of local superuser accounts.</q-tooltip
>
</q-checkbox>
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
@@ -52,7 +58,7 @@ For details, see: https://license.tacticalrmm.com/ee
// composition imports // composition imports
import { ref, watch, onMounted } from "vue"; import { ref, watch, onMounted } from "vue";
import { useDialogPluginComponent } from "quasar"; import { useDialogPluginComponent } from "quasar";
import { notifySuccess } from "@/utils/notify"; import { notifySuccess, notifyWarning } from "@/utils/notify";
import { fetchSSOSettings, updateSSOSettings } from "@/ee/sso/api/sso"; import { fetchSSOSettings, updateSSOSettings } from "@/ee/sso/api/sso";
// types // types
@@ -83,6 +89,9 @@ async function submit() {
notifySuccess("Settings updated successfully"); notifySuccess("Settings updated successfully");
onDialogOK(ssoSettings.value); onDialogOK(ssoSettings.value);
} catch (e) { } catch (e) {
if (e.status === 423) {
notifyWarning(e.response.data, 7000);
}
console.error(e); console.error(e);
} }
loading.value = false; loading.value = false;