Пример #1
0
        public Task Upgrade(IVersionContext versionContext)
        {
            var userFormStandard = new StandardComponent
            {
                Id          = "5d615e501773a96ee8eb5ed3",
                Name        = "userform",
                DisplayName = "User Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.OneColumn,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "id",
                        Order   = 0,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "id"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "username",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Label,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Username"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a username"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "!!queryparams.id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "username"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "email",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Email,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Email"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a email"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "email"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a email"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Email,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a correct email format"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "isConfirmedEmail",
                        Order   = 3,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Checkbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Confirmed Email"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "isConfirmedEmail"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "isLockoutEnabled",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Checkbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Lockout Enabled"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "isLockoutEnabled"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "lockoutEndDate",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Label,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Lockout End Date"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "lockoutEndDate"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "roles",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.AutoComplete,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Roles"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "roles"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "multiple",
                                Value = "true"
                            }
                        },
                        DatasourceOptions = new Portal.Entities.Shared.DatasourceOptions
                        {
                            Type            = Portal.Entities.Shared.DatasourceControlType.Database,
                            DatabaseOptions = new Portal.Entities.Shared.DatabaseOptions
                            {
                                DatabaseConnectionId = Constants.IdentityDatabaseId,
                                EntityName           = "roles",
                                Query = versionContext.ConnectionType == Core.Persistences.ConnectionType.MongoDB ?
                                        "{\r\n  \"$query\": {\r\n    \"roles\": [\r\n      {\r\n        \"$project\": {\r\n          \"name\": \"$displayName\",\r\n          \"value\": \"$name\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                : (versionContext.ConnectionType == Core.Persistences.ConnectionType.MySQL ? "Select `displayName` as name, name as value from `roles`" : "Select \"displayName\" as name, name as value from roles")
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please select at least one role",
                                ValidatorOption  = ""
                            }
                        }
                    }
                }
            };

            var registerNewUserFormStandard = new StandardComponent
            {
                Id          = "5d6222ec3aae6a79ecf035e9",
                Name        = "registerForm",
                DisplayName = "Register Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.OneColumn,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "username",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Username"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a username"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "username"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a username"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Please enter only characters and numberic",
                                ValidatorOption  = "[A-Za-z0-9]*"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 50 characters",
                                ValidatorOption  = "50"
                            }
                        },
                        AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator>
                        {
                            new Portal.Entities.Components.Controls.PageControlAsyncValidator
                            {
                                ValidatorName         = "uniquename",
                                IsActive              = true,
                                ValidatorMessage      = "This username is already existed. Please choose another name.",
                                AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions
                                {
                                    EvaluatedExpression = "response.result == null",
                                    DatabaseOptions     = new Portal.Entities.Shared.DatabaseOptions
                                    {
                                        DatabaseConnectionId = Constants.IdentityDatabaseId,
                                        Query = "{\r\n  \"$query\": {\r\n    \"users\": [\r\n      {\r\n        \"$match\": {\r\n          \"username\": \"{{data.username}}\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                    },
                                    ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator
                                }
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "password",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Password,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "password"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a password"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Password requires at least one upper case, one lower case, one number, one special character",
                                ValidatorOption  = @"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$^+=!*()@%&]).{6,}$"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MinLength,
                                IsActive         = true,
                                ValidatorMessage = "Password requires at least {{option}} characters",
                                ValidatorOption  = "6"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "repassword",
                        Order   = 3,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Password,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Confirm password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a confirm password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "repassword"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a confirm password"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 50 characters",
                                ValidatorOption  = "50"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.EqualTo,
                                IsActive         = true,
                                ValidatorMessage = "This field must be equal to {{option}}",
                                ValidatorOption  = "password"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "email",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Email,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Email"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a email"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "email"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a email"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Email,
                                IsActive         = true,
                                ValidatorMessage = "This field must be email format"
                            }
                        },
                        AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator>
                        {
                            new Portal.Entities.Components.Controls.PageControlAsyncValidator
                            {
                                ValidatorName         = "uniqueemail",
                                IsActive              = true,
                                ValidatorMessage      = "This email is already existed. Please choose another email.",
                                AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions
                                {
                                    EvaluatedExpression = "response.result == null",
                                    DatabaseOptions     = new Portal.Entities.Shared.DatabaseOptions
                                    {
                                        DatabaseConnectionId = Constants.IdentityDatabaseId,
                                        Query = "{\r\n  \"$query\": {\r\n    \"users\": [\r\n      {\r\n        \"$match\": {\r\n          \"email\": \"{{data.emaill}}\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                    },
                                    ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator
                                }
                            }
                        }
                    }
                }
            };

            var roleStandard = new StandardComponent
            {
                Id          = "5d63423dbaac7d4790b7d300",
                Name        = "roleForm",
                DisplayName = "Role Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.OneColumn,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "id",
                        Order   = 0,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "id"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "name",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Role Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a role name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "!!queryparams.id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "name"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a name"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 50 characters",
                                ValidatorOption  = "50"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Please enter only characters",
                                ValidatorOption  = "[A-Za-z]*"
                            }
                        },
                        AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator>
                        {
                            new Portal.Entities.Components.Controls.PageControlAsyncValidator
                            {
                                ValidatorName         = "uniquename",
                                IsActive              = true,
                                ValidatorMessage      = "This role is already existed. Please choose another name.",
                                AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions
                                {
                                    EvaluatedExpression = "response.result == null",
                                    DatabaseOptions     = new Portal.Entities.Shared.DatabaseOptions
                                    {
                                        DatabaseConnectionId = Constants.IdentityDatabaseId,
                                        Query = "{\r\n  \"$query\": {\r\n    \"roles\": [\r\n      {\r\n        \"$match\": {\r\n          \"name\": \"{{data.name}}\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                    },
                                    ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator
                                }
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "displayName",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Role Display Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a display name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "displayName"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a display name"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 50 characters",
                                ValidatorOption  = "50"
                            }
                        }
                    }
                }
            };

            VersionUtils.GenerateControlEvents(userFormStandard);
            VersionUtils.GenerateControlEvents(registerNewUserFormStandard);
            VersionUtils.GenerateControlEvents(roleStandard);

            VersionUtils.GenerateStandardOptions(userFormStandard);
            VersionUtils.GenerateStandardOptions(registerNewUserFormStandard);
            VersionUtils.GenerateStandardOptions(roleStandard);

            versionContext.InsertData(userFormStandard);
            versionContext.InsertData(registerNewUserFormStandard);
            versionContext.InsertData(roleStandard);

            return(Task.CompletedTask);
        }
