mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-10-29 14:54:36 +00:00
Feature/users dashboard (#150)
* Add user list into nav, add user form with basic functionality * add password check for temp password, add search filter * apply review comments * fix filters, apply review comments * fix button placement * handle SelfDelete * apply review comments * add conditional class * creating scoped users * apply review comments * apply review comments * apply review comments Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
1 parent
a9edbdbd26
commit
5af7471886
21 files changed
+655
-22
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
LimitField,
|
||||
PasswordSettings,
|
||||
SipGateway,
|
||||
SmppGateway,
|
||||
WebHook,
|
||||
@@ -102,6 +103,13 @@ export const PER_PAGE_SELECTION = [
|
||||
{ name: "100 / page", value: "100" },
|
||||
];
|
||||
|
||||
export const USER_SCOPE_SELECTION = [
|
||||
{ name: "All Scopes", value: "all" },
|
||||
{ name: "Admin", value: "admin" },
|
||||
{ name: "Service Provider", value: "service_provider" },
|
||||
{ name: "Account", value: "account" },
|
||||
];
|
||||
|
||||
/** Available webhook methods */
|
||||
export const WEBHOOK_METHODS: WebhookOption[] = [
|
||||
{
|
||||
@@ -131,6 +139,17 @@ export const LIMITS: LimitField[] = [
|
||||
// },
|
||||
];
|
||||
|
||||
export const DEFAULT_PSWD_SETTINGS: PasswordSettings = {
|
||||
min_password_length: 6,
|
||||
require_digit: 0,
|
||||
require_special_character: 0,
|
||||
};
|
||||
|
||||
/** User scope values values */
|
||||
export const USER_ADMIN = "admin";
|
||||
export const USER_SP = "service_provider";
|
||||
export const USER_ACCOUNT = "account";
|
||||
|
||||
/** Speech credential test result status values */
|
||||
export const CRED_OK = "ok";
|
||||
export const CRED_FAIL = "fail";
|
||||
|
||||
+6
-3
@@ -332,8 +332,8 @@ export const postPasswordSettings = (payload: Partial<PasswordSettings>) => {
|
||||
};
|
||||
/** Named wrappers for `putFetch` */
|
||||
|
||||
export const putUser = (sid: string, payload: UserUpdatePayload) => {
|
||||
return putFetch<EmptyResponse, UserUpdatePayload>(
|
||||
export const putUser = (sid: string, payload: Partial<UserUpdatePayload>) => {
|
||||
return putFetch<EmptyResponse, Partial<UserUpdatePayload>>(
|
||||
`${API_USERS}/${sid}`,
|
||||
payload
|
||||
);
|
||||
@@ -418,6 +418,10 @@ export const putSmppGateway = (sid: string, payload: Partial<SmppGateway>) => {
|
||||
|
||||
/** Named wrappers for `deleteFetch` */
|
||||
|
||||
export const deleteUser = (sid: string) => {
|
||||
return deleteFetch<EmptyResponse>(`${API_USERS}/${sid}`);
|
||||
};
|
||||
|
||||
export const deleteServiceProvider = (sid: string) => {
|
||||
return deleteFetch<EmptyResponse>(`${API_SERVICE_PROVIDERS}/${sid}`);
|
||||
};
|
||||
@@ -477,7 +481,6 @@ export const deleteAccountLimit = (sid: string, cat: LimitCategories) => {
|
||||
|
||||
/** Named wrappers for `getFetch` */
|
||||
|
||||
/** This is not a functioning API at the moment... */
|
||||
export const getUser = (sid: string) => {
|
||||
return getFetch<User>(`${API_USERS}/${sid}`);
|
||||
};
|
||||
|
||||
+22
-4
@@ -106,9 +106,16 @@ export interface PasswordSettings {
|
||||
/** API responses/payloads */
|
||||
|
||||
export interface User {
|
||||
scope: UserScopes;
|
||||
scope?: UserScopes;
|
||||
user_sid: string;
|
||||
permissions: UserPermissions[];
|
||||
name: string;
|
||||
email: string;
|
||||
is_active: boolean;
|
||||
force_change: boolean;
|
||||
account_sid?: string | null;
|
||||
service_provider_sid?: string | null;
|
||||
initial_password?: string;
|
||||
permissions?: UserPermissions;
|
||||
}
|
||||
|
||||
export interface UserLogin extends User {
|
||||
@@ -122,8 +129,15 @@ export interface UserLoginPayload {
|
||||
}
|
||||
|
||||
export interface UserUpdatePayload {
|
||||
old_password: string;
|
||||
new_password: string;
|
||||
old_password?: string;
|
||||
new_password?: string;
|
||||
initial_password: string | null;
|
||||
email: string;
|
||||
name: string;
|
||||
force_change: boolean;
|
||||
is_active: boolean;
|
||||
service_provider_sid: string | null;
|
||||
account_sid: string | null;
|
||||
}
|
||||
|
||||
export interface ServiceProvider {
|
||||
@@ -345,6 +359,10 @@ export interface SidResponse {
|
||||
sid: string;
|
||||
}
|
||||
|
||||
export interface UserSidResponse {
|
||||
user_sid: string;
|
||||
}
|
||||
|
||||
export interface TokenResponse extends SidResponse {
|
||||
token: string;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user