コード例 #1
0
 public void RemoveEnterprise(int enterpriseId)
 {
     using (AdministrationServiceClient proxy = new AdministrationServiceClient())
     {
         proxy.RemoveEnterprise(enterpriseId);
     }
 }
コード例 #2
0
 public void CreateEnterpise(string enterpriseTitle, int federalSubjectId, string mail)
 {
     using (AdministrationServiceClient proxy = new AdministrationServiceClient())
     {
         proxy.CreateEnterprise(enterpriseTitle, federalSubjectId, mail);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: bisand/IISAdmin
        private static void Main(string[] args)
        {
            Console.WriteLine("Running tests against a remote service...");
            Console.WriteLine("");

            var proxy = new AdministrationServiceClient();
            if (proxy.ClientCredentials != null)
            {
                proxy.ClientCredentials.UserName.UserName = "******";
                proxy.ClientCredentials.UserName.Password = "******";
            }

            var simpleRandom = DateTime.Now.Millisecond;
            var username = string.Format("testUser{0}", simpleRandom);
            const string password = "******";
            var fqdn = string.Format("testuser{0}.com", simpleRandom);
            var fqdn2 = string.Format("www.testuser{0}.com", simpleRandom);

            // Test to see if we could add a new user.
            var addUser = proxy.AddUser(username, password, fqdn);
            if (addUser)
                Console.WriteLine("Successfully created user: {0}", username);

            // Test to see if we could reset permissions on home directory.
            var resetPermissions = proxy.ResetPermissions(username);
            if (resetPermissions)
                Console.WriteLine("Successfully reset permissions for user: {0}", username);

            // Test to see if we could add a new host on IIS.
            var addHost = proxy.AddHost(username, fqdn2);
            if (addHost)
                Console.WriteLine("Successfully added host: {0} for user: {1}", fqdn2, username);

            // Test to see if we could delete the newly created host from IIS.
            var delHost = proxy.DelHost(username, fqdn);
            if (delHost)
                Console.WriteLine("Successfully deleted host: {0} for user: {1}", fqdn, username);

            // Test to see if we could delete the newly created user from Windows.
            var delUser = proxy.DelUser(username);
            if (delUser)
                Console.WriteLine("Successfully deleted user: {0}", username);

            Console.WriteLine("");
            Console.WriteLine("Press enter to continue...");
            Console.ReadLine();
        }
コード例 #4
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Security.CsStrategieSecurite security = new Security.CsStrategieSecurite();
                //Utility.ParseObject<Security.CsStrategieSecurite, ServiceAuthenInitialize.CsStrategieSecurite>(security, SessionObject.securiteActive);

                security.ACTIF = SessionObject.securiteActive.ACTIF;
                security.CHIFFREMENTREVERSIBLEPASSWORD = SessionObject.securiteActive.CHIFFREMENTREVERSIBLEPASSWORD;
                security.DUREEMAXIMALEPASSWORD         = SessionObject.securiteActive.DUREEMAXIMALEPASSWORD;
                security.DUREEMINIMALEPASSWORD         = SessionObject.securiteActive.DUREEMINIMALEPASSWORD;
                security.DUREEVEUILLESESSION           = SessionObject.securiteActive.DUREEVEUILLESESSION;
                security.DUREEVERROUILLAGECOMPTE       = SessionObject.securiteActive.DUREEVERROUILLAGECOMPTE;
                security.HISTORIQUENOMBREPASSWORD      = SessionObject.securiteActive.HISTORIQUENOMBREPASSWORD;
                security.LIBELLE = SessionObject.securiteActive.LIBELLE;
                security.LONGUEURMINIMALEPASSWORD                     = SessionObject.securiteActive.LONGUEURMINIMALEPASSWORD;
                security.NEPASCONTENIRNOMCOMPTE                       = SessionObject.securiteActive.NEPASCONTENIRNOMCOMPTE;
                security.NOMBREMAXIMALECHECSOUVERTURESESSION          = SessionObject.securiteActive.NOMBREMAXIMALECHECSOUVERTURESESSION;
                security.NOMBREMINIMALCARACTERESCHIFFRES              = SessionObject.securiteActive.NOMBREMINIMALCARACTERESCHIFFRES;
                security.NOMBREMINIMALCARACTERESMAJUSCULES            = SessionObject.securiteActive.NOMBREMINIMALCARACTERESMAJUSCULES;
                security.NOMBREMINIMALCARACTERENONALPHABETIQUES       = SessionObject.securiteActive.NOMBREMINIMALCARACTERENONALPHABETIQUES;
                security.PK_IDSTRATEGIESECURITE                       = SessionObject.securiteActive.PK_IDSTRATEGIESECURITE;
                security.REINITIALISERCOMPTEURVERROUILLAGECOMPTEAPRES = SessionObject.securiteActive.REINITIALISERCOMPTEURVERROUILLAGECOMPTEAPRES;
                security.TOUCHEVERROUILLAGESESSION                    = SessionObject.securiteActive.TOUCHEVERROUILLAGESESSION;



                Security.CsUtilisateur user = new Security.CsUtilisateur();

                user.PK_ID                            = userSelected.PK_ID;
                user.BRANCHE                          = userSelected.BRANCHE;
                user.DATECREATION                     = userSelected.DATECREATION;
                user.DATEDEBUTVALIDITE                = userSelected.DATEDEBUTVALIDITE;
                user.DATEDERNIERECONNEXION            = userSelected.DATEDERNIERECONNEXION;
                user.DATEDERNIEREMODIFICATION         = userSelected.DATEDERNIEREMODIFICATION;
                user.DATEDERNIEREMODIFICATIONPASSWORD = userSelected.DATEDERNIEREMODIFICATIONPASSWORD;
                user.DATEDERNIERVERROUILLAGE          = userSelected.DATEDERNIERVERROUILLAGE;
                user.DATEFINVALIDITE                  = userSelected.DATEFINVALIDITE;
                user.DERNIERECONNEXIONREUSSIE         = userSelected.DERNIERECONNEXIONREUSSIE;
                user.LIBELLE                          = userSelected.LIBELLE;
                user.ESTSUPPRIMER                     = userSelected.ESTSUPPRIMER;
                user.E_MAIL                           = userSelected.E_MAIL;
                user.EsADMIN                          = userSelected.EsADMIN;
                user.CENTRE                           = userSelected.CENTRE;
                user.FONCTION                         = userSelected.FONCTION;
                user.INITUSERPASSWORD                 = userSelected.INITUSERPASSWORD;
                user.LIBELLEFONCTION                  = userSelected.LIBELLEFONCTION;
                user.LOGINNAME                        = userSelected.LOGINNAME;
                user.NOMBREECHECSOUVERTURESESSION     = userSelected.NOMBREECHECSOUVERTURESESSION;
                user.USERCREATION                     = userSelected.USERCREATION;
                user.PASSE                            = userSelected.PASSE;
                user.PERIMETREACTION                  = userSelected.PERIMETREACTION;
                user.MATRICULE                        = userSelected.MATRICULE;
                //user.Prenoms = userSelected.Prenoms;
                //user.RoleDisplayName = userSelected.RO;
                //user.RoleID = userSelected.RoleID;
                user.LIBELLESTATUSCOMPTE = userSelected.LIBELLESTATUSCOMPTE;
                user.PK_ID       = userSelected.PK_ID;
                user.FK_IDSTATUS = userSelected.FK_IDSTATUS;


                //Utility.ParseObject(user, userSelected);

                bool isToUpate = Security.Securities.ChangePassword(user, security, user.PASSE, txt_new.Password, txt_confirm.Password, TenirCompteAncienPwd);
                if (isToUpate)
                {
                    // var admUser = Utility.ParseObject(new CsUtilisateur(),user);

                    ServiceAdministration.CsUtilisateur admUser = new ServiceAdministration.CsUtilisateur();
                    admUser.DATEDERNIEREMODIFICATIONPASSWORD = DateTime.Now; // userSelected.DateDerniereModificationPassword;
                    admUser.PK_ID                    = user.PK_ID;
                    admUser.BRANCHE                  = user.BRANCHE;
                    admUser.DATECREATION             = user.DATECREATION;
                    admUser.DATEDEBUTVALIDITE        = user.DATEDEBUTVALIDITE;
                    admUser.DATEDERNIERECONNEXION    = user.DATEDERNIERECONNEXION;
                    admUser.DATEDERNIEREMODIFICATION = user.DATEDERNIEREMODIFICATION;
                    //admUser.DateDerniereModificationPassword = user.DateDerniereModificationPassword;
                    admUser.DATEDERNIERVERROUILLAGE  = user.DATEDERNIERVERROUILLAGE;
                    admUser.DATEFINVALIDITE          = user.DATEFINVALIDITE;
                    admUser.DERNIERECONNEXIONREUSSIE = user.DERNIERECONNEXIONREUSSIE;
                    admUser.LIBELLE                      = user.LIBELLE;
                    admUser.ESTSUPPRIMER                 = user.ESTSUPPRIMER;
                    admUser.E_MAIL                       = user.E_MAIL;
                    admUser.EsADMIN                      = user.EsADMIN;
                    admUser.CENTRE                       = user.CENTRE;
                    admUser.FONCTION                     = user.FONCTION;
                    admUser.INITUSERPASSWORD             = false;
                    admUser.LIBELLEFONCTION              = user.LIBELLEFONCTION;
                    admUser.LOGINNAME                    = user.LOGINNAME;
                    admUser.NOMBREECHECSOUVERTURESESSION = user.NOMBREECHECSOUVERTURESESSION;
                    admUser.USERCREATION                 = user.USERCREATION;
                    admUser.PASSE               = user.PASSE;
                    admUser.PERIMETREACTION     = user.PERIMETREACTION;
                    admUser.MATRICULE           = user.MATRICULE;
                    admUser.LIBELLESTATUSCOMPTE = user.LIBELLESTATUSCOMPTE;
                    admUser.PK_ID               = user.PK_ID;
                    admUser.FK_IDCENTRE         = userSelected.FK_IDCENTRE;
                    admUser.FK_IDFONCTION       = userSelected.FK_IDFONCTION;
                    admUser.FK_IDSTATUS         = userSelected.FK_IDSTATUS;


                    AdministrationServiceClient adm = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

                    adm.UpdateUserCompleted += (updates, resultupt) =>
                    {
                        if (resultupt.Cancelled || resultupt.Error != null)
                        {
                            string error = resultupt.Error.Message;
                            Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }

                        if (resultupt.Result == false)
                        {
                            Message.ShowInformation(Galatee.Silverlight.Resources.Langue.updateError, Galatee.Silverlight.Resources.Langue.errorTitle);
                            IsPasswordChange = false;
                            return;
                        }
                        else
                        {
                            var ws = new MessageBoxControl.MessageBoxChildWindow("", Galatee.Silverlight.Resources.Langue.ConfirmationModifMotDePasse, MessageBoxControl.MessageBoxButtons.Ok, MessageBoxControl.MessageBoxIcon.Question);

                            IsPasswordChange       = true;
                            ws.OnMessageBoxClosed += (l, results) =>
                            {
                                if (ws.Result == MessageBoxResult.OK)
                                {
                                    //ObtenirDonneesConnection( Unuser);
                                    this.DialogResult = true;
                                }
                            };
                            ws.Show();
                        }
                    };
                    adm.UpdateUserAsync(admUser, true);
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
コード例 #5
0
 public override void Setup()
 {
     base.Setup();
     CreateAndAuthenticateTestAdminAccount().Wait();
     _sut = new AdministrationServiceClient(BaseUrl, SessionId, new DummyPackageInfo(), null);
 }
コード例 #6
0
        public void RetourneListeAllUser()
        {
            try
            {
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.Protocole(), Utility.EndPoint("Administration"));
                client.RetourneListeAllUserCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        return;
                    }

                    List <Galatee.Silverlight.ServiceAccueil.CsCentre> lstCentreProfil = Shared.ClasseMEthodeGenerique.RetourCentreByPerimetre(SessionObject.LstCentre, UserConnecte.listeProfilUser);
                    List <int> lstCentreHabil = new List <int>();
                    foreach (var item in lstCentreProfil)
                    {
                        lstCentreHabil.Add(item.PK_ID);
                    }
                    List <CsUtilisateur> _lstUserProfil = res.Result.Where(t => lstCentreHabil.Contains(t.FK_IDCENTRE)).ToList();
                    donnesDatagrid = _lstUserProfil;

                    var listeTemp = (from t in donnesDatagrid
                                     select new
                    {
                        t.PK_ID,
                        t.CENTREAFFICHER,
                        t.CENTRE,
                        t.MATRICULE,
                        t.LOGINNAME,
                        t.LIBELLE,
                        t.LIBELLESTATUSCOMPTE,
                        t.LIBELLEPERIMETREACTION
                    }).Distinct().ToList();
                    List <CsUtilisateur> LstUser = new List <CsUtilisateur>();
                    foreach (var t in listeTemp)
                    {
                        CsUtilisateur user = new CsUtilisateur();
                        user.PK_ID                  = t.PK_ID;
                        user.CENTREAFFICHER         = t.CENTREAFFICHER;
                        user.CENTRE                 = t.CENTRE;
                        user.MATRICULE              = t.MATRICULE;
                        user.LOGINNAME              = t.LOGINNAME;
                        user.LIBELLE                = t.LIBELLE;
                        user.LIBELLESTATUSCOMPTE    = t.LIBELLESTATUSCOMPTE;
                        user.LIBELLEPERIMETREACTION = t.LIBELLEPERIMETREACTION;
                        LstUser.Add(user);
                    }
                    cbo_utilisateurGestionnaire.SelectedValue     = "PK_ID";
                    cbo_utilisateurGestionnaire.DisplayMemberPath = "LIBELLE";
                    cbo_utilisateurGestionnaire.ItemsSource       = LstUser;
                };
                client.RetourneListeAllUserAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }