public static CouchDbViews GetViews() { var views = new Dictionary <string, Dictionary <string, string> > { { "byname", new Dictionary <string, string> { { "map", "function(doc) { if (doc._id.indexOf('permission:') !== -1) emit(doc.Grain+doc.SecurableItem+doc.Name, doc) }" }, } }, { "bysecitem", new Dictionary <string, string> { { "map", "function(doc) { if (doc._id.indexOf('permission:') !== -1) emit(doc.Grain+doc.SecurableItem, doc) }" }, } } }; var couchViews = new CouchDbViews { id = "permissions", views = views }; return(couchViews); }
public static CouchDbViews GetViews() { var views = new Dictionary <string, Dictionary <string, string> > { { "byname", // Stores all roles by gain+secitem+name for easy retrieval. new Dictionary <string, string> { { "map", "function(doc) { if (doc._id.indexOf('role:') !== -1) emit(doc.Grain+doc.SecurableItem+doc.Name, doc); }" }, } }, { "bysecitem", // Stores all roles by gain+secitem for easy retrieval. new Dictionary <string, string> { { "map", "function(doc) { if (doc._id.indexOf('role:') !== -1) emit(doc.Grain+doc.SecurableItem, doc); }" }, } } }; var couchViews = new CouchDbViews { id = "roles", views = views }; return(couchViews); }