Skip to content

Feature/instansdelegering api put and delete#2522

Open
howieandersen wants to merge 9 commits intomainfrom
feature/instansdelegering_api_put_and_delete
Open

Feature/instansdelegering api put and delete#2522
howieandersen wants to merge 9 commits intomainfrom
feature/instansdelegering_api_put_and_delete

Conversation

@howieandersen
Copy link
Contributor

Description

Adding functionality for instance delegation to Enduser API ConnectionsController with the following new endpoints:

Related Issue(s)

To be merged in this PR:

  • PUT /connections/resources/instances/rights - Update instance right delegation
  • DELETE /connections/resources/instances - Remove instance delegation

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

instance-level delegations with filtering by party, resource, and instance.

Key changes:
- Add InstanceIds and IncludeInstances properties to ConnectionQueryFilter
- Create ConnectionQueryInstance model for instance query results
- Add Instances collection to ConnectionQueryExtendedRecord
- Implement LoadInstancesByKeyAsync joining with AssignmentInstance table
- Add ResourceId filtering to scope instances to specific resources
- Implement GetResourceInstances service method in ConnectionService
- Add MapConnectionsToInstancePermissions helper for DTO mapping
- Implement GetInstances controller endpoint with validation

Uses existing AssignmentInstance table as the data source for instance
delegations, following the pattern of Connection view for querying.
…ailed

permission breakdown for direct and indirect access paths.

Key changes:
- Add GetInstanceRightsToOthers/FromOthers methods to IConnectionService
- Implement GetInstanceRights query method in ConnectionService
- Create AssignmentInstanceQueryResult model for instance delegation queries
- Query AssignmentInstance table with Direct, KeyRole, and Hierarchy patterns
- Add GetInstanceRights controller endpoint with all required parameters
- Return ExtInstanceRightDto with DirectRights and IndirectRights arrays
- Follow established patterns from GET /resources/rights endpoint

Queries support filtering by party relationships and handle access through
key roles and entity hierarchy as per acceptance criteria.
…elegations

Implements endpoint for delegating rights to specific instances using InstanceRight
and InstanceRule models with URN types for isolated instance authorization.
Implements delegation check for instance-specific rights. Returns which rights the authenticated user can delegate to others for a given instance.

- Added InstanceCheckDto response model with Resource, Instance, and Rights
- Added InstanceDelegationCheck method to IConnectionService/ConnectionService
- Activated CheckInstance controller endpoint with required party, resource, and instance parameters
- Reuses existing delegation check logic for packages, roles, resources, and access lists
Implements update (replace) operation for instance-specific rights delegation.
Unlike POST which adds rules, PUT replaces all existing rules with new ones.

- Added UpdateInstance method to IConnectionService/ConnectionService
- Calls InstanceDelegationCheck for instance-specific validation
- Uses TryWriteInstanceDelegationPolicyRules with ignoreExistingPolicy: true
- Activated UpdateInstanceRights controller endpoint with required parameters
Implements deletion of instance-specific rights delegations. Removes only
direct delegations between parties for a specific instance, leaving
inherited delegations via key roles intact.

- Added RemoveInstance method to IConnectionService/ConnectionService
- Clears policy rules before removing AssignmentInstances record
- Fixed route to DELETE /resources/instances (was incorrectly /resources)
- All parameters (party, from, to, resource, instance) are required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant