Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > How to selectnodes that have requires authentication set to false or inherits with a parent set to false View modes: 
User avatar
Certified Developer v6
Certified Developer v6
hoppe - 7/26/2012 3:15:31 PM
   
How to selectnodes that have requires authentication set to false or inherits with a parent set to false
I have a number of documents that have a mix of values set for requires authentication. Is there an easy way to select those that have requires authentication set to
1) false
or
2) inherits and a parent somewhere up the tree that is set to false

The code below only selects case 1.

If it is set to inherits, do I need to loop through each node's parents to see which has a value specified? That could be expensive...


// Create an instance of the Tree provider
var tree = new TreeProvider(CMSContext.CurrentUser);
// Set the parameters for getting documents
var siteName = CMSContext.CurrentSiteName;
const string aliasPath = "/%";
var culture = SettingsKeyProvider.GetStringValue(CMSContext.CurrentSiteName
+ ".CMSDefaultCultureCode");

// Get data set with documents
using (DataSet documents = tree.SelectNodes(siteName, aliasPath, culture, true, null, "[IsSecuredNode] = 1"))
{

}


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/28/2012 6:11:24 AM
   
RE:How to selectnodes that have requires authentication set to false or inherits with a parent set to false
Hello,


yes, you would need to loop the node's parents. The node property: NodeParentId stores a node id of the current parent.


Best regards,
Helena Grulichova

User avatar
Certified Developer v6
Certified Developer v6
hoppe - 7/30/2012 8:04:52 AM
   
RE:How to selectnodes that have requires authentication set to false or inherits with a parent set to false
Okay thanks