Hi,
I am using DNN 9.6
I have 5 custom user roles. I need to check if the currently logged-in user is in those custom user roles. And display the user role name. We consider one user has only one custom user role at a time. The user can be within one of user roles or not. We need to avoid the default DNN user roles. We have defined what are the custom user roles. Ex: custRole1 custRole2 custRole3 custRole4 custRole5
Please, can you help me to write this code in C# in a custom module or in a skin object?
I really appreciate your support.
Thank you!
I recommend you jumping into GitHub (https://github.com/DNNCommunity) and creating a Pull Request (or maybe a new Issue) and you can mention that you're willing to support the programmer's time and perhaps you can get someone to help you out building this custom module.
If you have access to the UserInfo object for the user account, you can use the IsInRole() method.
https://github.com/Upendo...curityService.cs#L32
We have an example theme that could give you some starters for your code:
https://github.com/40fing...work-Attributes-Demo
The Theme is (still) in VB, but I guess you'll get the point. I added a Role filter example:
https://github.com/40fing...s-Security.ascx#L132
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.