From d2d351c9f76182e6a48a72bf293bbec974eeef8b Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Fri, 13 Jun 2025 14:42:37 -0700 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20rdp=20target=20ty?= =?UTF-8?q?pe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 16 +++++++++++++++- addons/api/tests/unit/models/target-test.js | 18 +++++++++++++++++- addons/core/translations/resources/en-us.yaml | 2 ++ .../components/form/target/details/index.js | 1 + ui/admin/config/features.js | 1 + .../scopes/scope/targets/index-test.js | 7 ++++++- .../scope/projects/targets/index-test.js | 7 ++++++- 7 files changed, 48 insertions(+), 4 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 7b6472e72..cf9fb6725 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -9,7 +9,13 @@ import { service } from '@ember/service'; export const TYPE_TARGET_TCP = 'tcp'; export const TYPE_TARGET_SSH = 'ssh'; -export const TYPES_TARGET = Object.freeze([TYPE_TARGET_TCP, TYPE_TARGET_SSH]); +export const TYPE_TARGET_RDP = 'rdp'; + +export const TYPES_TARGET = Object.freeze([ + TYPE_TARGET_TCP, + TYPE_TARGET_SSH, + TYPE_TARGET_RDP, +]); export default class TargetModel extends GeneratedTargetModel { // =services @@ -347,4 +353,12 @@ export default class TargetModel extends GeneratedTargetModel { get isSSH() { return this.type === TYPE_TARGET_SSH; } + + /** + * True if the target type is rdp. + * @type {boolean} + */ + get isRDP() { + return this.type === TYPE_TARGET_RDP; + } } diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index fbe724f27..f625f4c72 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -6,7 +6,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target'; +import { + TYPE_TARGET_TCP, + TYPE_TARGET_SSH, + TYPE_TARGET_RDP, +} from 'api/models/target'; module('Unit | Model | target', function (hooks) { setupTest(hooks); @@ -386,6 +390,7 @@ module('Unit | Model | target', function (hooks) { }); assert.true(modelSSH.isSSH); assert.false(modelSSH.isTCP); + assert.false(modelSSH.isRDP); }); test('it has isTCP property and returns the expected values', function (assert) { @@ -395,5 +400,16 @@ module('Unit | Model | target', function (hooks) { }); assert.true(modelTCP.isTCP); assert.false(modelTCP.isSSH); + assert.false(modelTCP.isRDP); + }); + + test('it has isRDP property and returns the expected values', function (assert) { + const store = this.owner.lookup('service:store'); + const modelRDP = store.createRecord('target', { + type: TYPE_TARGET_RDP, + }); + assert.true(modelRDP.isRDP); + assert.false(modelRDP.isSSH); + assert.false(modelRDP.isTCP); }); }); diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index ddb5f76be..b6f70b277 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -728,9 +728,11 @@ target: types: tcp: Generic TCP ssh: SSH + rdp: RDP help: tcp: Generic TCP supports a broad range of connection types. ssh: Protocol-aware SSH with support for credential injection. + rdp: Remote Desktop Protocol for Windows servers. filter: active-sessions: yes: Has active sessions diff --git a/ui/admin/app/components/form/target/details/index.js b/ui/admin/app/components/form/target/details/index.js index 340f236d9..24f6620d6 100644 --- a/ui/admin/app/components/form/target/details/index.js +++ b/ui/admin/app/components/form/target/details/index.js @@ -12,6 +12,7 @@ const types = [...TYPES_TARGET].reverse(); const icons = { ssh: 'terminal-screen', tcp: 'network', + rdp: 'monitor', }; export default class FormTargetComponent extends Component { // =services diff --git a/ui/admin/config/features.js b/ui/admin/config/features.js index ec71d8f63..247e7947e 100644 --- a/ui/admin/config/features.js +++ b/ui/admin/config/features.js @@ -14,6 +14,7 @@ const licensedFeatures = { 'multi-hop-sessions': false, 'ssh-target': false, 'ssh-session-recording': false, + 'rdp-target': false, }; // Base edition declares available features, disabled by default. const baseEdition = { diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js index 7783c72dc..676cb36d2 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js @@ -10,7 +10,11 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import { setupSqlite } from 'api/test-support/helpers/sqlite'; import { setupIntl } from 'ember-intl/test-support'; import { authenticateSession } from 'ember-simple-auth/test-support'; -import { TYPE_TARGET_SSH, TYPE_TARGET_TCP } from 'api/models/target'; +import { + TYPE_TARGET_TCP, + TYPE_TARGET_SSH, + TYPE_TARGET_RDP, +} from 'api/models/target'; module('Unit | Controller | scopes/scope/targets/index', function (hooks) { setupTest(hooks); @@ -99,6 +103,7 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) { assert.deepEqual(controller.targetTypeOptions, [ { id: TYPE_TARGET_TCP, name: 'Generic TCP' }, { id: TYPE_TARGET_SSH, name: 'SSH' }, + { id: TYPE_TARGET_RDP, name: 'RDP' }, ]); }); diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js index b7f0ee229..312791648 100644 --- a/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js +++ b/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js @@ -15,7 +15,11 @@ import { STATUS_SESSION_PENDING, STATUS_SESSION_CANCELING, } from 'api/models/session'; -import { TYPE_TARGET_SSH, TYPE_TARGET_TCP } from 'api/models/target'; +import { + TYPE_TARGET_SSH, + TYPE_TARGET_TCP, + TYPE_TARGET_RDP, +} from 'api/models/target'; module( 'Unit | Controller | scopes/scope/projects/targets/index', @@ -167,6 +171,7 @@ module( assert.deepEqual(controller.targetTypeOptions, [ { id: TYPE_TARGET_TCP, name: 'Generic TCP' }, { id: TYPE_TARGET_SSH, name: 'SSH' }, + { id: TYPE_TARGET_RDP, name: 'RDP' }, ]); });