Function to get User Permissions by Felix Heinrich

There are plenty of requests from Developers trying to get the permissions of the current User in the Digital Dashboard. This can be easily achieved with this simple script. The script returns only a number:

4 = Coordinator
3 = Author
2 = Reader
1 = No Permissions

Simply set the URL of the Folder you want test for User permissions in the following script:

Function getContent(node)
Dim iUserRole
Dim sLogonUser
Dim sDomainName
Dim iSlash
Dim sServerName
Dim sWorkspaceName
Dim blnIsFolder

    ' Enter Name of your Server

sServerName = "yourServerName"

   ' Enter Name of your Workspace and Folder / File
            ' where you want to check user permissions

sWorkspaceName = "yourWorkspaceName"

' If you specified a single file in sWorkspace,
       ' then blnIsFolder is FALSE

blnIsFolder = TRUE

      sLogonUser = Factory.Variables.Item("LOGON_USER")
      iSlash = InStr(sLogonUser, "\")

     If NOT iSlash = 0 Then
           sDomainName = Left(sLogonUser, iSlash - 1)
           sLogonUser = Mid(sLogonUser, iSlash + 1)
      End If

      iUserRole = AccessRights("http://" & sServerName & _
            "/" & sWorkspaceName , blnIsFolder)
      getContent = iUserRole & " " & sLogonUser & " " & _
             sDomainName

End Function

Download text file containing this code.