I use the Rhino.Security repository to manage my users / roles.
The process of creating, deleting, and merging works fine, but before calling, I try to execute one method: GetAssociatedUsersGroupFor.
The first time I call a method, I have no groups for my user, I have not created any association yet. At this point, I associate the user with several groups.
I check the DB and I see the association.
Now I call GetAssociatedUsersGroupFor again, but I cannot get any groups.
With the profiler, I saw that the database is not involved this time. I checked the code and I found that the function uses the Nhibernate SetCacheable:
public virtual UsersGroup[] GetAssociatedUsersGroupFor(IUser user)
{
ICollection<UsersGroup> usersGroups =
SecurityCriterions.AllGroups(user)
.GetExecutableCriteria(session)
.AddOrder(Order.Asc("Name"))
.SetCacheable(true)
.List<UsersGroup>();
return usersGroups.ToArray();
}
Rhino.Security, , - .
UPDATE:
:
AuthorizationRepository.GetAssociatedUsersGroupFor(User);
:
AuthorizationRepository.AssociateUserWith(User, grpName);
:
AuthorizationRepository.DetachUserFromGroup(User, groupToRemove.Name);
UPDATE
, :
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
, , , , , .
-, , ?