Esempio n. 1
0
 public override void Put(PackageEntry entry)
 {
     this._skipAll = (bool)typeof(Sitecore.Install.Security.AccountInstaller).GetField("_skipAll", BindingFlags.Instance | BindingFlags.NonPublic).GetValue((object)this);
     if (this._skipAll)
     {
         return;
     }
     string[] strArray = entry.Key.Split('/');
     if (strArray[0] != "security")
     {
         return;
     }
     if (!AccountInstaller.ContextUserHasEnoughRights())
     {
         JobContext.Alert(Translate.Text("You do not have enough permissions to install security accounts"));
         this._skipAll = true;
     }
     else if (strArray.Length < 3)
     {
         Log.Error(string.Format("Bad entry key '{0}'", (object)entry.Key), (object)this);
     }
     else
     {
         if (strArray.Length > 3)
         {
             string domainName = strArray[2];
             if (!DomainManager.DomainExists(domainName))
             {
                 this.UIEvents.ShowWarning(string.Format(Translate.Text("Unable to create the user '{0}' because domain '{1}' doesn't exist."), (object)AccountInstaller.GetAccountName(entry.Key), (object)domainName), "domain doesn't exist" + domainName);
                 return;
             }
         }
         string str = strArray[1];
         try
         {
             if (str == "users")
             {
                 this.InstallUser(entry);
             }
             else if (str == "roles")
             {
                 this.InstallRole(entry);
             }
             else
             {
                 Log.Error(string.Format("Unexpected account type '{0}'", (object)entry.Key), (object)this);
             }
         }
         catch (ThreadAbortException)
         {
             throw;
         }
         catch (Exception ex)
         {
             Log.Error(string.Format("Error installing entry '{0}'", (object)entry.Key), ex, (object)this);
         }
     }
 }