hazo_auth 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -5
- package/SETUP_CHECKLIST.md +1 -1
- package/cli-src/lib/app_logger.ts +8 -18
- package/cli-src/lib/auth/auth_types.ts +22 -0
- package/cli-src/lib/auth/hazo_get_auth.server.ts +25 -1
- package/cli-src/lib/auth/session_token_validator.edge.ts +4 -0
- package/cli-src/lib/config/default_config.ts +36 -0
- package/cli-src/lib/navbar_config.server.ts +129 -0
- package/cli-src/lib/scope_hierarchy_config.server.ts +3 -14
- package/cli-src/lib/services/registration_service.ts +12 -0
- package/cli-src/lib/services/scope_labels_service.ts +21 -21
- package/cli-src/lib/services/scope_service.ts +15 -11
- package/cli-src/lib/services/session_token_service.ts +4 -0
- package/cli-src/lib/ui_shell_config.server.ts +15 -0
- package/cli-src/lib/user_types_config.server.ts +178 -0
- package/cli-src/server/types/app_types.ts +5 -7
- package/dist/app/api/hazo_auth/me/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/me/route.js +17 -0
- package/dist/app/api/hazo_auth/org_management/orgs/route.d.ts +26 -0
- package/dist/app/api/hazo_auth/org_management/orgs/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/org_management/orgs/route.js +315 -0
- package/dist/app/api/hazo_auth/user_management/users/route.d.ts +7 -0
- package/dist/app/api/hazo_auth/user_management/users/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/user_management/users/route.js +48 -10
- package/dist/components/layouts/login/hooks/use_login_form.js +2 -2
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +8 -14
- package/dist/components/layouts/rbac_test/index.d.ts +1 -3
- package/dist/components/layouts/rbac_test/index.d.ts.map +1 -1
- package/dist/components/layouts/rbac_test/index.js +2 -2
- package/dist/components/layouts/shared/components/auth_navbar.d.ts +26 -0
- package/dist/components/layouts/shared/components/auth_navbar.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/auth_navbar.js +14 -0
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts +3 -1
- package/dist/components/layouts/shared/components/auth_page_shell.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/auth_page_shell.js +17 -2
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts +6 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +7 -2
- package/dist/components/layouts/shared/index.d.ts +2 -0
- package/dist/components/layouts/shared/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/index.js +1 -0
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts +3 -2
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +45 -18
- package/dist/components/layouts/user_management/components/scope_labels_tab.d.ts +3 -2
- package/dist/components/layouts/user_management/components/scope_labels_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/scope_labels_tab.js +48 -20
- package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_scopes_tab.js +1 -1
- package/dist/components/layouts/user_management/index.d.ts +11 -3
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +52 -5
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/user-type-badge.d.ts +23 -0
- package/dist/components/ui/user-type-badge.d.ts.map +1 -0
- package/dist/components/ui/user-type-badge.js +42 -0
- package/dist/lib/app_logger.d.ts +3 -9
- package/dist/lib/app_logger.d.ts.map +1 -1
- package/dist/lib/app_logger.js +7 -10
- package/dist/lib/auth/auth_types.d.ts +17 -0
- package/dist/lib/auth/auth_types.d.ts.map +1 -1
- package/dist/lib/auth/auth_types.js +11 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +21 -1
- package/dist/lib/config/default_config.d.ts +60 -0
- package/dist/lib/config/default_config.d.ts.map +1 -1
- package/dist/lib/config/default_config.js +34 -0
- package/dist/lib/navbar_config.server.d.ts +36 -0
- package/dist/lib/navbar_config.server.d.ts.map +1 -0
- package/dist/lib/navbar_config.server.js +45 -0
- package/dist/lib/scope_hierarchy_config.server.d.ts +3 -7
- package/dist/lib/scope_hierarchy_config.server.d.ts.map +1 -1
- package/dist/lib/scope_hierarchy_config.server.js +1 -10
- package/dist/lib/services/registration_service.d.ts.map +1 -1
- package/dist/lib/services/registration_service.js +8 -0
- package/dist/lib/services/scope_labels_service.d.ts +7 -7
- package/dist/lib/services/scope_labels_service.d.ts.map +1 -1
- package/dist/lib/services/scope_labels_service.js +20 -20
- package/dist/lib/services/scope_service.d.ts +8 -5
- package/dist/lib/services/scope_service.d.ts.map +1 -1
- package/dist/lib/services/scope_service.js +9 -8
- package/dist/lib/ui_shell_config.server.d.ts +5 -0
- package/dist/lib/ui_shell_config.server.d.ts.map +1 -1
- package/dist/lib/ui_shell_config.server.js +5 -0
- package/dist/lib/user_types_config.server.d.ts +56 -0
- package/dist/lib/user_types_config.server.d.ts.map +1 -0
- package/dist/lib/user_types_config.server.js +100 -0
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +3 -7
- package/dist/server/config/config_loader.js +2 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -3
- package/dist/server/routes/index.d.ts +1 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +2 -0
- package/dist/server/routes/org_management_orgs.d.ts +2 -0
- package/dist/server/routes/org_management_orgs.d.ts.map +1 -0
- package/dist/server/routes/org_management_orgs.js +2 -0
- package/dist/server/types/app_types.d.ts +3 -7
- package/dist/server/types/app_types.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.js +1 -3
- package/hazo_auth_config.example.ini +9 -0
- package/package.json +7 -1
- package/cli-src/server/logging/logger_service.ts +0 -56
- /package/public/profile_pictures/library/Cars/{050 - citroe/314/210n_c3.jpeg" → 050 - citro/303/253n_c3.jpeg"} +0 -0
- /package/public/profile_pictures/library/Cars/{064 - lamborghini_huraca/314/201n.jpeg" → 064 - lamborghini_hurac/303/241n.jpeg"} +0 -0
- /package/public/profile_pictures/library/Cars/{099 - citroe/314/210n_2cv_(classic).jpeg" → 099 - citro/303/253n_2cv_(classic).jpeg"} +0 -0
- /package/public/profile_pictures/library/Cars/{131 - lamborghini_huraca/314/201n_sto.jpeg" → 131 - lamborghini_hurac/303/241n_sto.jpeg"} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ScopeLevel } from "./services/scope_service";
|
|
2
2
|
/**
|
|
3
3
|
* Scope hierarchy configuration options for HRBAC
|
|
4
|
+
* Note: Scopes are now connected to organizations via org_id and root_org_id
|
|
5
|
+
* foreign keys referencing the hazo_org table.
|
|
4
6
|
*/
|
|
5
7
|
export type ScopeHierarchyConfig = {
|
|
6
8
|
/** Whether HRBAC is enabled (default: false) */
|
|
7
9
|
enable_hrbac: boolean;
|
|
8
|
-
/** Default organization for single-tenant apps (optional) */
|
|
9
|
-
default_org: string;
|
|
10
10
|
/** Cache TTL in minutes for scope lookups (default: 15) */
|
|
11
11
|
scope_cache_ttl_minutes: number;
|
|
12
12
|
/** Maximum entries in scope cache (default: 5000) */
|
|
@@ -19,6 +19,7 @@ export type ScopeHierarchyConfig = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Reads HRBAC scope hierarchy configuration from hazo_auth_config.ini file
|
|
21
21
|
* Falls back to defaults if config file is not found or section is missing
|
|
22
|
+
* Note: Scopes are now connected to organizations via org_id/root_org_id FK references
|
|
22
23
|
* @returns Scope hierarchy configuration options
|
|
23
24
|
*/
|
|
24
25
|
export declare function get_scope_hierarchy_config(): ScopeHierarchyConfig;
|
|
@@ -27,11 +28,6 @@ export declare function get_scope_hierarchy_config(): ScopeHierarchyConfig;
|
|
|
27
28
|
* Convenience function for quick checks
|
|
28
29
|
*/
|
|
29
30
|
export declare function is_hrbac_enabled(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Gets the default organization from config
|
|
32
|
-
* Returns empty string if not configured (multi-tenant mode)
|
|
33
|
-
*/
|
|
34
|
-
export declare function get_default_org(): string;
|
|
35
31
|
/**
|
|
36
32
|
* Gets the default label for a scope level
|
|
37
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope_hierarchy_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/scope_hierarchy_config.server.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAK3D
|
|
1
|
+
{"version":3,"file":"scope_hierarchy_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/scope_hierarchy_config.server.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAK3D;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,gDAAgD;IAChD,YAAY,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,uBAAuB,EAAE,MAAM,CAAC;IAChC,qDAAqD;IACrD,uBAAuB,EAAE,MAAM,CAAC;IAChC,4CAA4C;IAC5C,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;CAC5C,CAAC;AA0DF;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CA8BjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAG3D"}
|
|
@@ -49,13 +49,12 @@ function get_default_labels() {
|
|
|
49
49
|
/**
|
|
50
50
|
* Reads HRBAC scope hierarchy configuration from hazo_auth_config.ini file
|
|
51
51
|
* Falls back to defaults if config file is not found or section is missing
|
|
52
|
+
* Note: Scopes are now connected to organizations via org_id/root_org_id FK references
|
|
52
53
|
* @returns Scope hierarchy configuration options
|
|
53
54
|
*/
|
|
54
55
|
export function get_scope_hierarchy_config() {
|
|
55
56
|
// Core HRBAC enablement
|
|
56
57
|
const enable_hrbac = get_config_boolean(SECTION_NAME, "enable_hrbac", false);
|
|
57
|
-
// Default organization for single-tenant apps
|
|
58
|
-
const default_org = get_config_value(SECTION_NAME, "default_org", "");
|
|
59
58
|
// Cache settings
|
|
60
59
|
const scope_cache_ttl_minutes = get_config_number(SECTION_NAME, "scope_cache_ttl_minutes", 15);
|
|
61
60
|
const scope_cache_max_entries = get_config_number(SECTION_NAME, "scope_cache_max_entries", 5000);
|
|
@@ -66,7 +65,6 @@ export function get_scope_hierarchy_config() {
|
|
|
66
65
|
const default_labels = get_default_labels();
|
|
67
66
|
return {
|
|
68
67
|
enable_hrbac,
|
|
69
|
-
default_org,
|
|
70
68
|
scope_cache_ttl_minutes,
|
|
71
69
|
scope_cache_max_entries,
|
|
72
70
|
active_levels,
|
|
@@ -80,13 +78,6 @@ export function get_scope_hierarchy_config() {
|
|
|
80
78
|
export function is_hrbac_enabled() {
|
|
81
79
|
return get_config_boolean(SECTION_NAME, "enable_hrbac", false);
|
|
82
80
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Gets the default organization from config
|
|
85
|
-
* Returns empty string if not configured (multi-tenant mode)
|
|
86
|
-
*/
|
|
87
|
-
export function get_default_org() {
|
|
88
|
-
return get_config_value(SECTION_NAME, "default_org", "");
|
|
89
|
-
}
|
|
90
81
|
/**
|
|
91
82
|
* Gets the default label for a scope level
|
|
92
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/registration_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"registration_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/registration_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAkBvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAwJ7B"}
|
|
@@ -9,6 +9,7 @@ import { create_app_logger } from "../app_logger";
|
|
|
9
9
|
import { send_template_email } from "./email_service";
|
|
10
10
|
import { sanitize_error_for_user } from "../utils/error_sanitizer";
|
|
11
11
|
import { get_line_number } from "../utils/api_route_helpers";
|
|
12
|
+
import { is_user_types_enabled, get_default_user_type, } from "../user_types_config.server";
|
|
12
13
|
// section: helpers
|
|
13
14
|
/**
|
|
14
15
|
* Registers a new user in the database using hazo_connect
|
|
@@ -69,6 +70,13 @@ export async function register_user(adapter, data) {
|
|
|
69
70
|
insert_data.profile_source = map_ui_source_to_db(default_photo.profile_source);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
73
|
+
// Set default user type if feature is enabled and default is configured
|
|
74
|
+
if (is_user_types_enabled()) {
|
|
75
|
+
const default_type = get_default_user_type();
|
|
76
|
+
if (default_type) {
|
|
77
|
+
insert_data.user_type = default_type;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
72
80
|
const inserted_users = await users_service.insert(insert_data);
|
|
73
81
|
// Verify insertion was successful
|
|
74
82
|
if (!Array.isArray(inserted_users) || inserted_users.length === 0) {
|
|
@@ -2,7 +2,7 @@ import type { HazoConnectAdapter } from "hazo_connect";
|
|
|
2
2
|
import type { ScopeLevel } from "./scope_service";
|
|
3
3
|
export type ScopeLabel = {
|
|
4
4
|
id: string;
|
|
5
|
-
|
|
5
|
+
org_id: string;
|
|
6
6
|
scope_type: ScopeLevel;
|
|
7
7
|
label: string;
|
|
8
8
|
created_at: string;
|
|
@@ -18,31 +18,31 @@ export declare const DEFAULT_SCOPE_LABELS: Record<ScopeLevel, string>;
|
|
|
18
18
|
/**
|
|
19
19
|
* Gets all scope labels for an organization
|
|
20
20
|
*/
|
|
21
|
-
export declare function get_scope_labels(adapter: HazoConnectAdapter,
|
|
21
|
+
export declare function get_scope_labels(adapter: HazoConnectAdapter, org_id: string): Promise<ScopeLabelResult>;
|
|
22
22
|
/**
|
|
23
23
|
* Gets all scope labels for an organization, with defaults filled in for missing levels
|
|
24
24
|
*/
|
|
25
|
-
export declare function get_scope_labels_with_defaults(adapter: HazoConnectAdapter,
|
|
25
|
+
export declare function get_scope_labels_with_defaults(adapter: HazoConnectAdapter, org_id: string, custom_defaults?: Record<ScopeLevel, string>): Promise<ScopeLabelResult>;
|
|
26
26
|
/**
|
|
27
27
|
* Gets the label for a specific scope level
|
|
28
28
|
* Returns the custom label if set, otherwise returns the default
|
|
29
29
|
*/
|
|
30
|
-
export declare function get_label_for_level(adapter: HazoConnectAdapter,
|
|
30
|
+
export declare function get_label_for_level(adapter: HazoConnectAdapter, org_id: string, scope_type: ScopeLevel, custom_default?: string): Promise<string>;
|
|
31
31
|
/**
|
|
32
32
|
* Creates or updates a scope label for an organization
|
|
33
33
|
* Uses upsert pattern - creates if not exists, updates if exists
|
|
34
34
|
*/
|
|
35
|
-
export declare function upsert_scope_label(adapter: HazoConnectAdapter,
|
|
35
|
+
export declare function upsert_scope_label(adapter: HazoConnectAdapter, org_id: string, scope_type: ScopeLevel, label: string): Promise<ScopeLabelResult>;
|
|
36
36
|
/**
|
|
37
37
|
* Batch upsert scope labels for an organization
|
|
38
38
|
* Useful for saving all labels at once from the UI
|
|
39
39
|
*/
|
|
40
|
-
export declare function batch_upsert_scope_labels(adapter: HazoConnectAdapter,
|
|
40
|
+
export declare function batch_upsert_scope_labels(adapter: HazoConnectAdapter, org_id: string, labels: Array<{
|
|
41
41
|
scope_type: ScopeLevel;
|
|
42
42
|
label: string;
|
|
43
43
|
}>): Promise<ScopeLabelResult>;
|
|
44
44
|
/**
|
|
45
45
|
* Deletes a scope label, reverting to default
|
|
46
46
|
*/
|
|
47
|
-
export declare function delete_scope_label(adapter: HazoConnectAdapter,
|
|
47
|
+
export declare function delete_scope_label(adapter: HazoConnectAdapter, org_id: string, scope_type: ScopeLevel): Promise<ScopeLabelResult>;
|
|
48
48
|
//# sourceMappingURL=scope_labels_service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope_labels_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/scope_labels_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,
|
|
1
|
+
{"version":3,"file":"scope_labels_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/scope_labels_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;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CAAA;CAAE,CAAC,GACvD,OAAO,CAAC,gBAAgB,CAAC,CAwC3B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAwC3B"}
|
|
@@ -17,10 +17,10 @@ export const DEFAULT_SCOPE_LABELS = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Gets all scope labels for an organization
|
|
19
19
|
*/
|
|
20
|
-
export async function get_scope_labels(adapter,
|
|
20
|
+
export async function get_scope_labels(adapter, org_id) {
|
|
21
21
|
try {
|
|
22
22
|
const label_service = createCrudService(adapter, "hazo_scope_labels");
|
|
23
|
-
const labels = await label_service.findBy({
|
|
23
|
+
const labels = await label_service.findBy({ org_id });
|
|
24
24
|
return {
|
|
25
25
|
success: true,
|
|
26
26
|
labels: Array.isArray(labels) ? labels : [],
|
|
@@ -36,7 +36,7 @@ export async function get_scope_labels(adapter, org) {
|
|
|
36
36
|
filename: "scope_labels_service.ts",
|
|
37
37
|
line_number: 0,
|
|
38
38
|
operation: "get_scope_labels",
|
|
39
|
-
|
|
39
|
+
org_id,
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
return {
|
|
@@ -48,9 +48,9 @@ export async function get_scope_labels(adapter, org) {
|
|
|
48
48
|
/**
|
|
49
49
|
* Gets all scope labels for an organization, with defaults filled in for missing levels
|
|
50
50
|
*/
|
|
51
|
-
export async function get_scope_labels_with_defaults(adapter,
|
|
51
|
+
export async function get_scope_labels_with_defaults(adapter, org_id, custom_defaults) {
|
|
52
52
|
try {
|
|
53
|
-
const result = await get_scope_labels(adapter,
|
|
53
|
+
const result = await get_scope_labels(adapter, org_id);
|
|
54
54
|
if (!result.success) {
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
@@ -71,7 +71,7 @@ export async function get_scope_labels_with_defaults(adapter, org, custom_defaul
|
|
|
71
71
|
// Create a synthetic label entry (not persisted)
|
|
72
72
|
all_labels.push({
|
|
73
73
|
id: "", // Empty ID indicates this is a default, not from DB
|
|
74
|
-
|
|
74
|
+
org_id,
|
|
75
75
|
scope_type: level,
|
|
76
76
|
label: defaults[level],
|
|
77
77
|
created_at: "",
|
|
@@ -94,7 +94,7 @@ export async function get_scope_labels_with_defaults(adapter, org, custom_defaul
|
|
|
94
94
|
filename: "scope_labels_service.ts",
|
|
95
95
|
line_number: 0,
|
|
96
96
|
operation: "get_scope_labels_with_defaults",
|
|
97
|
-
|
|
97
|
+
org_id,
|
|
98
98
|
},
|
|
99
99
|
});
|
|
100
100
|
return {
|
|
@@ -107,10 +107,10 @@ export async function get_scope_labels_with_defaults(adapter, org, custom_defaul
|
|
|
107
107
|
* Gets the label for a specific scope level
|
|
108
108
|
* Returns the custom label if set, otherwise returns the default
|
|
109
109
|
*/
|
|
110
|
-
export async function get_label_for_level(adapter,
|
|
110
|
+
export async function get_label_for_level(adapter, org_id, scope_type, custom_default) {
|
|
111
111
|
try {
|
|
112
112
|
const label_service = createCrudService(adapter, "hazo_scope_labels");
|
|
113
|
-
const labels = await label_service.findBy({
|
|
113
|
+
const labels = await label_service.findBy({ org_id, scope_type });
|
|
114
114
|
if (Array.isArray(labels) && labels.length > 0) {
|
|
115
115
|
return labels[0].label;
|
|
116
116
|
}
|
|
@@ -125,12 +125,12 @@ export async function get_label_for_level(adapter, org, scope_type, custom_defau
|
|
|
125
125
|
* Creates or updates a scope label for an organization
|
|
126
126
|
* Uses upsert pattern - creates if not exists, updates if exists
|
|
127
127
|
*/
|
|
128
|
-
export async function upsert_scope_label(adapter,
|
|
128
|
+
export async function upsert_scope_label(adapter, org_id, scope_type, label) {
|
|
129
129
|
try {
|
|
130
130
|
const label_service = createCrudService(adapter, "hazo_scope_labels");
|
|
131
131
|
const now = new Date().toISOString();
|
|
132
|
-
// Check if label already exists for this
|
|
133
|
-
const existing = await label_service.findBy({
|
|
132
|
+
// Check if label already exists for this org_id + scope_type
|
|
133
|
+
const existing = await label_service.findBy({ org_id, scope_type });
|
|
134
134
|
if (Array.isArray(existing) && existing.length > 0) {
|
|
135
135
|
// Update existing
|
|
136
136
|
const existing_label = existing[0];
|
|
@@ -153,7 +153,7 @@ export async function upsert_scope_label(adapter, org, scope_type, label) {
|
|
|
153
153
|
// Create new
|
|
154
154
|
const inserted = await label_service.insert({
|
|
155
155
|
id: randomUUID(),
|
|
156
|
-
|
|
156
|
+
org_id,
|
|
157
157
|
scope_type,
|
|
158
158
|
label,
|
|
159
159
|
created_at: now,
|
|
@@ -181,7 +181,7 @@ export async function upsert_scope_label(adapter, org, scope_type, label) {
|
|
|
181
181
|
filename: "scope_labels_service.ts",
|
|
182
182
|
line_number: 0,
|
|
183
183
|
operation: "upsert_scope_label",
|
|
184
|
-
|
|
184
|
+
org_id,
|
|
185
185
|
scope_type,
|
|
186
186
|
label,
|
|
187
187
|
},
|
|
@@ -196,11 +196,11 @@ export async function upsert_scope_label(adapter, org, scope_type, label) {
|
|
|
196
196
|
* Batch upsert scope labels for an organization
|
|
197
197
|
* Useful for saving all labels at once from the UI
|
|
198
198
|
*/
|
|
199
|
-
export async function batch_upsert_scope_labels(adapter,
|
|
199
|
+
export async function batch_upsert_scope_labels(adapter, org_id, labels) {
|
|
200
200
|
try {
|
|
201
201
|
const results = [];
|
|
202
202
|
for (const { scope_type, label } of labels) {
|
|
203
|
-
const result = await upsert_scope_label(adapter,
|
|
203
|
+
const result = await upsert_scope_label(adapter, org_id, scope_type, label);
|
|
204
204
|
if (!result.success) {
|
|
205
205
|
return {
|
|
206
206
|
success: false,
|
|
@@ -226,7 +226,7 @@ export async function batch_upsert_scope_labels(adapter, org, labels) {
|
|
|
226
226
|
filename: "scope_labels_service.ts",
|
|
227
227
|
line_number: 0,
|
|
228
228
|
operation: "batch_upsert_scope_labels",
|
|
229
|
-
|
|
229
|
+
org_id,
|
|
230
230
|
},
|
|
231
231
|
});
|
|
232
232
|
return {
|
|
@@ -238,11 +238,11 @@ export async function batch_upsert_scope_labels(adapter, org, labels) {
|
|
|
238
238
|
/**
|
|
239
239
|
* Deletes a scope label, reverting to default
|
|
240
240
|
*/
|
|
241
|
-
export async function delete_scope_label(adapter,
|
|
241
|
+
export async function delete_scope_label(adapter, org_id, scope_type) {
|
|
242
242
|
try {
|
|
243
243
|
const label_service = createCrudService(adapter, "hazo_scope_labels");
|
|
244
244
|
// Find the label
|
|
245
|
-
const existing = await label_service.findBy({
|
|
245
|
+
const existing = await label_service.findBy({ org_id, scope_type });
|
|
246
246
|
if (!Array.isArray(existing) || existing.length === 0) {
|
|
247
247
|
return {
|
|
248
248
|
success: true, // Already doesn't exist
|
|
@@ -265,7 +265,7 @@ export async function delete_scope_label(adapter, org, scope_type) {
|
|
|
265
265
|
filename: "scope_labels_service.ts",
|
|
266
266
|
line_number: 0,
|
|
267
267
|
operation: "delete_scope_label",
|
|
268
|
-
|
|
268
|
+
org_id,
|
|
269
269
|
scope_type,
|
|
270
270
|
},
|
|
271
271
|
});
|
|
@@ -3,7 +3,8 @@ export type ScopeLevel = "hazo_scopes_l1" | "hazo_scopes_l2" | "hazo_scopes_l3"
|
|
|
3
3
|
export type ScopeRecord = {
|
|
4
4
|
id: string;
|
|
5
5
|
seq: string;
|
|
6
|
-
|
|
6
|
+
org_id: string;
|
|
7
|
+
root_org_id: string;
|
|
7
8
|
name: string;
|
|
8
9
|
parent_scope_id?: string | null;
|
|
9
10
|
created_at: string;
|
|
@@ -16,7 +17,8 @@ export type ScopeServiceResult = {
|
|
|
16
17
|
error?: string;
|
|
17
18
|
};
|
|
18
19
|
export type CreateScopeData = {
|
|
19
|
-
|
|
20
|
+
org_id: string;
|
|
21
|
+
root_org_id: string;
|
|
20
22
|
name: string;
|
|
21
23
|
parent_scope_id?: string;
|
|
22
24
|
};
|
|
@@ -43,7 +45,7 @@ export declare function get_child_level(level: ScopeLevel): ScopeLevel | undefin
|
|
|
43
45
|
/**
|
|
44
46
|
* Gets all scopes for a given level, optionally filtered by organization
|
|
45
47
|
*/
|
|
46
|
-
export declare function get_scopes_by_level(adapter: HazoConnectAdapter, level: ScopeLevel,
|
|
48
|
+
export declare function get_scopes_by_level(adapter: HazoConnectAdapter, level: ScopeLevel, org_id?: string): Promise<ScopeServiceResult>;
|
|
47
49
|
/**
|
|
48
50
|
* Gets a single scope by ID
|
|
49
51
|
*/
|
|
@@ -93,11 +95,12 @@ export type ScopeTreeNode = ScopeRecord & {
|
|
|
93
95
|
export type OrgScopeTreeNode = {
|
|
94
96
|
id: string;
|
|
95
97
|
name: string;
|
|
96
|
-
|
|
98
|
+
org_id: string;
|
|
99
|
+
root_org_id: string;
|
|
97
100
|
isOrgNode: true;
|
|
98
101
|
children: ScopeTreeNode[];
|
|
99
102
|
};
|
|
100
|
-
export declare function get_scope_tree(adapter: HazoConnectAdapter,
|
|
103
|
+
export declare function get_scope_tree(adapter: HazoConnectAdapter, org_id: string): Promise<{
|
|
101
104
|
success: boolean;
|
|
102
105
|
tree?: ScopeTreeNode[];
|
|
103
106
|
error?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/scope_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvD,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"scope_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/scope_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvD,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,gBAAgB,GACh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AC,CAuD7B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAoD7B;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC;AAEF,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA8DvE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA8DxE"}
|
|
@@ -50,12 +50,12 @@ export function get_child_level(level) {
|
|
|
50
50
|
/**
|
|
51
51
|
* Gets all scopes for a given level, optionally filtered by organization
|
|
52
52
|
*/
|
|
53
|
-
export async function get_scopes_by_level(adapter, level,
|
|
53
|
+
export async function get_scopes_by_level(adapter, level, org_id) {
|
|
54
54
|
try {
|
|
55
55
|
const scope_service = createCrudService(adapter, level);
|
|
56
56
|
let scopes;
|
|
57
|
-
if (
|
|
58
|
-
scopes = await scope_service.findBy({
|
|
57
|
+
if (org_id) {
|
|
58
|
+
scopes = await scope_service.findBy({ org_id });
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
scopes = await scope_service.findBy({});
|
|
@@ -82,7 +82,7 @@ export async function get_scopes_by_level(adapter, level, org) {
|
|
|
82
82
|
line_number: 0,
|
|
83
83
|
operation: "get_scopes_by_level",
|
|
84
84
|
level,
|
|
85
|
-
|
|
85
|
+
org_id,
|
|
86
86
|
},
|
|
87
87
|
});
|
|
88
88
|
return {
|
|
@@ -194,7 +194,8 @@ export async function create_scope(adapter, level, data) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
const insert_data = {
|
|
197
|
-
|
|
197
|
+
org_id: data.org_id,
|
|
198
|
+
root_org_id: data.root_org_id,
|
|
198
199
|
name: data.name,
|
|
199
200
|
created_at: now,
|
|
200
201
|
changed_at: now,
|
|
@@ -474,10 +475,10 @@ export async function get_scope_descendants(adapter, level, scope_id) {
|
|
|
474
475
|
};
|
|
475
476
|
}
|
|
476
477
|
}
|
|
477
|
-
export async function get_scope_tree(adapter,
|
|
478
|
+
export async function get_scope_tree(adapter, org_id) {
|
|
478
479
|
try {
|
|
479
480
|
// Get all L1 scopes for this org
|
|
480
|
-
const l1_result = await get_scopes_by_level(adapter, "hazo_scopes_l1",
|
|
481
|
+
const l1_result = await get_scopes_by_level(adapter, "hazo_scopes_l1", org_id);
|
|
481
482
|
if (!l1_result.success || !l1_result.scopes) {
|
|
482
483
|
return l1_result;
|
|
483
484
|
}
|
|
@@ -516,7 +517,7 @@ export async function get_scope_tree(adapter, org) {
|
|
|
516
517
|
filename: "scope_service.ts",
|
|
517
518
|
line_number: 0,
|
|
518
519
|
operation: "get_scope_tree",
|
|
519
|
-
|
|
520
|
+
org_id,
|
|
520
521
|
},
|
|
521
522
|
});
|
|
522
523
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type NavbarConfig } from "./navbar_config.server";
|
|
1
2
|
export type UiShellLayoutMode = "test_sidebar" | "standalone";
|
|
2
3
|
export type UiShellConfig = {
|
|
3
4
|
layout_mode: UiShellLayoutMode;
|
|
@@ -7,6 +8,10 @@ export type UiShellConfig = {
|
|
|
7
8
|
standalone_content_class: string;
|
|
8
9
|
standalone_show_heading: boolean;
|
|
9
10
|
standalone_show_description: boolean;
|
|
11
|
+
/** Navbar configuration for standalone mode */
|
|
12
|
+
navbar: NavbarConfig;
|
|
13
|
+
/** Enable vertical centering in standalone mode */
|
|
14
|
+
vertical_center: boolean;
|
|
10
15
|
};
|
|
11
16
|
/**
|
|
12
17
|
* Reads ui shell configuration controlling whether pages use the sidebar test shell
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui_shell_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/ui_shell_config.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui_shell_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/ui_shell_config.server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG9E,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,YAAY,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;IACjC,wBAAwB,EAAE,MAAM,CAAC;IACjC,uBAAuB,EAAE,OAAO,CAAC;IACjC,2BAA2B,EAAE,OAAO,CAAC;IACrC,+CAA+C;IAC/C,MAAM,EAAE,YAAY,CAAC;IACrB,mDAAmD;IACnD,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAGF;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAyDnD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// file_description: load ui shell layout settings from hazo_auth_config.ini
|
|
2
2
|
// section: imports
|
|
3
3
|
import { get_config_value } from "./config/config_loader.server";
|
|
4
|
+
import { get_navbar_config } from "./navbar_config.server";
|
|
4
5
|
// section: helpers
|
|
5
6
|
/**
|
|
6
7
|
* Reads ui shell configuration controlling whether pages use the sidebar test shell
|
|
@@ -16,6 +17,8 @@ export function get_ui_shell_config() {
|
|
|
16
17
|
const standalone_content_class = get_config_value(section, "standalone_content_class", "cls_standalone_shell_content w-full max-w-5xl shadow-xl rounded-2xl border bg-card");
|
|
17
18
|
const standalone_show_heading = get_config_value(section, "standalone_show_heading", "true").toLowerCase() === "true";
|
|
18
19
|
const standalone_show_description = get_config_value(section, "standalone_show_description", "true").toLowerCase() === "true";
|
|
20
|
+
const vertical_center = get_config_value(section, "vertical_center", "true").toLowerCase() === "true";
|
|
21
|
+
const navbar = get_navbar_config();
|
|
19
22
|
return {
|
|
20
23
|
layout_mode,
|
|
21
24
|
standalone_heading,
|
|
@@ -24,5 +27,7 @@ export function get_ui_shell_config() {
|
|
|
24
27
|
standalone_content_class,
|
|
25
28
|
standalone_show_heading,
|
|
26
29
|
standalone_show_description,
|
|
30
|
+
navbar,
|
|
31
|
+
vertical_center,
|
|
27
32
|
};
|
|
28
33
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Badge color preset names supported by the UserTypeBadge component
|
|
3
|
+
*/
|
|
4
|
+
export type BadgeColorPreset = "blue" | "green" | "red" | "yellow" | "purple" | "gray" | "orange" | "pink";
|
|
5
|
+
/**
|
|
6
|
+
* Individual user type definition parsed from config
|
|
7
|
+
*/
|
|
8
|
+
export type UserTypeDefinition = {
|
|
9
|
+
/** Unique key stored in database (e.g., "admin", "standard") */
|
|
10
|
+
key: string;
|
|
11
|
+
/** Display label (e.g., "Administrator", "Standard User") */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Badge color - preset name or hex value */
|
|
14
|
+
badge_color: string;
|
|
15
|
+
/** Whether this is a preset color or custom hex */
|
|
16
|
+
is_preset_color: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* User types configuration options
|
|
20
|
+
*/
|
|
21
|
+
export type UserTypesConfig = {
|
|
22
|
+
/** Whether user types feature is enabled (default: false) */
|
|
23
|
+
enable_user_types: boolean;
|
|
24
|
+
/** Default user type for new users (empty = no default) */
|
|
25
|
+
default_user_type: string;
|
|
26
|
+
/** Map of user type definitions by key */
|
|
27
|
+
user_types: Map<string, UserTypeDefinition>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Reads user types configuration from hazo_auth_config.ini file
|
|
31
|
+
* Falls back to defaults if config file is not found or section is missing
|
|
32
|
+
* @returns User types configuration options
|
|
33
|
+
*/
|
|
34
|
+
export declare function get_user_types_config(): UserTypesConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if user types feature is enabled in the configuration
|
|
37
|
+
* Convenience function for quick checks
|
|
38
|
+
*/
|
|
39
|
+
export declare function is_user_types_enabled(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the default user type from config
|
|
42
|
+
* Returns empty string if not configured
|
|
43
|
+
*/
|
|
44
|
+
export declare function get_default_user_type(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Gets user type definition by key
|
|
47
|
+
* @param type_key - The user type key
|
|
48
|
+
* @returns UserTypeDefinition or undefined if not found
|
|
49
|
+
*/
|
|
50
|
+
export declare function get_user_type_by_key(type_key: string): UserTypeDefinition | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Gets all user type definitions as array (for UI dropdowns)
|
|
53
|
+
* @returns Array of UserTypeDefinition objects
|
|
54
|
+
*/
|
|
55
|
+
export declare function get_all_user_types(): UserTypeDefinition[];
|
|
56
|
+
//# sourceMappingURL=user_types_config.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user_types_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/user_types_config.server.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,OAAO,GACP,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,6DAA6D;IAC7D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC7C,CAAC;AA2CF;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAoCvD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,GACf,kBAAkB,GAAG,SAAS,CAGhC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,kBAAkB,EAAE,CAGzD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// file_description: server-only helper to read user types configuration from hazo_auth_config.ini
|
|
2
|
+
// section: imports
|
|
3
|
+
import { get_config_value, get_config_boolean, read_config_section, } from "./config/config_loader.server";
|
|
4
|
+
import { DEFAULT_USER_TYPES } from "./config/default_config";
|
|
5
|
+
// section: constants
|
|
6
|
+
const SECTION_NAME = "hazo_auth__user_types";
|
|
7
|
+
const PRESET_COLORS = new Set([
|
|
8
|
+
"blue",
|
|
9
|
+
"green",
|
|
10
|
+
"red",
|
|
11
|
+
"yellow",
|
|
12
|
+
"purple",
|
|
13
|
+
"gray",
|
|
14
|
+
"orange",
|
|
15
|
+
"pink",
|
|
16
|
+
]);
|
|
17
|
+
// section: helpers
|
|
18
|
+
/**
|
|
19
|
+
* Parses a user type definition string
|
|
20
|
+
* Format: key:label:color (e.g., "admin:Administrator:red" or "custom:Custom Type:#4CAF50")
|
|
21
|
+
* @param value - The config value string
|
|
22
|
+
* @returns UserTypeDefinition or null if invalid
|
|
23
|
+
*/
|
|
24
|
+
function parse_user_type_definition(value) {
|
|
25
|
+
const parts = value.split(":").map((s) => s.trim());
|
|
26
|
+
if (parts.length < 2)
|
|
27
|
+
return null;
|
|
28
|
+
const key = parts[0];
|
|
29
|
+
const label = parts[1];
|
|
30
|
+
const badge_color = parts[2] || "gray";
|
|
31
|
+
if (!key || !label)
|
|
32
|
+
return null;
|
|
33
|
+
return {
|
|
34
|
+
key,
|
|
35
|
+
label,
|
|
36
|
+
badge_color,
|
|
37
|
+
is_preset_color: PRESET_COLORS.has(badge_color),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Reads user types configuration from hazo_auth_config.ini file
|
|
42
|
+
* Falls back to defaults if config file is not found or section is missing
|
|
43
|
+
* @returns User types configuration options
|
|
44
|
+
*/
|
|
45
|
+
export function get_user_types_config() {
|
|
46
|
+
const enable_user_types = get_config_boolean(SECTION_NAME, "enable_user_types", DEFAULT_USER_TYPES.enable_user_types);
|
|
47
|
+
const default_user_type = get_config_value(SECTION_NAME, "default_user_type", DEFAULT_USER_TYPES.default_user_type);
|
|
48
|
+
// Parse user type definitions from config
|
|
49
|
+
const user_types = new Map();
|
|
50
|
+
const section = read_config_section(SECTION_NAME);
|
|
51
|
+
if (section) {
|
|
52
|
+
// Look for user_type_1, user_type_2, etc. (up to 50 types supported)
|
|
53
|
+
for (let i = 1; i <= 50; i++) {
|
|
54
|
+
const key = `user_type_${i}`;
|
|
55
|
+
const value = section[key];
|
|
56
|
+
if (!value)
|
|
57
|
+
continue;
|
|
58
|
+
const type_def = parse_user_type_definition(value);
|
|
59
|
+
if (type_def) {
|
|
60
|
+
user_types.set(type_def.key, type_def);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
enable_user_types,
|
|
66
|
+
default_user_type,
|
|
67
|
+
user_types,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Checks if user types feature is enabled in the configuration
|
|
72
|
+
* Convenience function for quick checks
|
|
73
|
+
*/
|
|
74
|
+
export function is_user_types_enabled() {
|
|
75
|
+
return get_config_boolean(SECTION_NAME, "enable_user_types", DEFAULT_USER_TYPES.enable_user_types);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets the default user type from config
|
|
79
|
+
* Returns empty string if not configured
|
|
80
|
+
*/
|
|
81
|
+
export function get_default_user_type() {
|
|
82
|
+
return get_config_value(SECTION_NAME, "default_user_type", DEFAULT_USER_TYPES.default_user_type);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Gets user type definition by key
|
|
86
|
+
* @param type_key - The user type key
|
|
87
|
+
* @returns UserTypeDefinition or undefined if not found
|
|
88
|
+
*/
|
|
89
|
+
export function get_user_type_by_key(type_key) {
|
|
90
|
+
const config = get_user_types_config();
|
|
91
|
+
return config.user_types.get(type_key);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Gets all user type definitions as array (for UI dropdowns)
|
|
95
|
+
* @returns Array of UserTypeDefinition objects
|
|
96
|
+
*/
|
|
97
|
+
export function get_all_user_types() {
|
|
98
|
+
const config = get_user_types_config();
|
|
99
|
+
return Array.from(config.user_types.values());
|
|
100
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/page_components/login.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/page_components/login.tsx"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,aAAa,EACb,cAAyC,EACzC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,kBAAiD,EACjD,mBAAwC,EACxC,iBAAyC,EACzC,kBAAqC,EACrC,UAAU,EACV,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,cAAmB,2CA0CrB;AAED,eAAe,SAAS,CAAC"}
|