Creating new Access Control

Hey All,

I’m trying to create a script that creates Role, Tag and Access control for the tag. I’m able to create role and tag no problem but I’m not able to create the access control. there are the scripts I’m trying

#To create a new role
New-PSURole -Name "Testing" -Description "Testing the script" -Policy {
param(
[Security.ClaimsPrincipal]$User
)
        
<# 
  Policies should return $true or $false to determine whether the user has the particular 
  claim that require them for that role.
#>
$user.HasClaim('Role','user')

$false
} -Roles @('User')

#create a new tag
New-PSUTag -Name "Testing" -Description "Testing the script"

#creating access control This doesn't work
$Type = ([PowerShellUniversal.AccessControlType]::Edit -bor [PowerShellUniversal.AccessControlType]::View)
New-PSUAccessControl -Role 'Testing' -Tag 'Testing' -Type $Type

#also tried this and this doesn' work either
New-PSUAccessControl -Role "Testing" -Type "View, Edit, Create, Delete, Execute" -Tag "Testing"

Both of these scripts get the same error
The method or operation is not implemented.

Product: PowerShell Universal
Version: 4.2.2

where do you run these scripts?

I have the same issue.

New-PSUAccessControl only works inside AccessControls.ps1
It doesnt create new Access Control Rules, instead it returns whatever stuff is expected to be returned from accessControls.ps1

When I played with this a year ago Dynamically add Roles and Tags? - PowerShell Universal - Ironman Software Forums

I found that for the most part, you have to append your code to the Configuration file.
like take this:

#creating access control This doesn't work
$Type = ([PowerShellUniversal.AccessControlType]::Edit -bor [PowerShellUniversal.AccessControlType]::View)
New-PSUAccessControl -Role 'Testing' -Tag 'Testing' -Type $Type

and throw it into accessControls.ps1

It’s not pretty, doesnt validate very well.