예제 #1
0
 /// <summary>
 /// Method to provision a member into the Simias system.
 /// The actual provisioning is handled by the registered
 /// provider.
 /// </summary>
 public static Simias.Host.HostInfo ProvisionUser(string Username)
 {
     if (callout != null)
     {
         string HostId = null;
         Simias.Host.HostInfo hinfo = null;
         logger.Debug("Provsioning user {0}", Username);
         if (Simias.Service.Manager.LdapServiceEnabled == false)
         {
             HostId = callout(Username);
         }
         else
         {
             HostId = callout(Username);
             if (HostId == null)
             {
                 logger.Debug("AttributeProvisionUserProvider Failed to provision: {0} {1}",
                              Username, "Calling LoadBalanceProvisionUserProvider for provisioning");
                 LoadBalanceProvisionUserProvider userProvider =
                     new LoadBalanceProvisionUserProvider();
                 HostId = userProvider.ProvisionUser(Username);
             }
         }
         Store    store  = Store.GetStore();
         Domain   domain = store.GetDomain(store.DefaultDomain);
         HostNode hNode  = HostNode.GetHostByID(domain.ID, HostId);
         hinfo = new Simias.Host.HostInfo(hNode);
         return(hinfo);
     }
     else
     {
         logger.Debug("Provisioning user {0} using the default algorithm", Username);
         return(defaultProvisionUser(Username));
     }
 }
예제 #2
0
        public HostInfo[] GetHosts()
        {
            HostInfo[] infoList;
            HostNode[] hosts = HostNode.GetHosts(hostDomain.ID);
            if (hosts.Length > 0)
            {
                infoList = new HostInfo[hosts.Length];
                int i = 0;
                foreach (HostNode hn in hosts)
                {
                    infoList[i++] = new HostInfo(hn);
                }
            }
            else
            {
                infoList = new HostInfo[0];
            }

            return(infoList);
        }
예제 #3
0
        public HostInformation GetHomeServer(string Username)
        {
            Member member = GetDomainMemberByName(Username);

            if (member != null)
            {
                HostNode host = member.HomeServer;
                if (host != null)
                {
                    return(new HostInformation(host));
                }

                // Call the provision service to provision this
                // user to a host
                HostInfo info = ProvisionService.ProvisionUser(Username);
                if (info != null)
                {
                    return(new HostInformation(info));
                }
            }

            return(null);
        }