It has yet to be fixed. If you'd like to submit a patch and a pull request I will happily merge it.
On Mon, Mar 7, 2011 at 5:44 PM, RickB <[email protected]> wrote: > Does anyone know if this issue has been fixed? > > Thank you, > > Rick > > On Feb 25, 12:14 am, vandalo <[email protected]> wrote: >> Thanks David, >> >> Alberto >> >> On Feb 23, 11:58 pm, David Archer <[email protected]> wrote: >> >> >> >> > It's a known issue -- Google it and you'll see others are having the >> > same problem. I'm not experienced enough with NH to know what the root >> > cause is here. :( >> >> > I have however just submitted a pull request on Github to Ayende with >> > a failing unit test illustrating the problem. >> >> >https://github.com/ayende/rhino-security/pull/8 >> >> > -- David Archer >> >> > On Feb 15, 11:14 am, vandalo <[email protected]> wrote: >> >> > > I am pretty sure that this question has been asked many times but I >> > > haven't been able to find an answer yet. >> > > DetachUserFromGroup and/or AssociateUserWith members of >> > > AuthorizationRepository don't seem to invalidate the second-level >> > > cache. >> > > I've tried to investigate more but my knowledge of Nhibernate is too >> > > poor at the moment to find a proper solution. >> > > I've downloaded Rhino-Security from >> > > here:https://github.com/ayende/rhino-security >> > > and extended AuthorizationServiceWithSecondLevelCacheFixture. >> >> > > The DatabaseFixture basically creates a user, 3 groups and associate >> > > the user with all the groups: >> >> > > user = new User { Name = "Ayende" }; >> >> > > session.Save(user); >> >> > > authorizationService = >> > > ServiceLocator.Current.GetInstance<IAuthorizationService>(); >> > > permissionService = >> > > ServiceLocator.Current.GetInstance<IPermissionsService>(); >> > > permissionsBuilderService = >> > > ServiceLocator.Current.GetInstance<IPermissionsBuilderService>(); >> > > authorizationRepository = >> > > ServiceLocator.Current.GetInstance<IAuthorizationRepository>(); >> >> > > authorizationRepository.CreateUsersGroup("Administrators"); >> > > authorizationRepository.CreateUsersGroup("Users"); >> > > authorizationRepository.CreateUsersGroup("Guests"); >> >> > > authorizationRepository.AssociateUserWith(user, "Administrators"); >> > > authorizationRepository.AssociateUserWith(user, "Users"); >> > > authorizationRepository.AssociateUserWith(user, "Guests"); >> >> > > I've added this fixture >> >> > > [Fact] >> > > public void Test_Associated_Users_Group_For() >> > > { >> >> > > session.Flush(); >> > > session.Transaction.Commit(); >> > > session.Dispose(); >> >> > > using (var s2 = factory.OpenSession()) >> > > { >> > > using (var tx = s2.BeginTransaction()) >> > > { >> > > SillyContainer.SessionProvider = () => s2; >> >> > > var User = s2.CreateCriteria<User>() >> > > .Add(Restrictions.Eq("Name", "Ayende")) >> > > .UniqueResult<User>(); >> >> > > var anotherAuthorizationRepository = >> > > ServiceLocator.Current.GetInstance<IAuthorizationRepository>(); >> >> > > var Groups = >> > > anotherAuthorizationRepository.GetAssociatedUsersGroupFor(User); >> >> > > anotherAuthorizationRepository.DetachUserFromGroup(User, >> > > "Guests"); >> >> > > s2.Flush(); >> > > tx.Commit(); >> > > } >> > > } >> > > using (var s3 = factory.OpenSession()) >> > > { >> > > using (var tx = s3.BeginTransaction()) >> > > { >> > > SillyContainer.SessionProvider = () => s3; >> >> > > var User = s3.CreateCriteria<User>() >> > > .Add(Restrictions.Eq("Name", "Ayende")) >> > > .UniqueResult<User>(); >> >> > > var anotherAuthorizationRepository = >> > > ServiceLocator.Current.GetInstance<IAuthorizationRepository>(); >> > > var Groups = >> > > anotherAuthorizationRepository.GetAssociatedUsersGroupFor(User); >> >> > > tx.Commit(); >> > > } >> > > } >> >> > > } >> >> > > The 2nd session detaches the user from the group Guests but the 3rd >> > > session still fetches 3 groups associated with the user. >> > > It seems that the second-level cache can't be invalidated. >> > > Is there anyone who can help me?- Hide quoted text - >> >> - Show quoted text - > > -- > 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. > > -- 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.
