How to Use confluence class api such as ContentPermissionmanager api in User macro

Hi Team ,

I’m developing a user macro where i need to display user who have edit access on the page .

I have tried below template code in macro



the contentPermissionManager gives you access to the page permissions


Users with edit Permission

##iterate over all view contentpermissionssets
#foreach( $contentPermissionSet in $contentPermissionManager.getContentPermissionSets($content,“EDIT”) )

#foreach( $contentPermission in $contentPermissionSet )   
    ##is the current permission a user permission
    #if($contentPermission.isUserPermission() )
        ##if yes print the name
        <h1> $contentPermission.userName </h1>



So i have checked above code it’s not even entering the for loop . Please give me any macro code which uses contentPermissionManager which works in your instance .

So i will try to use it and make it work .

One more thing my confluence has collabrative editing enable , I think its not related anyway but just want to mention .

Please its somewhat critical to me but help me .

Thanks & Regards,