Hi Everyone
See:
http://groups.google.com/group/rhino-tools-dev/browse_thread/thread/f39c54016f6ade58/155e4ab2940bace9#155e4ab2940bace9
I’m trying to update the method in order for it to include nested
entity groups. Right now the query only goes one level/grouping of
entity groups down. Here is the original SQL statement that gets
added to your Select Statement:
(SELECT top 1 this_0_.Allow as y0_
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 (this_0_.[User] = 1 /* @p3 */
or this_0_.UsersGroup in (SELECT
this_0_0_.Id as y0_
FROM
security_UsersGroups this_0_0_
WHERE
this_0_0_.Id in (SELECT this_0_0_0_.Id as y0_
FROM security_UsersGroups this_0_0_0_
left outer join security_UsersToUsersGroups users4_
on this_0_0_0_.Id = users4_.GroupId
left outer join [core_User] user1_
on users4_.UserId = user1_.Id
left outer join security_UsersGroupsHierarchy allchildre6_
on this_0_0_0_.Id = allchildre6_.ParentGroup
left outer join security_UsersGroups child2_
on allchildre6_.ChildGroup = child2_.Id
WHERE (child2_.Id in (SELECT this_0_0_0x0_.Id as y0_
FROM security_UsersGroups this_0_0_0x0_
inner join security_UsersToUsersGroups users3_
on this_0_0_0x0_.Id = users3_.GroupId
inner join [core_User] user1_
on users3_.UserId = user1_.Id
WHERE user1_.Id = 1 /* @p4 */)
or user1_.Id = 1 /* @p5 */))))
and ((this_.SecurityKey =
this_0_.EntitySecurityKey
or this_.SecurityKey =
entitykey3_.EntitySecurityKey)
or (this_0_.EntitySecurityKey is null
and this_0_.EntitiesGroup is null))
and op1_.Name in ('/Organization/View' /* @p7 */,'/
Organization' /* @p8 */)
ORDER BY this_0_.Level desc,
this_0_.Allow asc)
I have been able to get all SecurityKeys in the nested entity groups
using the following statement:
SELECT distinct entitykey3_.EntitySecurityKey
FROM security_EntityGroupsHierarchy allchildre0_
left outer join security_EntitiesGroups entitiesgr1_
on allchildre0_.ChildGroup = entitiesgr1_.Id
left outer join security_EntityReferencesToEntitiesGroups
entities7_
on entitiesgr1_.Id = entities7_.GroupId
left outer join security_EntityReferences entitykey3_
on entities7_.EntityReferenceId = entitykey3_.Id
WHERE allchildre0_.ParentGroup in
((SELECT distinct this_0_.EntitiesGroup
FROM security_Permissions this_0_
WHERE (this_0_.[User] = 1 /* @p3 */
or this_0_.UsersGroup in (SELECT this_0_0_.Id as y0_
FROM security_UsersGroups this_0_0_
WHERE this_0_0_.Id in (SELECT this_0_0_0_.Id
as y0_
FROM security_UsersGroups this_0_0_0_
left outer join
security_UsersToUsersGroups users4_
on this_0_0_0_.Id = users4_.GroupId
left outer join [core_User] user1_
on users4_.UserId = user1_.Id
left outer join
security_UsersGroupsHierarchy allchildre6_
on this_0_0_0_.Id =
allchildre6_.ParentGroup
left outer join security_UsersGroups
child2_
on allchildre6_.ChildGroup = child2_.Id
WHERE (child2_.Id in (SELECT
this_0_0_0x0_.Id as y0_
FROM security_UsersGroups
this_0_0_0x0_
inner join
security_UsersToUsersGroups users3_
on this_0_0_0x0_.Id =
users3_.GroupId
inner join [core_User] user1_
on users3_.UserId = user1_.Id
WHERE user1_.Id = 1 /* @p4 */)
or user1_.Id = 1 /* @p5 */))))))
But now I’m having trouble attaching the rest of the permission
criteria or finding out where it goes.
This:
and ((this_.SecurityKey = this_0_.EntitySecurityKey
or this_.SecurityKey =
entitykey3_.EntitySecurityKey)
or (this_0_.EntitySecurityKey is null
and this_0_.EntitiesGroup is null))
and op1_.Name in ('/Organization/View' /* @p7 */,'/
Organization' /* @p8 */)
ORDER BY this_0_.Level desc,
this_0_.Allow asc)