Skip to content

Commit 0ede788

Browse files
authored
refactor: store PEDM configuration in SQLite instead of JSON files (#1356)
Previously the PEDM profiles and assignments were wrapped up in a `Policy` object, which was loaded at startup and then maintained via an `IdList` structure. API calls would have the `Policy` in their context and interact with it directly. This PR: - Strips out unused features from the API surface area (session / temporary elevations, revoke elevation). We don't support them right now and it just adds noise. - The remaining `Policy` item needed for elevation is the current user selected profile. We load this from the DB at the API front -end and pass it back to where it's needed. - The API now calls the database directly to query/update/delete. In most cases transactions are used where we need to enforce consistency, but we are not expecting a high volume of calls or needing a high level of atomicity. The API and database design is not the most well thought-out, but it closely reflects the _existing_ APIs to minimize disruption elsewhere (API clients like RDM, as well as avoid significant behaviour changes that may introduce new bugs). Concerns are: - There's no effort to maintain compatibility here. Existing PEDM users will need to uninstall, wipe out their %programdata%\Agent\pedm directory, and reinstall. Internally I'll provide a script to do that. RDM will be blocked from using any version that doesn't include these changes. - The handling of users is not optimal (see @allan2 related PR). This goes back to Kyle's original implementation and if we had made these changes earlier, we could've addressed it, but there is no time now. We'll have some technical debt here to correct in the future.
1 parent 131a7c5 commit 0ede788

81 files changed

Lines changed: 915 additions & 4140 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/.openapi-generator/FILES

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ docs/Assignment.md
55
docs/AuthenticodeSignatureStatus.md
66
docs/Certificate.md
77
docs/DefaultApi.md
8-
docs/ElevateTemporaryPayload.md
9-
docs/ElevationConfigurations.md
108
docs/ElevationKind.md
119
docs/ElevationMethod.md
1210
docs/Error.md
@@ -18,18 +16,11 @@ docs/JitElevationLogQueryOptions.md
1816
docs/JitElevationLogRow.md
1917
docs/LaunchPayload.md
2018
docs/LaunchResponse.md
21-
docs/OptionalId.md
2219
docs/PathIdParameter.md
23-
docs/PathIntIdPath.md
2420
docs/Profile.md
25-
docs/SessionElevationConfiguration.md
26-
docs/SessionElevationStatus.md
2721
docs/Signature.md
2822
docs/Signer.md
2923
docs/StartupInfoDto.md
30-
docs/StatusResponse.md
31-
docs/TemporaryElevationConfiguration.md
32-
docs/TemporaryElevationStatus.md
3324
docs/User.md
3425
src/apis/client.rs
3526
src/apis/configuration.rs
@@ -41,8 +32,6 @@ src/models/about_data.rs
4132
src/models/assignment.rs
4233
src/models/authenticode_signature_status.rs
4334
src/models/certificate.rs
44-
src/models/elevate_temporary_payload.rs
45-
src/models/elevation_configurations.rs
4635
src/models/elevation_kind.rs
4736
src/models/elevation_method.rs
4837
src/models/error.rs
@@ -55,16 +44,9 @@ src/models/jit_elevation_log_row.rs
5544
src/models/launch_payload.rs
5645
src/models/launch_response.rs
5746
src/models/mod.rs
58-
src/models/optional_id.rs
5947
src/models/path_id_parameter.rs
60-
src/models/path_int_id_path.rs
6148
src/models/profile.rs
62-
src/models/session_elevation_configuration.rs
63-
src/models/session_elevation_status.rs
6449
src/models/signature.rs
6550
src/models/signer.rs
6651
src/models/startup_info_dto.rs
67-
src/models/status_response.rs
68-
src/models/temporary_elevation_configuration.rs
69-
src/models/temporary_elevation_status.rs
7052
src/models/user.rs

crates/devolutions-pedm-shared/devolutions-pedm-client-http/README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,18 @@ All URIs are relative to *http://localhost*
2727
Class | Method | HTTP request | Description
2828
------------ | ------------- | ------------- | -------------
2929
*DefaultApi* | [**about_get**](docs/DefaultApi.md#about_get) | **Get** /about |
30-
*DefaultApi* | [**elevate_session_post**](docs/DefaultApi.md#elevate_session_post) | **Post** /elevate/session |
31-
*DefaultApi* | [**elevate_temporary_post**](docs/DefaultApi.md#elevate_temporary_post) | **Post** /elevate/temporary |
3230
*DefaultApi* | [**launch_post**](docs/DefaultApi.md#launch_post) | **Post** /launch |
3331
*DefaultApi* | [**log_jit_get**](docs/DefaultApi.md#log_jit_get) | **Get** /log/jit |
3432
*DefaultApi* | [**log_jit_id_get**](docs/DefaultApi.md#log_jit_id_get) | **Get** /log/jit/{id} |
3533
*DefaultApi* | [**policy_assignments_get**](docs/DefaultApi.md#policy_assignments_get) | **Get** /policy/assignments |
3634
*DefaultApi* | [**policy_assignments_id_put**](docs/DefaultApi.md#policy_assignments_id_put) | **Put** /policy/assignments/{id} |
3735
*DefaultApi* | [**policy_me_get**](docs/DefaultApi.md#policy_me_get) | **Get** /policy/me |
38-
*DefaultApi* | [**policy_me_put**](docs/DefaultApi.md#policy_me_put) | **Put** /policy/me |
36+
*DefaultApi* | [**policy_me_id_put**](docs/DefaultApi.md#policy_me_id_put) | **Put** /policy/me/{id} |
3937
*DefaultApi* | [**policy_profiles_get**](docs/DefaultApi.md#policy_profiles_get) | **Get** /policy/profiles |
4038
*DefaultApi* | [**policy_profiles_id_delete**](docs/DefaultApi.md#policy_profiles_id_delete) | **Delete** /policy/profiles/{id} |
4139
*DefaultApi* | [**policy_profiles_id_get**](docs/DefaultApi.md#policy_profiles_id_get) | **Get** /policy/profiles/{id} |
42-
*DefaultApi* | [**policy_profiles_id_put**](docs/DefaultApi.md#policy_profiles_id_put) | **Put** /policy/profiles/{id} |
4340
*DefaultApi* | [**policy_profiles_post**](docs/DefaultApi.md#policy_profiles_post) | **Post** /policy/profiles |
4441
*DefaultApi* | [**policy_users_get**](docs/DefaultApi.md#policy_users_get) | **Get** /policy/users |
45-
*DefaultApi* | [**revoke_post**](docs/DefaultApi.md#revoke_post) | **Post** /revoke |
46-
*DefaultApi* | [**status_get**](docs/DefaultApi.md#status_get) | **Get** /status |
4742

4843

4944
## Documentation For Models
@@ -52,8 +47,6 @@ Class | Method | HTTP request | Description
5247
- [Assignment](docs/Assignment.md)
5348
- [AuthenticodeSignatureStatus](docs/AuthenticodeSignatureStatus.md)
5449
- [Certificate](docs/Certificate.md)
55-
- [ElevateTemporaryPayload](docs/ElevateTemporaryPayload.md)
56-
- [ElevationConfigurations](docs/ElevationConfigurations.md)
5750
- [ElevationKind](docs/ElevationKind.md)
5851
- [ElevationMethod](docs/ElevationMethod.md)
5952
- [Error](docs/Error.md)
@@ -65,18 +58,11 @@ Class | Method | HTTP request | Description
6558
- [JitElevationLogRow](docs/JitElevationLogRow.md)
6659
- [LaunchPayload](docs/LaunchPayload.md)
6760
- [LaunchResponse](docs/LaunchResponse.md)
68-
- [OptionalId](docs/OptionalId.md)
6961
- [PathIdParameter](docs/PathIdParameter.md)
70-
- [PathIntIdPath](docs/PathIntIdPath.md)
7162
- [Profile](docs/Profile.md)
72-
- [SessionElevationConfiguration](docs/SessionElevationConfiguration.md)
73-
- [SessionElevationStatus](docs/SessionElevationStatus.md)
7463
- [Signature](docs/Signature.md)
7564
- [Signer](docs/Signer.md)
7665
- [StartupInfoDto](docs/StartupInfoDto.md)
77-
- [StatusResponse](docs/StatusResponse.md)
78-
- [TemporaryElevationConfiguration](docs/TemporaryElevationConfiguration.md)
79-
- [TemporaryElevationStatus](docs/TemporaryElevationStatus.md)
8066
- [User](docs/User.md)
8167

8268

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/DefaultApi.md

Lines changed: 10 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@ All URIs are relative to *http://localhost*
55
Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**about_get**](DefaultApi.md#about_get) | **Get** /about |
8-
[**elevate_session_post**](DefaultApi.md#elevate_session_post) | **Post** /elevate/session |
9-
[**elevate_temporary_post**](DefaultApi.md#elevate_temporary_post) | **Post** /elevate/temporary |
108
[**launch_post**](DefaultApi.md#launch_post) | **Post** /launch |
119
[**log_jit_get**](DefaultApi.md#log_jit_get) | **Get** /log/jit |
1210
[**log_jit_id_get**](DefaultApi.md#log_jit_id_get) | **Get** /log/jit/{id} |
1311
[**policy_assignments_get**](DefaultApi.md#policy_assignments_get) | **Get** /policy/assignments |
1412
[**policy_assignments_id_put**](DefaultApi.md#policy_assignments_id_put) | **Put** /policy/assignments/{id} |
1513
[**policy_me_get**](DefaultApi.md#policy_me_get) | **Get** /policy/me |
16-
[**policy_me_put**](DefaultApi.md#policy_me_put) | **Put** /policy/me |
14+
[**policy_me_id_put**](DefaultApi.md#policy_me_id_put) | **Put** /policy/me/{id} |
1715
[**policy_profiles_get**](DefaultApi.md#policy_profiles_get) | **Get** /policy/profiles |
1816
[**policy_profiles_id_delete**](DefaultApi.md#policy_profiles_id_delete) | **Delete** /policy/profiles/{id} |
1917
[**policy_profiles_id_get**](DefaultApi.md#policy_profiles_id_get) | **Get** /policy/profiles/{id} |
20-
[**policy_profiles_id_put**](DefaultApi.md#policy_profiles_id_put) | **Put** /policy/profiles/{id} |
2118
[**policy_profiles_post**](DefaultApi.md#policy_profiles_post) | **Post** /policy/profiles |
2219
[**policy_users_get**](DefaultApi.md#policy_users_get) | **Get** /policy/users |
23-
[**revoke_post**](DefaultApi.md#revoke_post) | **Post** /revoke |
24-
[**status_get**](DefaultApi.md#status_get) | **Get** /status |
2520

2621

2722

@@ -50,59 +45,6 @@ No authorization required
5045
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
5146

5247

53-
## elevate_session_post
54-
55-
> elevate_session_post()
56-
57-
58-
### Parameters
59-
60-
This endpoint does not need any parameter.
61-
62-
### Return type
63-
64-
(empty response body)
65-
66-
### Authorization
67-
68-
No authorization required
69-
70-
### HTTP request headers
71-
72-
- **Content-Type**: Not defined
73-
- **Accept**: application/json
74-
75-
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
76-
77-
78-
## elevate_temporary_post
79-
80-
> elevate_temporary_post(elevate_temporary_payload)
81-
82-
83-
### Parameters
84-
85-
86-
Name | Type | Description | Required | Notes
87-
------------- | ------------- | ------------- | ------------- | -------------
88-
**elevate_temporary_payload** | [**ElevateTemporaryPayload**](ElevateTemporaryPayload.md) | | [required] |
89-
90-
### Return type
91-
92-
(empty response body)
93-
94-
### Authorization
95-
96-
No authorization required
97-
98-
### HTTP request headers
99-
100-
- **Content-Type**: application/json
101-
- **Accept**: application/json
102-
103-
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
104-
105-
10648
## launch_post
10749

10850
> models::LaunchResponse launch_post(launch_payload)
@@ -222,7 +164,7 @@ No authorization required
222164

223165
Name | Type | Description | Required | Notes
224166
------------- | ------------- | ------------- | ------------- | -------------
225-
**id** | **uuid::Uuid** | | [required] |
167+
**id** | **i64** | | [required] |
226168
**user** | [**Vec<models::User>**](User.md) | | [required] |
227169

228170
### Return type
@@ -266,17 +208,17 @@ No authorization required
266208
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
267209

268210

269-
## policy_me_put
211+
## policy_me_id_put
270212

271-
> policy_me_put(optional_id)
213+
> policy_me_id_put(id)
272214
273215

274216
### Parameters
275217

276218

277219
Name | Type | Description | Required | Notes
278220
------------- | ------------- | ------------- | ------------- | -------------
279-
**optional_id** | [**OptionalId**](OptionalId.md) | | [required] |
221+
**id** | **i64** | | [required] |
280222

281223
### Return type
282224

@@ -288,15 +230,15 @@ No authorization required
288230

289231
### HTTP request headers
290232

291-
- **Content-Type**: application/json
233+
- **Content-Type**: Not defined
292234
- **Accept**: application/json
293235

294236
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
295237

296238

297239
## policy_profiles_get
298240

299-
> Vec<uuid::Uuid> policy_profiles_get()
241+
> Vec<i64> policy_profiles_get()
300242
301243

302244
### Parameters
@@ -305,7 +247,7 @@ This endpoint does not need any parameter.
305247

306248
### Return type
307249

308-
[**Vec<uuid::Uuid>**](uuid::Uuid.md)
250+
**Vec<i64>**
309251

310252
### Authorization
311253

@@ -329,7 +271,7 @@ No authorization required
329271

330272
Name | Type | Description | Required | Notes
331273
------------- | ------------- | ------------- | ------------- | -------------
332-
**id** | **uuid::Uuid** | | [required] |
274+
**id** | **i64** | | [required] |
333275

334276
### Return type
335277

@@ -357,7 +299,7 @@ No authorization required
357299

358300
Name | Type | Description | Required | Notes
359301
------------- | ------------- | ------------- | ------------- | -------------
360-
**id** | **uuid::Uuid** | | [required] |
302+
**id** | **i64** | | [required] |
361303

362304
### Return type
363305

@@ -375,35 +317,6 @@ No authorization required
375317
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
376318

377319

378-
## policy_profiles_id_put
379-
380-
> policy_profiles_id_put(id, profile)
381-
382-
383-
### Parameters
384-
385-
386-
Name | Type | Description | Required | Notes
387-
------------- | ------------- | ------------- | ------------- | -------------
388-
**id** | **uuid::Uuid** | | [required] |
389-
**profile** | [**Profile**](Profile.md) | | [required] |
390-
391-
### Return type
392-
393-
(empty response body)
394-
395-
### Authorization
396-
397-
No authorization required
398-
399-
### HTTP request headers
400-
401-
- **Content-Type**: application/json
402-
- **Accept**: application/json
403-
404-
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
405-
406-
407320
## policy_profiles_post
408321

409322
> policy_profiles_post(profile)
@@ -456,53 +369,3 @@ No authorization required
456369

457370
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
458371

459-
460-
## revoke_post
461-
462-
> revoke_post()
463-
464-
465-
### Parameters
466-
467-
This endpoint does not need any parameter.
468-
469-
### Return type
470-
471-
(empty response body)
472-
473-
### Authorization
474-
475-
No authorization required
476-
477-
### HTTP request headers
478-
479-
- **Content-Type**: Not defined
480-
- **Accept**: application/json
481-
482-
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
483-
484-
485-
## status_get
486-
487-
> models::StatusResponse status_get()
488-
489-
490-
### Parameters
491-
492-
This endpoint does not need any parameter.
493-
494-
### Return type
495-
496-
[**models::StatusResponse**](StatusResponse.md)
497-
498-
### Authorization
499-
500-
No authorization required
501-
502-
### HTTP request headers
503-
504-
- **Content-Type**: Not defined
505-
- **Accept**: application/json
506-
507-
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
508-

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ElevateTemporaryPayload.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/ElevationConfigurations.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/devolutions-pedm-shared/devolutions-pedm-client-http/docs/GetProfilesMeResponse.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**active** | [**uuid::Uuid**](uuid::Uuid.md) | |
8-
**available** | [**Vec<uuid::Uuid>**](uuid::Uuid.md) | |
7+
**active** | **i64** | |
8+
**available** | **Vec<i64>** | |
99

1010
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1111

0 commit comments

Comments
 (0)