public static ErrorData OnCreating( Context context, SiteSettings ss, TenantModel tenantModel, bool api = false) { if (api) { if ((!Parameters.Api.Enabled || context.ContractSettings.Api == false || context.UserSettings?.AllowApi(context: context) == false)) { return(new ErrorData(type: Error.Types.InvalidRequest)); } if (context.InvalidJsonData) { return(new ErrorData(type: Error.Types.InvalidJsonData)); } } if (!context.CanCreate(ss: ss) || tenantModel.ReadOnly) { return(!context.CanRead(ss: ss) ? new ErrorData(type: Error.Types.NotFound) : new ErrorData(type: Error.Types.HasNotPermission)); } foreach (var column in ss.Columns .Where(o => !o.CanCreate( context: context, ss: ss, mine: tenantModel.Mine(context: context))) .Where(o => !ss.FormulaTarget(o.ColumnName)) .Where(o => !o.Linking)) { switch (column.ColumnName) { case "TenantName": if (tenantModel.TenantName_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Title": if (tenantModel.Title_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Body": if (tenantModel.Body_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "DisableAllUsersPermission": if (tenantModel.DisableAllUsersPermission_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "DisableStartGuide": if (tenantModel.DisableStartGuide_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "LogoType": if (tenantModel.LogoType_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "HtmlTitleTop": if (tenantModel.HtmlTitleTop_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "HtmlTitleSite": if (tenantModel.HtmlTitleSite_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "HtmlTitleRecord": if (tenantModel.HtmlTitleRecord_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "TopStyle": if (tenantModel.TopStyle_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "TopScript": if (tenantModel.TopScript_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "ContractDeadline": if (tenantModel.ContractDeadline_Updated(context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Comments": if (tenantModel.Comments_Updated(context: context)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; default: switch (Def.ExtendedColumnTypes.Get(column.Name)) { case "Class": if (tenantModel.Class_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Num": if (tenantModel.Num_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Date": if (tenantModel.Date_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Description": if (tenantModel.Description_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Check": if (tenantModel.Check_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; case "Attachments": if (tenantModel.Attachments_Updated( columnName: column.Name, context: context, column: column)) { return(new ErrorData(type: Error.Types.HasNotPermission)); } break; } break; } } return(new ErrorData(type: Error.Types.None)); }