diff --git a/src/composables/accounts.js b/src/composables/accounts.js index 8c4a1fb3..210eb072 100644 --- a/src/composables/accounts.js +++ b/src/composables/accounts.js @@ -1,5 +1,5 @@ import { ref, onMounted } from "vue"; -import { fetchUsers } from "@/api/accounts"; +import { fetchUsers, fetchRoles } from "@/api/accounts"; import { formatUserOptions } from "@/utils/format"; export function useUserDropdown(onMount = false) { @@ -44,3 +44,27 @@ export function useUserDropdown(onMount = false) { getDynamicUserOptions, }; } + +export function useRoleDropdown(opts = {}) { + const roleOptions = ref([]); + async function getRoleOptions() { + const roles = await fetchRoles(); + console.log(roles); + roleOptions.value = roles.map((role) => ({ + value: role.id, + label: role.name, + })); + } + + if (opts.onMount) { + onMounted(getRoleOptions); + } + + return { + //data + roleOptions, + + //methods + getRoleOptions, + }; +} diff --git a/src/ee/sso/api/sso.ts b/src/ee/sso/api/sso.ts index 0531232d..6cdd5842 100644 --- a/src/ee/sso/api/sso.ts +++ b/src/ee/sso/api/sso.ts @@ -36,7 +36,7 @@ function postForm(url: string, data: FormData) { // sso providers -export async function fetchSSOProviders(): Promise { +export async function fetchSSOProviders(): Promise { const { data } = await axios.get(`${baseUrl}/ssoproviders/`); return data; } @@ -66,7 +66,6 @@ export async function fetchSSOSettings(): Promise { } export async function updateSSOSettings(settings: SSOSettings) { - console.log(settings); const { data } = await axios.post( `${baseUrl}/ssoproviders/settings/`, settings, diff --git a/src/ee/sso/components/SSOProvidersForm.vue b/src/ee/sso/components/SSOProvidersForm.vue index 3f77b710..9a0e77fa 100644 --- a/src/ee/sso/components/SSOProvidersForm.vue +++ b/src/ee/sso/components/SSOProvidersForm.vue @@ -60,6 +60,19 @@ For details, see: https://license.tacticalrmm.com/ee /> + + + + diff --git a/src/ee/sso/types/sso.ts b/src/ee/sso/types/sso.ts index 0e5fe102..d76c8289 100644 --- a/src/ee/sso/types/sso.ts +++ b/src/ee/sso/types/sso.ts @@ -12,6 +12,7 @@ export interface SSOProvider { client_id: string; secret: string; server_url: string; + role: number | null; } export interface SSOAccount {