Hello Again, I think i have found a bug in the authorizationService.AddPermissionsToQuery! It seems to be mixing up the sql parameters! Here is the bit of code that is generating the error:
Dim criteria As ICriteria = UnitOfWork.CurrentSession.CreateCriteria(GetType(CustomField)) authorizationService.AddPermissionsToQuery(OrgTwoAdmin, "/Entity/Edit", criteria) Dim cfs As IList(Of CustomField) = criteria.List(Of CustomField)() and here is the sql it is generating (From Nhibernate Profiler) I've bolded the trouble spots. It seems like p0 is being re-used when it shouldn't be. If I just shift every parameter up one space the query executes fine and returns the expected results! there is a p5 that isn't used at all in the query. so that reinforces my theory. It SHOULD be like this: *WHERE op1_.Name in (**'/Entity'** /* @p2 */,'/Entity/Edit' /* @p1 */) and (this_0_.[User] =8 /* @p3 */* SELECT this_.Id as Id10_0_, this_.Name as Name10_0_, this_.Type as Type10_0_, this_.SecurityKey as Security4_10_0_, this_.AgencyId as AgencyId10_0_ FROM CustomField this_ WHERE 1 /* @p0 */ = (SELECT TOP 1 y0_ FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__ DESC, __hibernate_sort_expr_1__) as row, query.y0_, query.__hibernate_sort_expr_0__, query.__hibernate_sort_expr_1__ FROM (SELECT this_0_.Allow as y0_, this_0_.Level as __hibernate_sort_expr_0__, this_0_.Allow as __hibernate_sort_expr_1__ FROM security_Permissions this_0_ inner join security_Operations op1_ on this_0_.Operation = op1_.Id left outer join security_EntitiesGroups entitygrou2_ on this_0_.EntitiesGroup = entitygrou2_.Id left outer join security_EntityReferencesToEntitiesGroups entities7_ on entitygrou2_.Id = entities7_.GroupId left outer join security_EntityReferences entitykey3_ on entities7_.EntityReferenceId = entitykey3_.Id * WHERE op1_.Name in (1 /* @p0 */,'/Entity/Edit' /* @p1 */) and (this_0_.[User] = '/Entity' /* @p2 */* or this_0_.UsersGroup in (SELECT this_0_0_.Id as y0_ FROM security_UsersGroups this_0_0_ left outer join security_UsersToUsersGroups users4_ on this_0_0_.Id = users4_.GroupId left outer join Users user1_ on users4_.UserId = user1_.Id left outer join security_UsersGroupsHierarchy allchildre6_ on this_0_0_.Id = allchildre6_.ParentGroup left outer join security_UsersGroups child2_ on allchildre6_.ChildGroup = child2_.Id WHERE (child2_.Id in (SELECT this_0_0_0_.Id as y0_ FROM security_UsersGroups this_0_0_0_ inner join security_UsersToUsersGroups users3_ on this_0_0_0_.Id = users3_.GroupId inner join Users user1_ on users3_.UserId = user1_.Id WHERE user1_.Id = 8 /* @p3 */) or user1_.Id = 8 /* @p4 */))) and ((this_.SecurityKey = this_0_.EntitySecurityKey or this_.SecurityKey = entitykey3_.EntitySecurityKey) or (this_0_.EntitySecurityKey is null and this_0_.EntitiesGroup is null))) query) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__ DESC, __hibernate_sort_expr_1__) I'm not sure what other information you need to track this down, or what i'm doing wrong if this is something on my end! Any input would be appreciated! -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to rhino-tools-...@googlegroups.com. To unsubscribe from this group, send email to rhino-tools-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en.