05 Nov 2009
14 Sep 2012
Link to this post
The SecurityManager.GetCurrentUser() method is obsolete and the SitefinityPrincipal object it returns is deprecated so I'm trying to find a replacement for these methods.
Originally I had this
Guid currentUserRoles = SecurityManager.GetCurrentUser().GetRoleIds();
and it would return 4 guid roles.
I then tried this
User user = UserManager.GetManager().GetUser(Context.User.Identity.Name);
List<Role> rolesForUser = RoleManager.GetManager().GetRolesForUser(user.Id).ToList();
I expected to get 4 roles like the 4 Guids I got before but instead I got 0 roles.
The User object in both attempts return the same user so up to that point it seems to work but the .GetRolesForUser(Guid) doesn't seem to return what I expect.
So my question is am I doing this right or should I convert my old methods to something else? If it matters, I'm using the Administrative user with my testing.