RoleProviderWrapper Bug

Posted by Community Admin on 04-Aug-2018 21:57

RoleProviderWrapper Bug

All Replies

Posted by Community Admin on 09-Aug-2011 00:00

While trying to find out why the roles for a custom provider is not showing up in the user admin screen (see screenshot2) like it does in the default user provider (see screenshot1).

While debugging the code, I ran across the following code in your RoleProviderWrapper class:

01.public override System.Linq.IQueryable<Role> GetRolesForUser(System.Guid userId)
02.    
03.      string str;
04.      User user = SecurityManager.GetUser(userId, out str);
05.      System.Collections.Generic.List<Role> source = new System.Collections.Generic.List<Role>();
06.      if (user != null)
07.      
08.        string[] rolesForUser = this.roleProvider.GetRolesForUser(user.get_UserName());
09.        for (int i = 0; i < rolesForUser.Length; i = (int) (i + 1))
10.        
11.          string str2 = rolesForUser[i];
12.          Role role = new Role
13.            Name = str2,
14.            Id = this.GetGuidFromStrings(this.Name, str2)
15.          ;
16.        
17.      
18.      return source.AsQueryable<Role>();


Not sure if you see the problem here. It is missing one crucial line of code (line 16 below).

01.public override System.Linq.IQueryable<Role> GetRolesForUser(System.Guid userId)
02.    
03.      string str;
04.      User user = SecurityManager.GetUser(userId, out str);
05.      System.Collections.Generic.List<Role> source = new System.Collections.Generic.List<Role>();
06.      if (user != null)
07.      
08.        string[] rolesForUser = this.roleProvider.GetRolesForUser(user.get_UserName());
09.        for (int i = 0; i < rolesForUser.Length; i = (int) (i + 1))
10.        
11.          string str2 = rolesForUser[i];
12.          Role role = new Role
13.            Name = str2,
14.            Id = this.GetGuidFromStrings(this.Name, str2)
15.          ;
16.          source.Add(role);
17.        
18.      
19.      return source.AsQueryable<Role>();

Posted by Community Admin on 10-Aug-2011 00:00

Hi John Tolar,

This code has been rewritten in the latest version of Sitefinity - 4.2 - that should be released by the end of the week. I just checked that this problem exists in 4.1 SP2 and SP3, which you probably are using at the moment.

Regards,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed