private/mapping/Read-ConfluenceSpacePermission.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function Read-ConfluenceSpacePermission {
    [CmdletBinding()]
    param (
        # User object
        [Parameter(Mandatory,Position=0,ValueFromPipeline)]
        [pscustomobject]
        $Data,

        # The Id of the associated space
        [Parameter(Mandatory,Position=1)]
        [int]
        $SpaceId,

        # Refresh ID
        [Parameter(Mandatory,Position=2)]
        [int]
        $RefreshId
    )
    
    begin {
    }
    
    process {
        $Data.subjects | Read-ConfluenceSpacePermissionSubjects | ForEach-Object { 
            [PSCustomObject]@{
                Permission_Id = [string]$Data.id
                Space_Id = $SpaceId
                Subject_Type = $_.Type
                Subject_Id = $_.Id
                Operation = $Data.operation.operation
                Target_Type = $Data.operation.targetType
                Anonymous_Access = $Data.anonymousAccess
                Unlicensed_Access = $Data.unlicensedAccess
                Refresh_Id = $RefreshId
            }
        }
    }
    
    end {
    }
}