Пример #2
0
        public Task Upgrade(IVersionContext versionContext)
        {
            var databaseStandard = new StandardComponent
            {
                Id          = "5d25f6abe88d28422061cfaf",
                Name        = "databaseForm",
                DisplayName = "Database Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.OneColumn,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "id",
                        Order   = 0,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "id"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "name",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "name"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a database name"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Please enter only characters and numberic",
                                ValidatorOption  = "[A-Za-z0-9]*"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            }
                        },
                        AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator>
                        {
                            new Portal.Entities.Components.Controls.PageControlAsyncValidator
                            {
                                ValidatorName         = "uniquename",
                                IsActive              = true,
                                ValidatorMessage      = "This database name is already existed. Please choose another name.",
                                AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions
                                {
                                    EvaluatedExpression = "response.result == null",
                                    DatabaseOptions     = new Portal.Entities.Shared.DatabaseOptions
                                    {
                                        DatabaseConnectionId = Constants.PortalDatabaseId,
                                        Query = "{\r\n  \"$query\": {\r\n    \"databases\": [\r\n      {\r\n        \"$match\": {\r\n          \"name\": \"{{data.name}}\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                    },
                                    ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator
                                }
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "dataSource",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Datasource"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Datasource"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "dataSource"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a datasource"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "connectionString",
                        Order   = 3,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Connection String"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Connection String"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "connectionString"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a connection string"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 500 characters",
                                ValidatorOption  = "500"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "databaseConnectionType",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Select,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Connection Type"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "databaseConnectionType"
                            }
                        },
                        DatasourceOptions = new Portal.Entities.Shared.DatasourceOptions
                        {
                            DatasourceStaticOptions = new Portal.Entities.Shared.DatasourceStaticOptions
                            {
                                JsonResource = "[{\"name\":\"MongoDB\",\"value\":\"mongodb\"},{\"name\":\"SQL Server\",\"value\":\"sqlserver\"}, {\"name\":\"PostgreSQL\",\"value\":\"postgresql\"}, {\"name\":\"MySQL\",\"value\":\"mysql\"}]"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please choose one connection type"
                            }
                        }
                    }
                }
            };

            var appStandard = new StandardComponent
            {
                Id          = "5d3836194d8fa90874135d68",
                Name        = "appForm",
                DisplayName = "App Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.OneColumn,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "id",
                        Order   = 0,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "id"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "name",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "!!queryparams.id"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "name"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a app name"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Please enter only characters and numberic",
                                ValidatorOption  = "[A-Za-z0-9]*"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            }
                        },
                        AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator>
                        {
                            new Portal.Entities.Components.Controls.PageControlAsyncValidator
                            {
                                ValidatorName         = "uniquename",
                                IsActive              = true,
                                ValidatorMessage      = "This app name is already existed. Please choose another name.",
                                AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions
                                {
                                    EvaluatedExpression = "response.result == null",
                                    DatabaseOptions     = new Portal.Entities.Shared.DatabaseOptions
                                    {
                                        DatabaseConnectionId = Constants.PortalDatabaseId,
                                        Query = "{\r\n  \"$query\": {\r\n    \"apps\": [\r\n      {\r\n        \"$match\": {\r\n          \"name\": \"{{data.name}}\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}"
                                    },
                                    ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator
                                }
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "displayName",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Display Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Display Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "displayName"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a display name"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "defaultUrl",
                        Order   = 3,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Default Url"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Default Url"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "defaultUrl"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a default url"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 250 characters",
                                ValidatorOption  = "250"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "currentVersionNumber",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Version"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "App Version"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "currentVersionNumber"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a version number"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum 50 characters",
                                ValidatorOption  = "50"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "logo",
                        Order   = 4,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.IconPicker,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Icon"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Icon"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "logo"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please choose one icon"
                            }
                        }
                    }
                }
            };

            VersionUtils.GenerateControlEvents(databaseStandard);
            VersionUtils.GenerateControlEvents(appStandard);

            VersionUtils.GenerateStandardOptions(databaseStandard);
            VersionUtils.GenerateStandardOptions(appStandard);
            versionContext.InsertData(databaseStandard);
            versionContext.InsertData(appStandard);

            return(Task.CompletedTask);
        }
