Repository: Altinn/altinn-authentication
Pull request #1252: added foretningsforer hardcoding
Author: login: simen-rekkedal
Created: 2025-04-22T07:56:06Z | Merged: 2025-04-22T11:51:58Z

<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Related Issue(s)
- #{issue number}

## 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.](https://github.com/Altinn/altinn-studio-docs) (if applicable)



Diff:
diff --git a/src/Integration/AccessManagement/AccessManagementClient.cs b/src/Integration/AccessManagement/AccessManagementClient.cs
index 5709aeb29..76b04de74 100644
--- a/src/Integration/AccessManagement/AccessManagementClient.cs
+++ b/src/Integration/AccessManagement/AccessManagementClient.cs
@@ -431,7 +431,7 @@ public async Task<Result<bool>> DeleteSystemUserAssignment(Guid facilitatorId, G
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:regnskapsforer-lonn", "regnskapsforer");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:ansvarlig-revisor", "revisor");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:revisormedarbeider", "revisor");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattegrunnlag", "FFOR");
+        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:forretningsforer-eiendom", "forretningsforer");
 
         hardcodingOfAccessPackageToRole.TryGetValue(accessPackage, out string? found);
         return found;
diff --git a/test/Altinn.Platform.Authentication.Tests/Controllers/SystemUserControllerTest.cs b/test/Altinn.Platform.Authentication.Tests/Controllers/SystemUserControllerTest.cs
index 65ed341da..de2796920 100644
--- a/test/Altinn.Platform.Authentication.Tests/Controllers/SystemUserControllerTest.cs
+++ b/test/Altinn.Platform.Authentication.Tests/Controllers/SystemUserControllerTest.cs
@@ -1024,7 +1024,7 @@ public async Task AgentSystemUser_Get_ListForPartyId_ReturnsEmptyList()
         public async Task AgentSystemUser_Delegate_Post_OK()
         {
             // Create System used for test
-            string dataFileName = "Data/SystemRegister/Json/SystemRegisterWithAccessPackage.json";
+            string dataFileName = "Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json";
             HttpResponseMessage response = await CreateSystemRegister(dataFileName);
 
             HttpClient client = CreateClient();
@@ -1033,7 +1033,7 @@ public async Task AgentSystemUser_Delegate_Post_OK()
 
             AccessPackage accessPackage = new()
             {
-                Urn = "urn:altinn:accesspackage:skattnaering"
+                Urn = "urn:altinn:accesspackage:forretningsforer-eiendom"
 
             };
 
@@ -1269,42 +1269,6 @@ public async Task AgentSystemUser_Delegate_Post_BadRequest()
             Assert.Equal(HttpStatusCode.BadRequest, message.StatusCode);
         }
 
-        // Agent Tests
-        [Fact]
-        public async Task AgentSystemUser_Delegate_Post_NotFound()
-        {
-            // Create System used for test
-            string dataFileName = "Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json";
-            HttpResponseMessage response = await CreateSystemRegister(dataFileName);
-
-            HttpClient client = CreateClient();
-            string token = AddSystemUserRequestWriteTestTokenToClient(client);
-            string endpoint = $"/authentication/api/v1/systemuser/request/vendor/agent";
-
-            AccessPackage accessPackage = new()
-            {
-                Urn = "urn:altinn:accesspackage:regnskapsforer-med-signeringsrettighet"
-
-            };
-
-            // Arrange
-            CreateAgentRequestSystemUser req = new()
-            {
-                ExternalRef = "external",
-                SystemId = "991825827_the_matrix",
-                PartyOrgNo = "910493353",
-                AccessPackages = [accessPackage]
-            };
-
-            HttpRequestMessage request = new(HttpMethod.Post, endpoint)
-            {
-                Content = JsonContent.Create(req)
-            };
-            HttpResponseMessage message = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
-
-            Assert.Equal(HttpStatusCode.NotFound, message.StatusCode);
-        }
-
         [Fact]
         public async Task AgentSystemUser_Get_Delegations_ReturnsListOK()
         {
diff --git a/test/Altinn.Platform.Authentication.Tests/Data/Packages/packages.json b/test/Altinn.Platform.Authentication.Tests/Data/Packages/packages.json
index 6f59c0d06..1c426b8c7 100644
--- a/test/Altinn.Platform.Authentication.Tests/Data/Packages/packages.json
+++ b/test/Altinn.Platform.Authentication.Tests/Data/Packages/packages.json
@@ -68,5 +68,15 @@
     "name": "Toll",
     "description": "Denne tilgangspakken gir fullmakter til tjenester knyttet til toll og fortolling. Ved regelverksendringer eller innføring av nye digitale tjenester kan det bli endringer i tilganger som fullmakten gir.",
     "IsDelegable": true
+  },
+  {
+    "id": "0195efb8-7c80-7cf2-bcc8-720a3fb39d44",
+    "name": "Forretningsforer eiendom",
+    "urn": "urn:altinn:accesspackage:forretningsforer-eiendom",
+    "description": "Denne fullmakten gir forretningsfører for Borettslag og Eierseksjonssameie tilgang til å opptre på vegne av kunde, og utføre alle tjenester som krever denne fullmakten. Dette er tjenester som tjenestetilbyder har vurdert det som naturlig at en forretningsfører utfører på vegne av sin kunde. Fullmakt hos forretningsfører oppstår når Borettslaget eller Eierseksjonssameiet registrerer forretningsfører i Enhetsregisteret. Ved regelverksendringer eller innføring av nye digitale tjenester kan det bli endringer i tilganger som fullmakten gir.",
+    "isDelegable": true,
+    "isAssignable": false,
+    "area": null,
+    "resources": null
   }
 ]
