diff --git a/src/api/accounts.js b/src/api/accounts.js
index dcb4b3b..1dc01fc 100644
--- a/src/api/accounts.js
+++ b/src/api/accounts.js
@@ -2,9 +2,34 @@ import axios from "axios"
const baseUrl = "/accounts"
+// user api functions
export async function fetchUsers(params = {}) {
try {
const { data } = await axios.get(`${baseUrl}/users/`, { params: params })
return data
} catch (e) { }
-}
\ No newline at end of file
+}
+
+
+// api key api functions
+export async function fetchAPIKeys(params = {}) {
+ try {
+ const { data } = await axios.get(`${baseUrl}/apikeys/`, { params: params })
+ return data
+ } catch (e) { }
+}
+
+export async function saveAPIKey(payload) {
+ const { data } = await axios.post(`${baseUrl}/apikeys/`, payload)
+ return data
+}
+
+export async function editAPIKey(payload) {
+ const { data } = await axios.put(`${baseUrl}/apikeys/${payload.id}/`, payload)
+ return data
+}
+
+export async function removeAPIKey(id) {
+ const { data } = await axios.delete(`${baseUrl}/apikeys/${id}/`)
+ return data
+}
diff --git a/src/components/core/APIKeysForm.vue b/src/components/core/APIKeysForm.vue
new file mode 100644
index 0000000..90cc8e9
--- /dev/null
+++ b/src/components/core/APIKeysForm.vue
@@ -0,0 +1,122 @@
+
+
+
+
+ {{ title }}
+
+
+ Close
+
+
+
+
+ API Key will be generated on save
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/core/APIKeysTable.vue b/src/components/core/APIKeysTable.vue
new file mode 100644
index 0000000..87a356f
--- /dev/null
+++ b/src/components/core/APIKeysTable.vue
@@ -0,0 +1,212 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Edit
+
+
+
+
+
+ Delete
+
+
+
+
+
+ Close
+
+
+
+
+
+ {{ props.row.name }}
+
+
+ {{ props.row.user }}
+
+
+
+ {{ props.row.expiration }}
+
+
+
+ {{ props.row.created_time }}
+
+
+
+ Copy API Key to clipboard
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/modals/admin/RolesForm.vue b/src/components/modals/admin/RolesForm.vue
index 8455a35..5f3a9b4 100644
--- a/src/components/modals/admin/RolesForm.vue
+++ b/src/components/modals/admin/RolesForm.vue
@@ -56,6 +56,7 @@
+
@@ -180,6 +181,7 @@ export default {
can_manage_notes: false,
can_view_core_settings: false,
can_edit_core_settings: false,
+ can_manage_api_keys: false,
can_do_server_maint: false,
can_code_sign: false,
can_manage_checks: false,
diff --git a/src/components/modals/admin/UserForm.vue b/src/components/modals/admin/UserForm.vue
index d06a2b2..091e467 100644
--- a/src/components/modals/admin/UserForm.vue
+++ b/src/components/modals/admin/UserForm.vue
@@ -68,7 +68,7 @@
Active:
-
+
@@ -88,6 +88,14 @@
class="col-10"
/>
+
+
+
@@ -109,6 +117,7 @@ export default {
return {
localUser: {
is_active: true,
+ deny_dashboard_login: false,
},
roles: [],
isPwd: true,
@@ -146,6 +155,7 @@ export default {
// dont allow updating is_active if username is same as logged in user
if (this.localUser.username === this.logged_in_user) {
delete this.localUser.is_active;
+ delete this.localUser.deny_dashboard_login;
}
this.$axios
diff --git a/src/components/modals/coresettings/EditCoreSettings.vue b/src/components/modals/coresettings/EditCoreSettings.vue
index 41dcde7..0781b06 100644
--- a/src/components/modals/coresettings/EditCoreSettings.vue
+++ b/src/components/modals/coresettings/EditCoreSettings.vue
@@ -11,6 +11,7 @@
+
@@ -384,6 +385,10 @@
/>
+
+
+
+
@@ -422,6 +427,7 @@ import ResetPatchPolicy from "@/components/modals/coresettings/ResetPatchPolicy"
import CustomFields from "@/components/modals/coresettings/CustomFields";
import KeyStoreTable from "@/components/modals/coresettings/KeyStoreTable";
import URLActionsTable from "@/components/modals/coresettings/URLActionsTable";
+import APIKeysTable from "@/components/core/APIKeysTable";
export default {
name: "EditCoreSettings",
@@ -430,6 +436,7 @@ export default {
CustomFields,
KeyStoreTable,
URLActionsTable,
+ APIKeysTable,
},
mixins: [mixins],
data() {
diff --git a/src/composables/accounts.js b/src/composables/accounts.js
index b340c82..3767c58 100644
--- a/src/composables/accounts.js
+++ b/src/composables/accounts.js
@@ -1,9 +1,9 @@
-import { ref } from "vue"
+import { ref, onMounted } from "vue"
import { fetchUsers } from "@/api/accounts"
import { formatUserOptions } from "@/utils/format"
-export function useUserDropdown() {
+export function useUserDropdown(onMount = false) {
const userOptions = ref([])
const userDropdownLoading = ref(false)
@@ -32,6 +32,10 @@ export function useUserDropdown() {
})
}
+ if (onMount) {
+ onMounted(getUserOptions())
+ }
+
return {
//data
userOptions,