public IEnumerable <string> GetRoles() { //FOR WINDOWS AUTHENTICATION.... var UseActiveDirectory = System.Configuration.ConfigurationManager.AppSettings["UseActiveDirectory"]; //CommonFunction.Instance.UseActiveDirectory(); if (Convert.ToBoolean(UseActiveDirectory)) { //var adl = new ActiveDirectoryLookup(this.Identity); //return adl.GetRoles(); var UseActiveDirectoryRole = System.Configuration.ConfigurationManager.AppSettings["UseActiveDirectoryRole"]; if (Convert.ToBoolean(UseActiveDirectoryRole)) { var adl = new ActiveDirectoryLookup(this.Identity); return(adl.GetRoles()); } else { var DomainName = System.Configuration.ConfigurationManager.AppSettings["DomainName"]; CustomRoleProvider RoleProvider = new CustomRoleProvider(); string usrname = this.Name.Replace(DomainName.ToUpper() + "\\", "").Trim(); return(RoleProvider.GetRolesForUser(usrname)); } } else { CustomRoleProvider RoleProvider = new CustomRoleProvider(); return(RoleProvider.GetRolesForUser(((IIdentity)this.Identity).Name)); } }
public IEnumerable <string> GetRoles() { CustomRoleProvider RoleProvider = new CustomRoleProvider(); return(RoleProvider.GetRolesForUser(this.Name)); }