" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi
In DotNetNuke there is a UserInfo class which provides methods by which we can validate if the current login user is having admin/ host or any other role access.
UserInfo class is present within DotNetNuke.Entities.Modules.PortalModuleBase namespace. By default Custom module class inherits the PortalModuleBase class as shown below:
partial class ViewModuleName : PortalModuleBase, IActionable
So we can use methods of UserInfo within our custom module.
//To check current login user having host access
//To check current login user having admin access
In above example PortalSettings.AdministratorRoleName will return admin role name
Then above methods will return Boolean value i.e, true or false.
To validate with any other custom security/user roles, we can keep those roles in a string variable separated with “;” and check as above example.
Mail (will not be published) (required)
Enter Captcha Code *
− one = 8
Burn Ignorance is a knowledge initiative by Mindfire Solutions
Subscribe to our mailing list to get the updates to your email inbox...