Custom Role with Access Control

Product: PowerShell Universal
Version: 3.6.2

Today I spun up an entirely new installation (3.6.2), configured it with an entirely new AzureAD tenant, and experienced the same issue I’ve been troubleshooting in my primary server so it appears to be an issue out of the box. This issue is what is currently preventing me from purchasing a license as this functionality is the foundation of how I would use the product, so I’m hoping it’s a simple bug fix or something I’m missing.

I am using OIDC via AzureAD and group claims to assign a custom role. Claims all appear to be mapping correctly based on group objectID, role assigns properly, etc. however the AccessControl types available appear to fail to grant enough access to run a script. For example, if the AccessControl is set to grant “View,Execute” to a single script then the user IS able to see that script and sees a “Run” button next to that script. However, pressing the Run button results in the following error every time: “TypeError: o.map is not a function”

Conversely, if I set one of the built-in roles to be assigned using the same AzureAD group, it behaves as that role is expected to. There appears to be something missing with the way custom roles are created that prevent the form that lists parameters, etc. at runtime to display.

Current AccessControl: New-PSUAccessControl -Role “Helpdesk” -ObjectId “Testing Parameters.ps1” -ObjectType “Script” -Type “View, Execute”

Seems like a bug to me. I’ll take a look.

Can you share your param block? I can’t reproduce this at the moment.

Yep, entire “Testing Parameters.ps1” script is below:

param (
[string]$User,
[string]$EmployeeID,
[string]$Testing
)

Write-Host “User: $User”
Write-Host “EmployeeID: $EmployeeID”
Write-Host “Testing: $Testing”

1 Like

I’m still striking out. Can you do me a favor and check in the dev tools when this happens?

1 - Reproduce the issue
2 - Press F12 and navigate to the Console tab
3 - Right click on the console and click save as.

image

It should provide a little bit better idea of why this is happening.

Sure, here you go. I didn’t have a test account in my AzureAD tenant so I re-enabled Form login with the default admin account, assigned a new custom role to a script via an Access Control and the issue occurs in this scenario as well; so may not be related to OIDC/AzureAD at all. Full contents of console from dev tools:

i18next.js:27 i18next: languageChanged en-US
i18next.js:27 i18next: initialized Object
Utils.ts:188 [2022-12-23T22:36:01.915Z] Information: Normalizing '/notificationhub' to 'https://psu/notificationhub'.
Utils.ts:192 [2022-12-23T22:36:01.916Z] Debug: Starting HubConnection.
Utils.ts:192 [2022-12-23T22:36:01.916Z] Debug: Starting connection with transfer format 'Text'.
Utils.ts:192 [2022-12-23T22:36:01.916Z] Debug: Sending negotiation request: https://psu/notificationhub/negotiate?negotiateVersion=1.
index.tsx:54 
        
       Insertion point 'inject-styles-here' does not exist. Be sure to add comment on head and that it matches the insertionPoint
(anonymous) @ index.tsx:54
index.tsx:54 
        
       Insertion point 'inject-styles-here' does not exist. Be sure to add comment on head and that it matches the insertionPoint
(anonymous) @ index.tsx:54
index.tsx:54 
        
       Insertion point 'inject-styles-here' does not exist. Be sure to add comment on head and that it matches the insertionPoint
(anonymous) @ index.tsx:54
Utils.ts:192 [2022-12-23T22:36:01.929Z] Debug: Selecting transport 'WebSockets'.
Utils.ts:188 [2022-12-23T22:36:01.955Z] Information: WebSocket connected to wss://psu/notificationhub?id=G32vRHCOf-yiw-B8yuI6Dg.
Utils.ts:192 [2022-12-23T22:36:01.955Z] Debug: The HttpConnection connected successfully.
Utils.ts:192 [2022-12-23T22:36:01.955Z] Debug: Sending handshake request.
Utils.ts:188 [2022-12-23T22:36:01.955Z] Information: Using HubProtocol 'json'.
Utils.ts:192 [2022-12-23T22:36:01.961Z] Debug: Server handshake complete.
Utils.ts:192 [2022-12-23T22:36:01.961Z] Debug: HubConnection connected successfully.
useConnection.tsx:183 connection e
react-dom.production.min.js:216 
        
       TypeError: o.map is not a function
    at k (scriptParameters.tsx:42:37)
    at ro (react-dom.production.min.js:157:137)
    at qc (react-dom.production.min.js:267:460)
    at kl (react-dom.production.min.js:250:347)
    at El (react-dom.production.min.js:250:278)
    at Cl (react-dom.production.min.js:250:138)
    at ml (react-dom.production.min.js:243:163)
    at react-dom.production.min.js:123:115
    at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at Wa (react-dom.production.min.js:122:325)
cc @ react-dom.production.min.js:216

Perfect. Thank you! I see the issue. We’ll get this patched in 3.6.3.

1 Like

@adam Confirmed fixed in 3.6.3. Thanks!!

1 Like