\ No newline at end of file
diff --git a/test/Altinn.Platform.Authentication.Tests/Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json b/test/Altinn.Platform.Authentication.Tests/Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json
index 14af711cf..cd599c75f 100644
--- a/test/Altinn.Platform.Authentication.Tests/Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json
+++ b/test/Altinn.Platform.Authentication.Tests/Data/SystemRegister/Json/SystemRegisterWithAccessPackageAgent.json
@@ -16,7 +16,7 @@
   },
   "accessPackages": [
     {
-      "urn": "urn:altinn:accesspackage:regnskapsforer-med-signeringsrettighet"
+      "urn": "urn:altinn:accesspackage:forretningsforer-eiendom"
     }
   ],
   "rights": [
diff --git a/test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs b/test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs
index 7e67640ea..f1290fbf4 100644
--- a/test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs
+++ b/test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs
@@ -145,8 +145,7 @@ public async Task<Result<List<AgentDelegationResponse>>> DelegateCustomerToAgent
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:regnskapsforer-lonn", "REGN");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:ansvarlig-revisor", "REVI");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:revisormedarbeider", "REVI");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattegrunnlag", "FFOR");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattnaering", "FFOR");
+        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:forretningsforer-eiendom", "forretningsforer");
 
         hardcodingOfAccessPackageToRole.TryGetValue(accessPackage, out string? found);        
         return found;   


Reviews:
user: login: acn-dgopa
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-22T11:30:02Z
user: login: acn-dgopa
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-22T11:31:12Z
user: login: simen-rekkedal
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T11:51:43Z

Review comments:
diff_hunk: @@ -145,8 +145,7 @@ public async Task<Result<List<AgentDelegationResponse>>> DelegateCustomerToAgent
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:regnskapsforer-lonn", "REGN");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:ansvarlig-revisor", "REVI");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:revisormedarbeider", "REVI");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattegrunnlag", "FFOR");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattnaering", "FFOR");
+        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:forretningsforer-eiendom", "FFOR");
path: test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs
user: login: acn-dgopa
body: this is not consistent with the hardcoding, "FFOR" must be uodated
created_at: 2025-04-22T11:30:02Z
author_association: MEMBER
diff_hunk: @@ -145,8 +145,7 @@ public async Task<Result<List<AgentDelegationResponse>>> DelegateCustomerToAgent
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:regnskapsforer-lonn", "REGN");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:ansvarlig-revisor", "REVI");
         hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:revisormedarbeider", "REVI");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattegrunnlag", "FFOR");
-        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:skattnaering", "FFOR");
+        hardcodingOfAccessPackageToRole.Add("urn:altinn:accesspackage:forretningsforer-eiendom", "FFOR");
path: test/Altinn.Platform.Authentication.Tests/Mocks/AccessManagementClientMock.cs
user: login: simen-rekkedal
body: ok, fixed
created_at: 2025-04-22T11:51:43Z
author_association: CONTRIBUTOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-04-22T11:54:12Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=Altinn_altinn-authentication&pullRequest=1252) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=Altinn_altinn-authentication&pullRequest=1252&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=Altinn_altinn-authentication&pullRequest=1252&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=Altinn_altinn-authentication&pullRequest=1252&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=Altinn_altinn-authentication&pullRequest=1252&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=Altinn_altinn-authentication&pullRequest=1252&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Altinn_altinn-authentication&pullRequest=1252)


author_association: NONE