Exemplo n.º 1
0
        public override CommandExecutionResult Execute()
        {
            var ctx       = new AdministrationDbContext();
            var rmsSystem = ctx.GetSystemInstance();
            var sysAdmin  = rmsSystem.FindIdentity("sys_admin");

            if (Password != null)
            {
                if (string.IsNullOrWhiteSpace(Password))
                {
                    return(CommandExecutionResult.Fail("Password cannot be blank"));
                }

                sysAdmin.SetPassword(Password);
            }

            if (Enable)
            {
                sysAdmin.MakeActive();
            }

            if (Disable)
            {
                sysAdmin.MakeActive(false);
            }

            ctx.SaveChanges();


            return(CommandExecutionResult.Ok());
        }
Exemplo n.º 2
0
        public override CommandExecutionResult Execute()
        {
            var svc = new ConfigurationEncryptionService();

            if (!string.IsNullOrWhiteSpace(PathToExe))
            {
                return(svc.EncryptConfigurationSection(PathToExe, ConfigurationEncryptionService.ConnectionStringsSectionName, Provider));
            }

            if (!string.IsNullOrWhiteSpace(WebSite))
            {
                return(CommandExecutionResult.Fail("Web Configurations are not currently supported.  Please use aspnet_regiis.exe instead."));
            }

            return(CommandExecutionResult.NoOp());
        }