From 79ee2f5d82ae79071f3b0a38c3d946c4c863cd1b Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Sun, 2 Jun 2024 04:28:20 -0700 Subject: [PATCH 01/51] Remove unused code --- src/ui/ManagementPortal/js/api.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ui/ManagementPortal/js/api.ts b/src/ui/ManagementPortal/js/api.ts index e8341a0577..477022dde8 100644 --- a/src/ui/ManagementPortal/js/api.ts +++ b/src/ui/ManagementPortal/js/api.ts @@ -23,8 +23,6 @@ async function wait(milliseconds: number = 1000): Promise { } export default { - mockLoadTime: 1000, - apiVersion: '2024-02-16', apiUrl: null as string | null, setApiUrl(apiUrl: string) { @@ -237,8 +235,6 @@ export default { // App Configuration async getAppConfig(key: string): Promise> { - // await wait(this.mockLoadTime); - // return mockAzureDataLakeDataSource1; const data = await this.fetch( `/instances/${this.instanceId}/providers/FoundationaLLM.Configuration/appConfigurations/${key}?api-version=${this.apiVersion}`, ); @@ -461,11 +457,6 @@ export default { ); }, - async getAgentGatekeepers(): Promise { - await wait(this.mockLoadTime); - return []; - }, - // Prompts async getPrompt(promptId: string): Promise | null> { // Attempt to retrieve the prompt. If it doesn't exist, return an empty object. From 9de5abf8769aa4a6534277feefcf5acb09bfd898 Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Mon, 3 Jun 2024 08:56:55 -0700 Subject: [PATCH 02/51] Rough role assignment list and create/edit --- .../ManagementPortal/components/Sidebar.vue | 1 + src/ui/ManagementPortal/js/api.ts | 29 +- src/ui/ManagementPortal/js/mock.ts | 288 +++++++++++ src/ui/ManagementPortal/js/types.ts | 8 + .../security/role-assignments/create.vue | 464 ++++++++++++++++++ .../edit/[roleAssignmentName].vue | 13 + .../pages/security/role-assignments/index.vue | 210 ++++++++ 7 files changed, 1012 insertions(+), 1 deletion(-) create mode 100644 src/ui/ManagementPortal/pages/security/role-assignments/create.vue create mode 100644 src/ui/ManagementPortal/pages/security/role-assignments/edit/[roleAssignmentName].vue create mode 100644 src/ui/ManagementPortal/pages/security/role-assignments/index.vue diff --git a/src/ui/ManagementPortal/components/Sidebar.vue b/src/ui/ManagementPortal/components/Sidebar.vue index 31c5b1e883..e5dcc14150 100644 --- a/src/ui/ManagementPortal/components/Sidebar.vue +++ b/src/ui/ManagementPortal/components/Sidebar.vue @@ -55,6 +55,7 @@ Security + Role Assignments diff --git a/src/ui/ManagementPortal/js/api.ts b/src/ui/ManagementPortal/js/api.ts index 477022dde8..85e5a0edad 100644 --- a/src/ui/ManagementPortal/js/api.ts +++ b/src/ui/ManagementPortal/js/api.ts @@ -14,9 +14,11 @@ import type { CreatePromptRequest, CreateTextPartitioningProfileRequest, ExternalOrchestrationService, + Role, + RoleAssignment, } from './types'; import { convertToDataSource, convertToAppConfigKeyVault, convertToAppConfig } from '@/js/types'; -// import { mockAzureDataLakeDataSource1 } from './mock'; +import { mockRoles, mockRoleAssignmentsResponse } from './mock'; async function wait(milliseconds: number = 1000): Promise { return await new Promise((resolve) => setTimeout(() => resolve(), milliseconds)); @@ -526,4 +528,29 @@ export default { // Return the updated external orchestration services. return data; }, + + async getRoles(): Roles[] { + await wait(1000); + return mockRoles; + }, + + async getRoleAssignments(): RoleAssignment[] { + await wait(1000); + return mockRoleAssignmentsResponse; + }, + + async getRoleAssignment(roleAssignmentId): RoleAssignment { + await wait(1000); + return mockRoleAssignmentsResponse.role_assignments.find((roleAssignment) => roleAssignment.name === roleAssignmentId); + }, + + async updateRoleAssignment(roleAssignment: RoleAssignment) { + await wait(1000); + return roleAssignment; + }, + + async deleteRoleAssignment(roleAssignmentId): void { + await wait(1000); + return roleAssignmentId; + }, }; diff --git a/src/ui/ManagementPortal/js/mock.ts b/src/ui/ManagementPortal/js/mock.ts index 5f4e6a9f7a..5137e3a0bf 100644 --- a/src/ui/ManagementPortal/js/mock.ts +++ b/src/ui/ManagementPortal/js/mock.ts @@ -118,3 +118,291 @@ export const mockAzureDataLakeDataSource2: AzureDataLakeDataSource = { Endpoint: 'https://solliance.com', }, }; + +export const mockRoles = [ + { + "type": "FoundationaLLM.Authorization/roleDefinitions", + "name": "17ca4b59-3aee-497d-b43b-95dd7d916f99", + "object_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/17ca4b59-3aee-497d-b43b-95dd7d916f99", + "display_name": "Role Based Access Control Administrator", + "description": "Manage access to FoundationaLLM resources by assigning roles using FoundationaLLM RBAC.", + "assignable_scopes": [ + "/" + ], + "permissions": [ + { + "actions": [ + "FoundationaLLM.Authorization/roleAssignments/read", + "FoundationaLLM.Authorization/roleAssignments/write", + "FoundationaLLM.Authorization/roleAssignments/delete" + ], + "not_actions": [], + "data_actions": [], + "not_data_actions": [] + } + ], + "created_on": "2024-03-07T00:00:00.0000000Z", + "updated_on": "2024-03-07T00:00:00.0000000Z", + "created_by": null, + "updated_by": null + }, + { + "type": "FoundationaLLM.Authorization/roleDefinitions", + "name": "00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "object_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "display_name": "Reader", + "description": "View all resources without the possiblity of making any changes.", + "assignable_scopes": [ + "/" + ], + "permissions": [ + { + "actions": [ + "*/read" + ], + "not_actions": [], + "data_actions": [], + "not_data_actions": [] + } + ], + "created_on": "2024-03-07T00:00:00.0000000Z", + "updated_on": "2024-03-07T00:00:00.0000000Z", + "created_by": null, + "updated_by": null + }, + { + "type": "FoundationaLLM.Authorization/roleDefinitions", + "name": "a9f0020f-6e3a-49bf-8d1d-35fd53058edf", + "object_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", + "display_name": "Contributor", + "description": "Full access to manage all resources without the possiblity of assigning roles in FoundationaLLM RBAC.", + "assignable_scopes": [ + "/" + ], + "permissions": [ + { + "actions": [ + "*" + ], + "not_actions": [ + "FoundationaLLM.Authorization/*/write", + "FoundationaLLM.Authorization/*/delete" + ], + "data_actions": [], + "not_data_actions": [] + } + ], + "created_on": "2024-03-07T00:00:00.0000000Z", + "updated_on": "2024-03-07T00:00:00.0000000Z", + "created_by": null, + "updated_by": null + }, + { + "type": "FoundationaLLM.Authorization/roleDefinitions", + "name": "fb8e0fd0-f7e2-4957-89d6-19f44f7d6618", + "object_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/fb8e0fd0-f7e2-4957-89d6-19f44f7d6618", + "display_name": "User Access Administrator", + "description": "Manage access to FoundationaLLM resources.", + "assignable_scopes": [ + "/" + ], + "permissions": [ + { + "actions": [ + "*/read", + "FoundationaLLM.Authorization/*" + ], + "not_actions": [], + "data_actions": [], + "not_data_actions": [] + } + ], + "created_on": "2024-03-07T00:00:00.0000000Z", + "updated_on": "2024-03-07T00:00:00.0000000Z", + "created_by": null, + "updated_by": null + }, + { + "type": "FoundationaLLM.Authorization/roleDefinitions", + "name": "1301f8d4-3bea-4880-945f-315dbd2ddb46", + "object_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/1301f8d4-3bea-4880-945f-315dbd2ddb46", + "display_name": "Owner", + "description": "Full access to manage all resources, including the ability to assign roles in FoundationaLLM RBAC.", + "assignable_scopes": [ + "/" + ], + "permissions": [ + { + "actions": [ + "*" + ], + "not_actions": [], + "data_actions": [], + "not_data_actions": [] + } + ], + "created_on": "2024-03-07T00:00:00.0000000Z", + "updated_on": "2024-03-07T00:00:00.0000000Z", + "created_by": null, + "updated_by": null + } +]; + +export const mockRoleAssignmentsResponse = { + "instance_id": "6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "role_assignments": [ + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "9c04b0-c2a9-4c55-ac8f-09ba13351ab9", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/9c0453b0-c2a9-4c55-ac8f-09ba13351ab9", + "display_name": null, + "description": "Contributor role on the FoundationaLLM instance.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", + "principal_id": "example-fe23ef05-5c5b-4a75-b59d-bba70129ece8", + "principal_type": "Group", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "f11b77-6b2a-4b81-9e75-8b737a6ad81e", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/f11bab77-6b2a-4b81-9e75-8b737a6ad81e", + "display_name": null, + "description": "User Access Administrator role on the FoundationaLLM instance.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/fb8e0fd0-f7e2-4957-89d6-19f44f7d6618", + "principal_id": "example-23413e7f-825a-4abf-a7db-3a0b6bdd166e", + "principal_type": "Group", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "4521b9-1b0e-4ad9-a8cd-75727282cbe7", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/4521bdb9-1b0e-4ad9-a8cd-75727282cbe7", + "display_name": null, + "description": "Role assignment reader for the Management API managed identity.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "principal_id": "example-f8e51522-4291-4471-b029-2649b7311d01", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "597646-7e39-46a0-aced-9c9be832b437", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/59766546-7e39-46a0-aced-9c9be832b437", + "display_name": null, + "description": "Role assignment reader for the Core API managed identity.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "principal_id": "example-d59f73e7-ff08-41bb-881c-fc3c63bdcf30", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "afc3b8-7f91-4968-b6ac-e260a3a7157b", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/afc304b8-7f91-4968-b6ac-e260a3a7157b", + "display_name": null, + "description": "Role assignment reader for the Vectorization API managed identity.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "principal_id": "example-bc7db642-9f96-49c1-b4ee-103d0178f432", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "765716-3624-4feb-bc77-58676e096faf", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/76578e16-3624-4feb-bc77-58676e096faf", + "display_name": null, + "description": "Role assignment reader for the Orchestration API managed identity.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", + "principal_id": "example-f7955eef-283e-438e-840f-5d5b2aa845b8", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "4ff47b-1cd3-49d3-94cd-311ee68e3ac9", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/4ff9547b-1cd3-49d3-94cd-311ee68e3ac9", + "display_name": null, + "description": "Contributor role for Andrei local debug.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", + "principal_id": "example-e66c544b-a150-4135-8198-a80eaa312386", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-03-22T15:33:08.2807765+00:00", + "updated_on": "2024-03-22T15:33:08.2807765+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "ca46b0-f3e9-4d25-bca8-e36d226b80fd", + "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/ca467bb0-f3e9-4d25-bca8-e36d226b80fd", + "display_name": null, + "description": "Brian Local Dev - Contributor role on the FoundationaLLM instance.", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", + "principal_id": "example-2930c230-b255-435a-8ef1-7788d99c2a36", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176", + "cost_center": null, + "created_on": "2024-05-23T14:27:29.5114963+00:00", + "updated_on": "2024-05-23T14:27:29.5114963+00:00", + "created_by": "SYSTEM", + "updated_by": "SYSTEM", + "deleted": false + }, + { + "type": "FoundationaLLM.Authorization/roleAssignments", + "name": "13bd64-d201-4846-9a49-4f8866dd6141", + "object_id": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176/providers/FoundationaLLM.Authorization/roleAssignments/1336bd64-d201-4846-9a49-4f8866dd6141", + "display_name": null, + "description": "Owner role for Joel Hulen", + "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/1301f8d4-3bea-4880-945f-315dbd2ddb46", + "principal_id": "example-dc1f7302-f63e-4f75-a7e8-8984f75a522d", + "principal_type": "User", + "scope": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176/providers/FoundationaLLM.Agent/agents/JoelTest", + "cost_center": null, + "created_on": "0001-01-01T00:00:00+00:00", + "updated_on": "0001-01-01T00:00:00+00:00", + "created_by": null, + "updated_by": null, + "deleted": false + } + ] +}; diff --git a/src/ui/ManagementPortal/js/types.ts b/src/ui/ManagementPortal/js/types.ts index a9e6269779..7d48cd1d89 100644 --- a/src/ui/ManagementPortal/js/types.ts +++ b/src/ui/ManagementPortal/js/types.ts @@ -343,6 +343,14 @@ export type CreateTextPartitioningProfileRequest = ResourceBase & { }; }; +export type Role = { + +}; + +export type RoleAssignment = { + +}; + // Type guards export function isAzureDataLakeDataSource( dataSource: DataSource, diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/create.vue b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue new file mode 100644 index 0000000000..e352baefa0 --- /dev/null +++ b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue @@ -0,0 +1,464 @@ + + + + + diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/edit/[roleAssignmentName].vue b/src/ui/ManagementPortal/pages/security/role-assignments/edit/[roleAssignmentName].vue new file mode 100644 index 0000000000..6817a69c21 --- /dev/null +++ b/src/ui/ManagementPortal/pages/security/role-assignments/edit/[roleAssignmentName].vue @@ -0,0 +1,13 @@ + + + diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue new file mode 100644 index 0000000000..f54fa707fc --- /dev/null +++ b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue @@ -0,0 +1,210 @@ + + + + + From 7aa9c9dc639209f09cb3889675022532784159e0 Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Tue, 4 Jun 2024 06:59:31 -0700 Subject: [PATCH 03/51] Add principal type to role assignment form --- .../security/role-assignments/create.vue | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/create.vue b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue index e352baefa0..84faf8d484 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/create.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue @@ -36,19 +36,31 @@
What principal to assign?
-
- -
+ Date: Tue, 4 Jun 2024 07:03:13 -0700 Subject: [PATCH 04/51] Fill in mock role assignment name fields --- src/ui/ManagementPortal/js/mock.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/ManagementPortal/js/mock.ts b/src/ui/ManagementPortal/js/mock.ts index 5137e3a0bf..a92ecbb606 100644 --- a/src/ui/ManagementPortal/js/mock.ts +++ b/src/ui/ManagementPortal/js/mock.ts @@ -255,7 +255,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "9c04b0-c2a9-4c55-ac8f-09ba13351ab9", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/9c0453b0-c2a9-4c55-ac8f-09ba13351ab9", - "display_name": null, + "display_name": 'Example 1', "description": "Contributor role on the FoundationaLLM instance.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", "principal_id": "example-fe23ef05-5c5b-4a75-b59d-bba70129ece8", @@ -272,7 +272,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "f11b77-6b2a-4b81-9e75-8b737a6ad81e", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/f11bab77-6b2a-4b81-9e75-8b737a6ad81e", - "display_name": null, + "display_name": 'Example 2', "description": "User Access Administrator role on the FoundationaLLM instance.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/fb8e0fd0-f7e2-4957-89d6-19f44f7d6618", "principal_id": "example-23413e7f-825a-4abf-a7db-3a0b6bdd166e", @@ -306,7 +306,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "597646-7e39-46a0-aced-9c9be832b437", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/59766546-7e39-46a0-aced-9c9be832b437", - "display_name": null, + "display_name":'Example 4', "description": "Role assignment reader for the Core API managed identity.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", "principal_id": "example-d59f73e7-ff08-41bb-881c-fc3c63bdcf30", @@ -323,7 +323,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "afc3b8-7f91-4968-b6ac-e260a3a7157b", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/afc304b8-7f91-4968-b6ac-e260a3a7157b", - "display_name": null, + "display_name": 'Example 5', "description": "Role assignment reader for the Vectorization API managed identity.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", "principal_id": "example-bc7db642-9f96-49c1-b4ee-103d0178f432", @@ -340,7 +340,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "765716-3624-4feb-bc77-58676e096faf", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/76578e16-3624-4feb-bc77-58676e096faf", - "display_name": null, + "display_name": 'Example 6', "description": "Role assignment reader for the Orchestration API managed identity.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/00a53e72-f66e-4c03-8f81-7e885fd2eb35", "principal_id": "example-f7955eef-283e-438e-840f-5d5b2aa845b8", @@ -357,7 +357,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "4ff47b-1cd3-49d3-94cd-311ee68e3ac9", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/4ff9547b-1cd3-49d3-94cd-311ee68e3ac9", - "display_name": null, + "display_name": 'Example 7', "description": "Contributor role for Andrei local debug.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", "principal_id": "example-e66c544b-a150-4135-8198-a80eaa312386", @@ -374,7 +374,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "ca46b0-f3e9-4d25-bca8-e36d226b80fd", "object_id": "/providers/FoundationaLLM.Authorization/roleAssignments/ca467bb0-f3e9-4d25-bca8-e36d226b80fd", - "display_name": null, + "display_name": 'Example 8', "description": "Brian Local Dev - Contributor role on the FoundationaLLM instance.", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/a9f0020f-6e3a-49bf-8d1d-35fd53058edf", "principal_id": "example-2930c230-b255-435a-8ef1-7788d99c2a36", @@ -391,7 +391,7 @@ export const mockRoleAssignmentsResponse = { "type": "FoundationaLLM.Authorization/roleAssignments", "name": "13bd64-d201-4846-9a49-4f8866dd6141", "object_id": "/instances/6fa496ce-d5c0-4e02-9223-06a98c9c0176/providers/FoundationaLLM.Authorization/roleAssignments/1336bd64-d201-4846-9a49-4f8866dd6141", - "display_name": null, + "display_name": 'Example 9', "description": "Owner role for Joel Hulen", "role_definition_id": "/providers/FoundationaLLM.Authorization/roleDefinitions/1301f8d4-3bea-4880-945f-315dbd2ddb46", "principal_id": "example-dc1f7302-f63e-4f75-a7e8-8984f75a522d", From d540064f2e5d09fb5a477aede91990b957a1794d Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Tue, 4 Jun 2024 07:03:33 -0700 Subject: [PATCH 05/51] Use name and description on role assignments table --- .../pages/security/role-assignments/index.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue index f54fa707fc..731f199435 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue @@ -39,8 +39,8 @@
Principal type:
Date: Tue, 4 Jun 2024 23:18:43 -0700 Subject: [PATCH 07/51] Add tooltip for role assignment description --- .../pages/security/role-assignments/index.vue | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue index 731f199435..5bf6b84558 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue @@ -42,7 +42,7 @@ field="display_name" header="Name" sortable - style="min-width: 200px" + style="min-width: 120px" :pt="{ headerCell: { style: { backgroundColor: 'var(--primary-color)', color: 'var(--primary-text)' }, @@ -63,7 +63,19 @@ }, sortIcon: { style: { color: 'var(--primary-text)' } }, }" - >
+ > + + From 299ba198b744c4ac126c159d0a2b8e336207b626 Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Tue, 4 Jun 2024 23:20:42 -0700 Subject: [PATCH 08/51] Update text --- .../ManagementPortal/pages/security/role-assignments/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue index 5bf6b84558..478894b678 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue @@ -123,7 +123,7 @@

Do you want to delete the role assignment "{{ roleAssignmentToDelete.name }}" ?

From 8bf89884871a9e22d23af81c3c091092d11b7833 Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Tue, 4 Jun 2024 23:25:54 -0700 Subject: [PATCH 09/51] Adjust column sizing --- .../ManagementPortal/pages/security/role-assignments/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue index 478894b678..8fcda7da08 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/index.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/index.vue @@ -56,7 +56,7 @@ field="description" header="Description" sortable - style="min-width: 200px" + style="min-width: 200px; max-width: 500px;" :pt="{ headerCell: { style: { backgroundColor: 'var(--primary-color)', color: 'var(--primary-text)' }, @@ -222,6 +222,7 @@ export default { .description__column { max-width: 100%; + display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; From 1971c762217f98b2c3ba4693065c10d14100e213 Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 19 Jun 2024 14:22:33 -0400 Subject: [PATCH 10/51] Remove unused form items --- .../security/role-assignments/create.vue | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/ui/ManagementPortal/pages/security/role-assignments/create.vue b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue index f7fe275fad..acb8257339 100644 --- a/src/ui/ManagementPortal/pages/security/role-assignments/create.vue +++ b/src/ui/ManagementPortal/pages/security/role-assignments/create.vue @@ -37,15 +37,7 @@
What principal to assign?
-
Principal type:
- - +
Principal ID:
-
Search by group or type
+
Search by person or group
- -
Would you like to assign this role assignment to a cost center?
-
- -
-
@@ -151,16 +132,6 @@ export default { loading: false as boolean, loadingStatusText: 'Retrieving data...' as string, - principalTypeOptions: [ - { - label: 'User', - value: 'User', - }, - { - label: 'Group', - value: 'Group', - }, - ], openBrowsePrincipalsModal: false, roleOptions: [] as Role[], @@ -202,9 +173,6 @@ export default { async handleCreateRoleAssignment() { const errors: string[] = []; - if (!this.roleAssignment.principal_type) { - errors.push('Please specify a principal type.'); - } if (!this.roleAssignment.principal_id) { errors.push('Please specify a principal.'); From 3df032c688827a89bc62d8eb98ea19abf0dd186b Mon Sep 17 00:00:00 2001 From: joelhulen Date: Fri, 21 Jun 2024 12:39:40 -0400 Subject: [PATCH 11/51] Rename sidebar link --- src/ui/ManagementPortal/components/Sidebar.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/ManagementPortal/components/Sidebar.vue b/src/ui/ManagementPortal/components/Sidebar.vue index e5dcc14150..4219f51a12 100644 --- a/src/ui/ManagementPortal/components/Sidebar.vue +++ b/src/ui/ManagementPortal/components/Sidebar.vue @@ -55,8 +55,7 @@ Security
- Role Assignments - + Instance Access Control
@@ -142,9 +181,10 @@ export default { loading: false as boolean, loadingStatusText: 'Retrieving data...' as string, - openBrowsePrincipalsModal: false, + selectPrincipalDialogOpen: false, roleOptions: [] as Role[], - principalSearchType: null as null | string, + principalSearchType: 'User' as null | string, + principalTypeOptions: ['User', 'Group'], roleAssignment: { description: '', @@ -152,6 +192,14 @@ export default { role_definition_id: null, cost_center: null, } as null | RoleAssignment, + + principal: { + object_type: null, + display_name: '', + }, + dialogPrincipal: null, + users: [], + groups: [], }; }, @@ -166,20 +214,43 @@ export default { this.roleAssignment = await api.getRoleAssignment(this.editId); } - const users = await api.getUsers(); - const user = users.items[0]; + const users = await this.getAllPrinciples(api.getUsers.bind(api)); + this.users = users; + // const user = users[0]; - const groups = await api.getGroups(); - const group = groups.items[0]; + const groups = await this.getAllPrinciples(api.getGroups.bind(api)); + this.groups = groups; + // const group = groups[0]; - const objects = await api.getObjects({ - ids: [user.id, group.id], - }); + // const objects = await api.getObjects({ + // ids: [user.id, group.id], + // }); this.loading = false; }, methods: { + async getAllPrinciples(apiMethod) { + let allPrincipals = []; + let currentPage = 1; + let hasMorePages = true; + while (hasMorePages) { + const usersCurrentPage = await apiMethod({ + page_number: currentPage, + }); + + allPrincipals = [...allPrincipals, ...usersCurrentPage.items]; + + if (usersCurrentPage.has_next_page) { + currentPage += 1; + } else { + hasMorePages = false; + } + } + + return allPrincipals; + }, + handleCancel() { if (!confirm('Are you sure you want to cancel?')) { return; @@ -189,7 +260,10 @@ export default { }, handlePrincipalSelected() { - + this.principal = this.dialogPrincipal; + this.roleAssignment.principal_id = this.dialogPrincipal.id; + this.dialogPrincipal = null; + this.selectPrincipalDialogOpen = false; }, async handleCreateRoleAssignment() { @@ -216,7 +290,7 @@ export default { let successMessage = null as null | string; try { this.loadingStatusText = 'Saving role assignment...'; - await api.updateRoleAssignment(this.roleAssignment); + await api.createRoleAssignment(this.roleAssignment); successMessage = `Role assignment was successfully saved.`; } catch (error) { this.loading = false; From 6f79d57196290d96b42b804ce0eb0a4a40d81b8a Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Tue, 16 Jul 2024 05:00:51 -0700 Subject: [PATCH 29/51] Add access control modal to all agents page --- .../ManagementPortal/pages/agents/public.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ui/ManagementPortal/pages/agents/public.vue b/src/ui/ManagementPortal/pages/agents/public.vue index 523d437ff3..500d9a90a9 100644 --- a/src/ui/ManagementPortal/pages/agents/public.vue +++ b/src/ui/ManagementPortal/pages/agents/public.vue @@ -1,7 +1,21 @@