>From what I can see adding permission to a query is only going to down to one level of grouping. It is not traversing the hierarchy. Feel free to submit a patch.
On Apr 15, 6:54 am, patricia <[email protected]> wrote: > no one else has used the entity group hierarchy yet? > > On Apr 12, 2:38 pm, Patricia Vandermeer > > > > <[email protected]> wrote: > > Hello, > > > I've been playing with the new Hierarchy and it looks great! This will > > hopefully really simplify my groups! > > > I've run into a problem with the addPermissionToQuery though! I'm getting > > expected results from the authorizationService.IsAllowed and > > authorizationService.GetAuthoriazationInformation . But when i tried adding > > the permissions to a criteria it doesn't seem to see the permissions from > > the parent entity group so i'm getting 0 results back. > > > Here's a sample bit that illustrates this: > > ----------------------- > > Dim adminUser As New User With {.UserName = "Admin"} > > UnitOfWork.CurrentSession.Save(adminUser) > > > authorizationRepository.CreateUsersGroup("Admins") > > UnitOfWork.Current.TransactionalFlush() > > > authorizationRepository.CreateEntitiesGroup("SomeEntities") > > UnitOfWork.Current.TransactionalFlush() > > > authorizationRepository.CreateChildEntityGroupOf("SomeEntities", > > "SomeChildEntities") > > UnitOfWork.Current.TransactionalFlush() > > > authorizationRepository.CreateOperation("/TestEntity/Edit") > > UnitOfWork.Current.TransactionalFlush() > > > Dim childEntity As New Qualification With {.Name = "Child Entity > > 1"} > > UnitOfWork.CurrentSession.Save(childEntity) > > Dim childEntity2 As New Qualification With {.Name = "Child > > Entity 2"} > > UnitOfWork.CurrentSession.Save(childEntity2) > > > authorizationRepository.AssociateEntityWith(childEntity, > > "SomeChildEntities") > > UnitOfWork.Current.TransactionalFlush() > > > authorizationRepository.AssociateEntityWith(childEntity2, > > "SomeChildEntities") > > UnitOfWork.Current.TransactionalFlush() > > > permissionsBuilderService.Allow("/TestEntity") _ > > .For(adminUser) _ > > .On("SomeEntities") _ > > .DefaultLevel() _ > > .Save() > > > UnitOfWork.Current.TransactionalFlush() > > > Console.WriteLine("{0} can Edit {1} 's Entitles: {2}", > > adminUser.UserName, childEntity.Name, > > authorizationService.IsAllowed(adminUser, childEntity, "/TestEntity/Edit")) > > Console.WriteLine("{0} can Edit {1} 's Entitles: {2}", > > adminUser.UserName, childEntity2.Name, > > authorizationService.IsAllowed(adminUser, childEntity, "/TestEntity/Edit")) > > > Console.WriteLine(authorizationService.GetAuthorizationInformation(adminUse > > r, > > childEntity, "/TestEntity/Edit")) > > > Console.WriteLine(authorizationService.GetAuthorizationInformation(adminUse > > r, > > childEntity2, "/TestEntity/Edit")) > > > Dim theCrit As ICriteria = > > UnitOfWork.CurrentSession.CreateCriteria(GetType(Qualification)) > > authorizationService.AddPermissionsToQuery(adminUser, > > "/TestEntity/Edit", theCrit) > > Dim entities As IList(Of Qualification) = theCrit.List(Of > > Qualification)() > > Console.WriteLine("Number of Qualifications admin can edit:{0}", > > entities.Count.ToString) > > > For Each q In entities > > Console.WriteLine(q.Name) > > Next > > > ------------ > > > Has anyone else had a chance to test this out? Is it working for you? -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en.
