@limetech/lime-web-components 6.4.1 → 6.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/CHANGELOG.md +8 -0
- package/dist/action/action.d.ts +305 -13
- package/dist/action/action.d.ts.map +1 -1
- package/dist/application/decorators/application.d.ts +57 -3
- package/dist/application/decorators/application.d.ts.map +1 -1
- package/dist/application/decorators/session.d.ts +44 -3
- package/dist/application/decorators/session.d.ts.map +1 -1
- package/dist/application/decorators/user.d.ts +47 -3
- package/dist/application/decorators/user.d.ts.map +1 -1
- package/dist/application/repository.d.ts +102 -5
- package/dist/application/repository.d.ts.map +1 -1
- package/dist/application/session.d.ts +105 -15
- package/dist/application/session.d.ts.map +1 -1
- package/dist/application/user.d.ts +122 -13
- package/dist/application/user.d.ts.map +1 -1
- package/dist/commandbus/commandbus.d.ts +364 -23
- package/dist/commandbus/commandbus.d.ts.map +1 -1
- package/dist/conditionregistry/conditionregistry.d.ts +310 -27
- package/dist/conditionregistry/conditionregistry.d.ts.map +1 -1
- package/dist/config/decorator.d.ts +50 -3
- package/dist/config/decorator.d.ts.map +1 -1
- package/dist/config/repository.d.ts +131 -10
- package/dist/config/repository.d.ts.map +1 -1
- package/dist/core/context.d.ts +94 -4
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/lime-web-component.d.ts +59 -3
- package/dist/core/lime-web-component.d.ts.map +1 -1
- package/dist/core/metadata.d.ts +113 -13
- package/dist/core/metadata.d.ts.map +1 -1
- package/dist/core/platform.d.ts +175 -14
- package/dist/core/platform.d.ts.map +1 -1
- package/dist/core/state.d.ts +138 -14
- package/dist/core/state.d.ts.map +1 -1
- package/dist/datetimeformatter/datetimeformatter.d.ts +97 -34
- package/dist/datetimeformatter/datetimeformatter.d.ts.map +1 -1
- package/dist/device/decorator.d.ts +56 -4
- package/dist/device/decorator.d.ts.map +1 -1
- package/dist/device/device.d.ts +51 -6
- package/dist/device/device.d.ts.map +1 -1
- package/dist/dialog/dialog.d.ts +155 -19
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/limeobject/file.d.ts +6 -0
- package/dist/limeobject/file.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -2,26 +2,123 @@ import { StateRepository } from '../core';
|
|
|
2
2
|
import { User } from './user';
|
|
3
3
|
import { Session } from './session';
|
|
4
4
|
/**
|
|
5
|
+
* Repository for accessing application-level state and metadata.
|
|
6
|
+
*
|
|
7
|
+
* The ApplicationRepository provides access to global application information including
|
|
8
|
+
* the current user, session details, application name, and language settings. It extends
|
|
9
|
+
* {@link StateRepository} to provide reactive subscriptions to these values, allowing components
|
|
10
|
+
* to automatically update when application state changes.
|
|
11
|
+
*
|
|
12
|
+
* This repository is typically available immediately when a component loads and provides
|
|
13
|
+
* essential context about the running application and the authenticated user.
|
|
14
|
+
*
|
|
15
|
+
* @example Use decorators for reactive state management
|
|
16
|
+
* ```typescript
|
|
17
|
+
* class MyComponent {
|
|
18
|
+
* @State()
|
|
19
|
+
* @SelectCurrentUser()
|
|
20
|
+
* private user: User;
|
|
21
|
+
*
|
|
22
|
+
* @State()
|
|
23
|
+
* @SelectApplicationName()
|
|
24
|
+
* private appName: string;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Direct repository access (useful for one-time reads)
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const repository = platform.get(PlatformServiceName.Application);
|
|
31
|
+
*
|
|
32
|
+
* const session = repository.getSession();
|
|
33
|
+
* const hasAdminAccess = session?.admin || false;
|
|
34
|
+
*
|
|
35
|
+
* const user = repository.getCurrentUser();
|
|
36
|
+
* if (user?.groups.some(g => g.name === 'Administrators')) {
|
|
37
|
+
* // User is an administrator
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
5
41
|
* @public
|
|
6
42
|
* @group Application
|
|
7
43
|
*/
|
|
8
44
|
export interface ApplicationRepository extends StateRepository {
|
|
9
45
|
/**
|
|
10
|
-
* Get the name of the application
|
|
46
|
+
* Get the name of the current Lime CRM application.
|
|
47
|
+
*
|
|
48
|
+
* The application name identifies which Lime CRM database/application the user
|
|
49
|
+
* is currently connected to.
|
|
50
|
+
*
|
|
51
|
+
* @returns The application name
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const appName = appRepo.getApplicationName();
|
|
56
|
+
* console.log(`Connected to: ${appName}`); // "Connected to: CustomerCRM"
|
|
57
|
+
* ```
|
|
11
58
|
*/
|
|
12
59
|
getApplicationName(): string | undefined;
|
|
13
60
|
/**
|
|
14
|
-
* Get the currently logged in user
|
|
61
|
+
* Get the currently logged in user.
|
|
62
|
+
*
|
|
63
|
+
* Returns the User object containing information about the authenticated user,
|
|
64
|
+
* including their username, full name, email, groups, and associated coworker
|
|
65
|
+
* record if applicable.
|
|
66
|
+
*
|
|
67
|
+
* @returns The current User object, or undefined if not authenticated
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const user = appRepo.getCurrentUser();
|
|
72
|
+
* if (user?.groups.some(g => g.name === 'Administrators')) {
|
|
73
|
+
* // Show admin features
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
15
76
|
*/
|
|
16
77
|
getCurrentUser(): User | undefined;
|
|
17
78
|
/**
|
|
18
|
-
* Get the current session
|
|
79
|
+
* Get the current session information.
|
|
80
|
+
*
|
|
81
|
+
* The session contains detailed information about the current user session including
|
|
82
|
+
* login time, session timeout, enabled features, database connection details, and
|
|
83
|
+
* whether the user has administrative privileges.
|
|
84
|
+
*
|
|
85
|
+
* @returns The current Session object, or undefined if no active session
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const session = appRepo.getSession();
|
|
90
|
+
*
|
|
91
|
+
* // Check if session is about to expire
|
|
92
|
+
* const expirationTime = new Date(session?.expirationTime);
|
|
93
|
+
* const minutesLeft = (expirationTime.getTime() - Date.now()) / 60000;
|
|
94
|
+
* if (minutesLeft < 5) {
|
|
95
|
+
* // Warn user about session expiration
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* // Check for admin privileges
|
|
99
|
+
* if (session?.admin) {
|
|
100
|
+
* // Enable admin features
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
19
103
|
*/
|
|
20
104
|
getSession(): Session | undefined;
|
|
21
105
|
/**
|
|
22
|
-
* Get the current language
|
|
106
|
+
* Get the current interface language.
|
|
107
|
+
*
|
|
108
|
+
* Returns the two-letter ISO 639-1 language code for the current user interface
|
|
109
|
+
* language. This should be used for localizing component text and formatting
|
|
110
|
+
* locale-specific data like dates and numbers.
|
|
111
|
+
*
|
|
112
|
+
* @returns A two-letter language code (e.g., "en", "sv", "de", "fi")
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const language = appRepo.getLanguage();
|
|
23
117
|
*
|
|
24
|
-
*
|
|
118
|
+
* // Format dates according to language
|
|
119
|
+
* const locale = language === 'sv' ? 'sv-SE' : 'en-US';
|
|
120
|
+
* const formatted = new Date().toLocaleDateString(locale);
|
|
121
|
+
* ```
|
|
25
122
|
*/
|
|
26
123
|
getLanguage(): string;
|
|
27
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/application/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/application/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC1D;;;;;;;;;;;;;OAaG;IACH,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAC;IAEzC;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,IAAI,IAAI,GAAG,SAAS,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU,IAAI,OAAO,GAAG,SAAS,CAAC;IAElC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,IAAI,MAAM,CAAC;CACzB"}
|
|
@@ -1,67 +1,157 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Represents an active user session in Lime CRM.
|
|
3
|
+
*
|
|
4
|
+
* The Session object contains comprehensive information about the current user's
|
|
5
|
+
* authenticated session, including login details, enabled features, administrative
|
|
6
|
+
* privileges, and session timing. This information is crucial for security,
|
|
7
|
+
* feature availability, and session management.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Access session information in a component
|
|
12
|
+
* const appRepo = platform.get(PlatformServiceName.Application);
|
|
13
|
+
* const session = appRepo.getSession();
|
|
14
|
+
*
|
|
15
|
+
* if (session?.active) {
|
|
16
|
+
* console.log(`Logged in at: ${session.loginTime}`);
|
|
17
|
+
* console.log(`Admin privileges: ${session.admin}`);
|
|
18
|
+
*
|
|
19
|
+
* // Check session expiration
|
|
20
|
+
* const expiresAt = new Date(session.expirationTime);
|
|
21
|
+
* const now = new Date();
|
|
22
|
+
* const minutesRemaining = (expiresAt.getTime() - now.getTime()) / 60000;
|
|
23
|
+
*
|
|
24
|
+
* if (minutesRemaining < 5) {
|
|
25
|
+
* // Warn about imminent session expiration
|
|
26
|
+
* console.warn('Session expires in less than 5 minutes');
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Check for enabled features and addons
|
|
34
|
+
* const session = appRepo.getSession();
|
|
35
|
+
*
|
|
36
|
+
* // Check feature flags
|
|
37
|
+
* if (session?.features?.['advancedReporting']) {
|
|
38
|
+
* // Enable advanced reporting features
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Check for specific addons
|
|
42
|
+
* if (session?.addons?.['salesAutomation']) {
|
|
43
|
+
* // Show sales automation tools
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
2
47
|
* @public
|
|
3
48
|
* @group Application
|
|
4
49
|
*/
|
|
5
50
|
export interface Session {
|
|
6
51
|
/**
|
|
7
|
-
*
|
|
52
|
+
* Indicates whether the session is currently active.
|
|
53
|
+
*
|
|
54
|
+
* An active session means the user is authenticated and can perform operations.
|
|
55
|
+
* Sessions become inactive after logout or timeout.
|
|
8
56
|
*/
|
|
9
57
|
active: boolean;
|
|
10
58
|
/**
|
|
11
|
-
*
|
|
59
|
+
* Configuration and state of enabled addons/plugins.
|
|
60
|
+
*
|
|
61
|
+
* Contains a key-value map of addon names to their configuration objects.
|
|
62
|
+
* The structure of each addon's configuration depends on the addon itself.
|
|
12
63
|
*/
|
|
13
64
|
addons: Record<string, any>;
|
|
14
65
|
/**
|
|
15
|
-
*
|
|
66
|
+
* Indicates whether the user has administrative privileges.
|
|
67
|
+
*
|
|
68
|
+
* Admin users typically have access to system configuration, user management,
|
|
69
|
+
* and other administrative features not available to regular users.
|
|
16
70
|
*/
|
|
17
71
|
admin: boolean;
|
|
18
72
|
/**
|
|
19
|
-
*
|
|
73
|
+
* Application Performance Monitoring (APM) configuration.
|
|
74
|
+
*
|
|
75
|
+
* Contains settings for performance tracking and monitoring tools.
|
|
76
|
+
* The exact structure depends on the APM provider being used.
|
|
20
77
|
*/
|
|
21
78
|
apm: Record<string, unknown>;
|
|
22
79
|
/**
|
|
23
|
-
*
|
|
80
|
+
* The name of the Lime CRM application.
|
|
81
|
+
*
|
|
82
|
+
* Identifies which application/database the user is connected to.
|
|
24
83
|
*/
|
|
25
84
|
application: string;
|
|
26
85
|
/**
|
|
27
|
-
*
|
|
86
|
+
* The name of the underlying database.
|
|
87
|
+
*
|
|
88
|
+
* Technical database identifier, usually matching the application name
|
|
89
|
+
* but may differ in some configurations.
|
|
28
90
|
*/
|
|
29
91
|
database: string;
|
|
30
92
|
/**
|
|
31
|
-
*
|
|
93
|
+
* User-friendly display name for the application.
|
|
94
|
+
*
|
|
95
|
+
* This is the name shown in the UI, which may be different from the
|
|
96
|
+
* technical application name. Often includes company or department name.
|
|
32
97
|
*/
|
|
33
98
|
displayName: string;
|
|
99
|
+
/**
|
|
100
|
+
* ISO 8601 timestamp when the session will expire.
|
|
101
|
+
*
|
|
102
|
+
* After this time, the session becomes invalid and the user must
|
|
103
|
+
* re-authenticate.
|
|
104
|
+
*/
|
|
34
105
|
expirationTime?: string;
|
|
35
106
|
/**
|
|
36
|
-
* Feature
|
|
107
|
+
* Feature flags controlling available functionality.
|
|
108
|
+
*
|
|
109
|
+
* A key-value map where keys are feature names and values indicate whether
|
|
110
|
+
* the feature is enabled.
|
|
37
111
|
*/
|
|
38
112
|
features: Record<string, boolean>;
|
|
39
113
|
/**
|
|
40
|
-
*
|
|
114
|
+
* Unique identifier for this session.
|
|
115
|
+
*
|
|
116
|
+
* Used for session tracking, logging, and debugging. Each login creates
|
|
117
|
+
* a new session with a unique ID.
|
|
41
118
|
*/
|
|
42
119
|
id: string;
|
|
43
120
|
/**
|
|
44
|
-
*
|
|
121
|
+
* ISO 8601 timestamp when the user logged in.
|
|
122
|
+
*
|
|
123
|
+
* Marks the start of the session.
|
|
45
124
|
*/
|
|
46
125
|
loginTime: string;
|
|
47
126
|
/**
|
|
48
|
-
*
|
|
127
|
+
* ISO 8601 timestamp when the user logged out.
|
|
128
|
+
*
|
|
129
|
+
* Only present after the user has explicitly logged out. Not set for
|
|
130
|
+
* sessions that timeout.
|
|
49
131
|
*/
|
|
50
132
|
logoutTime?: string;
|
|
51
133
|
/**
|
|
52
|
-
* Application service number
|
|
134
|
+
* Application service instance number.
|
|
53
135
|
*/
|
|
54
136
|
serviceNumber?: number;
|
|
55
137
|
/**
|
|
56
|
-
*
|
|
138
|
+
* Session timeout duration in seconds.
|
|
139
|
+
*
|
|
140
|
+
* Indicates how long a session can be idle before it automatically expires.
|
|
141
|
+
* The actual expiration time is calculated from the last activity.
|
|
57
142
|
*/
|
|
58
143
|
sessionTimeout: number;
|
|
59
144
|
/**
|
|
60
|
-
* ID of the user
|
|
145
|
+
* The ID of the authenticated user.
|
|
146
|
+
*
|
|
147
|
+
* References the User.id property. Used to identify which user owns
|
|
148
|
+
* this session.
|
|
61
149
|
*/
|
|
62
150
|
userId: number;
|
|
63
151
|
/**
|
|
64
|
-
* Name of the user's workstation
|
|
152
|
+
* Name or identifier of the user's workstation.
|
|
153
|
+
*
|
|
154
|
+
* Typically the computer name or IP address from which the user logged in.
|
|
65
155
|
*/
|
|
66
156
|
workstation: string;
|
|
67
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/application/session.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/application/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,WAAW,OAAO;IACpB;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;OAKG;IAEH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE7B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;;;;OAKG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,70 +1,179 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Represents a user in the Lime CRM system.
|
|
3
|
+
*
|
|
4
|
+
* The User object contains all relevant information about an authenticated user,
|
|
5
|
+
* including their identity, contact details, group memberships, and associated
|
|
6
|
+
* business object (coworker) if applicable. This information is used throughout
|
|
7
|
+
* the platform for authentication, authorization, and personalization.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Access user information in a component
|
|
12
|
+
* const appRepo = platform.get(PlatformServiceName.Application);
|
|
13
|
+
* const user = appRepo.getCurrentUser();
|
|
14
|
+
*
|
|
15
|
+
* console.log(`Logged in as: ${user.fullname} (${user.username})`);
|
|
16
|
+
* console.log(`Email: ${user.email}`);
|
|
17
|
+
* console.log(`Member of ${user.groups.length} groups`);
|
|
18
|
+
*
|
|
19
|
+
* // Check for specific group membership
|
|
20
|
+
* const isAdmin = user.groups.some(g => g.name === 'Administrators');
|
|
21
|
+
* const isSales = user.groups.some(g => g.name === 'Sales');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Load the user's coworker record for additional details
|
|
27
|
+
* if (user.coworker) {
|
|
28
|
+
* const repo = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
29
|
+
* const coworkerObject = await repo.loadObject(
|
|
30
|
+
* user.coworker.limetype,
|
|
31
|
+
* user.coworker.id
|
|
32
|
+
* );
|
|
33
|
+
* // Access additional coworker properties like phone, department, etc.
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
2
37
|
* @public
|
|
3
38
|
* @group Application
|
|
4
39
|
*/
|
|
5
40
|
export interface User {
|
|
6
41
|
/**
|
|
7
|
-
* The
|
|
42
|
+
* The unique username used for authentication.
|
|
43
|
+
*
|
|
44
|
+
* This is the login identifier for the user, typically in a format like
|
|
45
|
+
* "john.doe" or "jdoe". It must be unique across the system.
|
|
8
46
|
*/
|
|
9
47
|
username: string;
|
|
10
48
|
/**
|
|
11
|
-
* The full name
|
|
49
|
+
* The user's full display name.
|
|
50
|
+
*
|
|
51
|
+
* This is the human-readable name shown in the UI, typically in the format
|
|
52
|
+
* "First Last" (e.g., "John Doe"). Used for display purposes throughout
|
|
53
|
+
* the application.
|
|
12
54
|
*/
|
|
13
55
|
fullname: string;
|
|
14
56
|
/**
|
|
15
|
-
* The
|
|
57
|
+
* The unique numeric identifier for the user.
|
|
16
58
|
*/
|
|
17
59
|
id: number;
|
|
18
60
|
/**
|
|
19
|
-
* The email
|
|
61
|
+
* The user's email address.
|
|
20
62
|
*/
|
|
21
63
|
email: string;
|
|
22
64
|
/**
|
|
23
|
-
*
|
|
65
|
+
* Indicates whether the user account is currently active.
|
|
66
|
+
*
|
|
67
|
+
* Inactive users cannot log in to the system. Useful for temporarily
|
|
68
|
+
* disabling accounts without deletion.
|
|
24
69
|
*/
|
|
25
70
|
active: boolean;
|
|
26
71
|
/**
|
|
27
|
-
*
|
|
72
|
+
* List of security groups the user belongs to.
|
|
73
|
+
*
|
|
74
|
+
* Groups control access permissions and feature availability. A user can
|
|
75
|
+
* belong to multiple groups, inheriting permissions from all of them.
|
|
28
76
|
*/
|
|
29
77
|
groups: UserGroup[];
|
|
30
78
|
/**
|
|
31
|
-
* The
|
|
79
|
+
* The user's primary group assignment.
|
|
80
|
+
*
|
|
81
|
+
* When a user belongs to multiple groups, this indicates their main group
|
|
82
|
+
* affiliation. Used for default permissions and organizational structure.
|
|
32
83
|
*/
|
|
33
84
|
defaultGroup: UserGroup;
|
|
34
85
|
/**
|
|
35
|
-
*
|
|
86
|
+
* Reference to the user's associated coworker business object.
|
|
87
|
+
*
|
|
88
|
+
* Many Lime CRM systems have a coworker limetype that stores additional
|
|
89
|
+
* employee information beyond the user account (phone, department, manager, etc.).
|
|
90
|
+
* This property links to that record if it exists.
|
|
36
91
|
*/
|
|
37
92
|
coworker: UserCoworker;
|
|
38
93
|
}
|
|
39
94
|
/**
|
|
95
|
+
* Represents a security group in Lime CRM.
|
|
96
|
+
*
|
|
97
|
+
* Groups are used to organize users and control their access permissions.
|
|
98
|
+
* Users inherit permissions from all groups they belong to. Groups typically
|
|
99
|
+
* represent departments, roles, or permission levels within the organization.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* // Check if user belongs to specific groups
|
|
104
|
+
* const user = appRepo.getCurrentUser();
|
|
105
|
+
* const adminGroup = user.groups.find(g => g.name === 'Administrators');
|
|
106
|
+
* if (adminGroup) {
|
|
107
|
+
* console.log(`User is admin (Group ID: ${adminGroup.id})`);
|
|
108
|
+
* console.log(`Description: ${adminGroup.description}`);
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
40
112
|
* @public
|
|
41
113
|
* @group Application
|
|
42
114
|
*/
|
|
43
115
|
export interface UserGroup {
|
|
44
116
|
/**
|
|
45
|
-
*
|
|
117
|
+
* The unique name identifier for the group.
|
|
118
|
+
*
|
|
119
|
+
* Group names are used throughout the system for permission checks
|
|
120
|
+
* and access control.
|
|
46
121
|
*/
|
|
47
122
|
name: string;
|
|
48
123
|
/**
|
|
49
|
-
*
|
|
124
|
+
* The numeric identifier for the group.
|
|
125
|
+
*
|
|
126
|
+
* Used internally for group references in the database.
|
|
50
127
|
*/
|
|
51
128
|
id: number;
|
|
52
129
|
/**
|
|
53
|
-
*
|
|
130
|
+
* Human-readable description of the group's purpose.
|
|
131
|
+
*
|
|
132
|
+
* Provides additional context about what the group represents
|
|
133
|
+
* and what permissions it typically grants.
|
|
54
134
|
*/
|
|
55
135
|
description: string;
|
|
56
136
|
}
|
|
57
137
|
/**
|
|
138
|
+
* Reference to a user's associated coworker business object.
|
|
139
|
+
*
|
|
140
|
+
* In Lime CRM, user accounts (for authentication) are often separate from
|
|
141
|
+
* coworker/employee records (business objects with additional data). This
|
|
142
|
+
* interface provides the link between the two, allowing you to load the
|
|
143
|
+
* full coworker record when needed.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // Load full coworker details
|
|
148
|
+
* const user = appRepo.getCurrentUser();
|
|
149
|
+
* if (user.coworker) {
|
|
150
|
+
* const repo = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
151
|
+
* const coworker = await repo.loadObject(
|
|
152
|
+
* user.coworker.limetype, // Usually 'coworker' or 'employee'
|
|
153
|
+
* user.coworker.id
|
|
154
|
+
* );
|
|
155
|
+
*
|
|
156
|
+
* // Access additional properties
|
|
157
|
+
* console.log(`Phone: ${coworker.properties.phone}`);
|
|
158
|
+
* console.log(`Department: ${coworker.properties.department}`);
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
58
162
|
* @public
|
|
59
163
|
* @group Application
|
|
60
164
|
*/
|
|
61
165
|
export interface UserCoworker {
|
|
62
166
|
/**
|
|
63
|
-
*
|
|
167
|
+
* The ID of the coworker LimeObject.
|
|
168
|
+
*
|
|
169
|
+
* Use this with {@link LimeObjectRepository} to load the full coworker record.
|
|
64
170
|
*/
|
|
65
171
|
id: number;
|
|
66
172
|
/**
|
|
67
|
-
*
|
|
173
|
+
* The name of the Limetype used for coworker records.
|
|
174
|
+
*
|
|
175
|
+
* Typically "coworker" or "employee", but can vary by configuration.
|
|
176
|
+
* Use this as the limetype parameter when loading the object.
|
|
68
177
|
*/
|
|
69
178
|
limetype: string;
|
|
70
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/application/user.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/application/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,IAAI;IACjB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;OAKG;IACH,MAAM,EAAE,SAAS,EAAE,CAAC;IAEpB;;;;;OAKG;IACH,YAAY,EAAE,SAAS,CAAC;IAExB;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,YAAY;IACzB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|