GetUsersInRole error

Posted by Community Admin on 04-Aug-2018 22:49

GetUsersInRole error

All Replies

Posted by Community Admin on 14-Jun-2011 00:00

I can't seem to get the users in a role using the RoleManager.GetUsersInRole method.  I have tried both the default provider as well as the AppRoles provider, and no matter what, if there are users in the role, it gives me this error.  If there are no users it comes back with an empty list as expected.

System.NullReferenceException: Object reference not set to an instance of an object.
   at DynamicModule.ns.Wrapped_OpenAccessRoleProvider_27f3332dd3234177a50e5232730adb47.GetUsersInRole(String roleName, String filterExpression, String sortExpression, Int32 skip, Int32 take)
   at Telerik.Sitefinity.Security.RoleManager.GetUsersInRole(String roleName)

Here's my code:
            var roleMan = RoleManager.GetManager();
            var users = roleMan.GetUsersInRole("Staff");

Matt

Posted by Community Admin on 15-Jun-2011 00:00

Hello Matt,

Thank you for using our services. Can you, please, make sure you've spelled correctly the RoleName when passing it as an argument to the method? I have just tried this functionality and everything seems to work as expected (please take a look at the attached sample video).

Best wishes,
Boyan Barnev
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

Posted by Community Admin on 01-Dec-2011 00:00

Boyan,

I have the same issue. It only occurs when you are logged out of the Sitefinity Admin.

Also - make sure that one of the users in "Custom Role", is also part of the "Administrators" role. So the user belongs to both "Administrators" and "Custom Role"

Thanks,

Chris

This thread is closed