Пример #3
0
        public Task Upgrade(IVersionContext versionContext)
        {
            var profileStandard = new StandardComponent
            {
                Id          = "5e79c14931a1754a2cd38cbc",
                Name        = "profileForm",
                DisplayName = "Profile Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.TwoColumns,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "fullName",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Textbox,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Full Name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a full name"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "fullName"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a full name"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "avatar",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Uploader,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Avatar"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = ""
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "avatar"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "allowfileurl",
                                Value = "true"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "saveonchange",
                                Value = "false"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.FileMaximumSize,
                                IsActive         = true,
                                ValidatorMessage = "File must have size less than {{option}} Mb",
                                ValidatorOption  = "5"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.FileExtensions,
                                IsActive         = true,
                                ValidatorMessage = "File must have an extension in {{option}}",
                                ValidatorOption  = "jpg;jpeg;png;gif"
                            }
                        }
                    }
                }
            };

            var changePasswordStandard = new StandardComponent
            {
                Id          = "5e79c14931a1754a2cd38cc3",
                Name        = "changePasswordForm",
                DisplayName = "Change Password Form",
                AppId       = Constants.CoreAppId,
                LayoutType  = PageSectionLayoutType.TwoColumns,
                Controls    = new List <Portal.Entities.SectionParts.Controls.PageControl>
                {
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "currentPassword",
                        Order   = 1,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Password,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Current Password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a current password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "currentPassword"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a current password"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive      = false
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MinLength,
                                IsActive      = false
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Equal,
                                IsActive      = false
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.EqualTo,
                                IsActive      = false
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive      = false
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "newPassword",
                        Order   = 2,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Password,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "New password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Enter a new password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "newPassword"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a new password"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Regex,
                                IsActive         = true,
                                ValidatorMessage = "Password requires at least one upper case, one lower case, one number, one special character",
                                ValidatorOption  = @"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$^+=!*()@%&]).{6,}$"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MinLength,
                                IsActive         = true,
                                ValidatorMessage = "Password requires at least {{option}} characters",
                                ValidatorOption  = "6"
                            }
                        }
                    },
                    new Portal.Entities.SectionParts.Controls.PageControl
                    {
                        Name    = "reNewPassword",
                        Order   = 3,
                        Type    = Portal.Entities.SectionParts.Controls.ControlType.Password,
                        Options = new List <Portal.Entities.Pages.ShellOption>
                        {
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "label",
                                Value = "Confirm new password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "placeholder",
                                Value = "Re-enter a new password"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "disabled",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "hidden",
                                Value = "false"
                            },
                            new Portal.Entities.Pages.ShellOption
                            {
                                Key   = "bindname",
                                Value = "reNewPassword"
                            }
                        },
                        Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator>
                        {
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.Required,
                                IsActive         = true,
                                ValidatorMessage = "Please enter a password"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength,
                                IsActive         = true,
                                ValidatorMessage = "This field requires maximum {{option}} characters",
                                ValidatorOption  = "50"
                            },
                            new Portal.Entities.SectionParts.Controls.PageControlValidator
                            {
                                ValidatorType    = Portal.Entities.SectionParts.Controls.ValidatorType.EqualTo,
                                IsActive         = true,
                                ValidatorMessage = "This field must be equal to new password",
                                ValidatorOption  = "newPassword"
                            }
                        }
                    }
                }
            };

            VersionUtils.GenerateStandardOptions(profileStandard);
            VersionUtils.GenerateStandardOptions(changePasswordStandard);
            versionContext.InsertData(profileStandard);
            versionContext.InsertData(changePasswordStandard);

            return(Task.CompletedTask);
        }