//OK public override bool IsUserInRole(string username, string rolename) { bool userIsInRole = false; try { var ad = new ADAuthenticationHelper(this.domain, this.contextUsername, this.contextPassword); var list = ad.GetUsersInGroup(rolename, true, username); //return PrincipalOperationException #87 with some roles //see http://support.microsoft.com/kb/2585635 if (list.Count > 0) userIsInRole = true; } catch (Exception e) { throw new ProviderException("IsUserInRole(string, string) error in " + providerName, e); } return userIsInRole; }
//OK public override string[] GetUsersInRole(string rolename) { string[] res = null; try { var ad = new ADAuthenticationHelper(this.domain, this.contextUsername, this.contextPassword); var list = ad.GetUsersInGroup(rolename, false); if (list.Count == 0) res = new string[0]; else res = list.ToArray(); } catch (Exception e) { throw new ProviderException("GetUsersInRole() error in " + providerName, e); } return res; }