I have a collection with directories and subdirectories. I need to list directories that the current user are allowed to see.
'directories:
Dim group As GroupEntity
Dim directories As DirectoryCollection
Dim allDirectories As New DirectoryCollection
For Each group In currentUser.GroupCollectionViaUsers
directories = New DirectoryCollection
directories.GetMultiManyToManyUsingGroupCollectionViaAttributes(group)
allDirectories.AddRange(directories)
Next
Repeater1.DataSource = allDirectories
Repeater1.DataBind()
now, the result of this is that all directories is returned. even all sub directories.
To solve this I tried the following code which returns the parent directories. :
Dim selectFilter As IPredicateExpression = New PredicateExpression(New FieldCompareNullPredicate(DirectoryFields.ParentId))
directories.GetMulti(selectFilter)
Repeater1.DataSource = directories
Repeater1.DataBind()
the problem here is that directories that the current user are not allowed to see are returned.
How can I combine these two?