Developer forum
E-mail notifications
Folder and files permission in frontend
Replies
Hi. Permissions in file manager works only for backend users.
You can't apply these permissions in file publishing,
We plan to implement this functionality.
Tanks fore your reply.
Is there some way in the API check the users permission to a given folder or file?
Hi.
To check permission you can use next code:
' get current user ID
Dim UserID As Integer = Base.ChkNumber(Session("DW_Admin_UserID"))
'get user’s groups
Dim arrUserGroups As String = Join(CType(Session("DW_Admin_Group"), String()), ",")
'get folders where the user has access
Dim strAllAccessableFolders As String = Base.GetUserElementAccess("folder", UserID & "," & arrUserGroups, "")
'split folder to array
Dim arrAccessFolderList() As String = Split(strAllAccessableFolders, ",")
'get all folders with limited access
Dim strAllRestrictedFolders As String = Base.GetAccessElements("folder")
'split folder to array
Dim arrAllRestrictedFolders() As String = Split(strAllRestrictedFolders, ",")
'check does current user has access to the folder
If IsArray(arrAccessFolderList) Then
If Base.IsValueInArray(arrAllRestrictedFolders, dirName) Then
If Not Base.IsValueInArray(arrAccessFolderList, dirName) Then
Return False
End If
End If
End If
Return True
You can check only folders access. Files permissions are not supported.
Hope it will help you.
Is the above code any different from using the following methods in the API?
/Morten
Method "HasAccessToFile" handles access to files inside "Security folder". Read for details: http://manual.dynamicweb-cms.com/Default.aspx?ID=1518
You must be logged in to post in the forum