DotNetnuke: Is user an admin / administrator
Categories: DotNetNuke, Blog |
Author:
David O'Leary |
Posted:
11/7/2007 |
Views:
8471
DotNetNuke makes it easy to determine if the currently logged in user is an administrator (aka admin) or any other role for that matter. All you need to do is call the following: PortalSecurity.IsInRole("Administrators") or PortalSecurity.IsInRole("MyRoleName"). This function should return the boolean value very quickly as everything it needs is already in memory. You can call this from either the code behind or the ascx file (e.g. Visible='<%#PortalSecurity.IsInRole("Administrators")%>').
This can be very useful for determining whether or not to show a control or content meant only for the right groups eyes.