コード例 #1
0
 //OK
 public override string[] GetAllRoles()
 {
     string[] res = null;
     try
     {
         var ad = new ADAuthenticationHelper(this.domain, this.contextUsername, this.contextPassword);
         var groups = ad.GetAllGroups();
         if (groups.Count == 0)
             res = new string[0];
         else
             res = groups.ToArray();
     }
     catch (Exception e)
     {
         throw new ProviderException("GetAllRoles() error in "+ providerName , e);
     }
     return res;
 }
コード例 #2
0
 //OK
 public override bool RoleExists(string rolename)
 {
     bool exists = false;
     try
     {
         var ad = new ADAuthenticationHelper(this.domain, this.contextUsername, this.contextPassword);
         var list = ad.GetAllGroups(rolename);
         if (list.Count > 0)
             exists = true;
     }
     catch (Exception e)
     {
         throw new ProviderException("RoleExists(string) error in SidRoleProvider", e);
     }
     return exists;
 }