This commit is contained in:
owenchen committed 2026-05-12 10:09:31 +08:00
1 parent 31fbe199c1
commit 1c0c83af5f
469 files changed
+62544 -5

No files matched your search

@@ -0,0 +1,52 @@
using CloudBuilder.Core.DependencyInjection.Form;
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Policy;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.OLE.Interop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class CulturePolicy : AbstractPolicy, IPolicy
{
public const string ZH_CN = "zh-cn";
public const string EN = "en";
public static CulturePolicy instance = null;
public CulturePolicy(IContext context) : base(context)
{
this.values = new string[] { ZH_CN, EN };
}
public static CulturePolicy GetInstance()
{
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<CulturePolicy>(typeof(CulturePolicy).Name);
return instance;
}
//public class CulturePolicy : LocalePolicy, IPolicy
//public CulturePolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager)
//{
// this.context = context;
// this.localeMessageManager = localeMessageManager;
// this.values = new string[] { ZH_CN, EN };
// this.Name = typeof(CulturePolicy).Name;
//}
public static bool IsZhcn(string value)
{
return value == ZH_CN;
}
}
}
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="en" xml:space="preserve">
<value>English</value>
</data>
<data name="zh-cn" xml:space="preserve">
<value>Chinaese</value>
</data>
</root>
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="en" xml:space="preserve">
<value>英文</value>
</data>
<data name="zh-cn" xml:space="preserve">
<value>中文</value>
</data>
</root>
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class OperationContractPolicy
{
public const string FIND_BY_KEY = "FindByKey";
public const string FIND_BY_PREDICATE = "FindByPredicate";
public const string FIND_BY_SEARCH_CRITERIA = "FindBySearchCriteria";
public const string SEARCH = "SEARCH";
public const string CREATE = "Create";
public const string AMEND = "Amend";
public const string DELETE = "Delete";
public const string UPDATE = "Amend";
public OperationContractPolicy() { }
}
}
@@ -0,0 +1,75 @@
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Policy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class SecurityMessagePolicy : LocalePolicy, IPolicy
{
public static string REFRESH = "refresh";
public static string LOCKED = "locked";
public static string EXPIRED = "expired";
public static string GUI_REPORT_PRINT = "gui_report_print";
public static string GUI_WS_RECORD_EXISTED = "gui_ws_record_existed";
public static string GUI_WS_RECORD_NOT_FOUND = "gui_ws_record_not_found";
public static string GUI_WS_RECORD_NOT_FOUND_ID = "gui_ws_record_not_found_id";
public static string GUI_CONFIRM = "gui_confirm";
public static string GUI_CONFIRM_APPROVAL_NULL = "gui_confirm_approval_null";
public static string GUI_CONFIRM_CANCEL = "gui_confirm_cancel";
public static string GUI_CONFIRM_CANCEL_APPROVAL_NULL = "gui_confirm_cancel_approval_null";
public static string GUI_CONFIRM_DEL = "gui_confirm_del";
public static string GUI_CONFIRM_DEL_NULL = "gui_confirm_del_null";
public static string GUI_CONFIRM_DEL_NUM = "gui_confirm_del_num";
public static string GUI_CONFIRM_DEL_SHORT = "gui_confirm_del_short";
public static string GUI_CONFIRM_OPEN = "gui_confirm_open";
public static string GUI_CONFIRM_REVERT_NULL = "gui_confirm_revert_null";
public static string GUI_DELETE = "gui_delete";
public static string GUI_OPEN = "gui_open";
public static string GUI_SUCCEED_APPROVE_NULL = "gui_succeed_approve_null";
public static string GUI_SUCCEED_CANCEL_REVERT_NULL = "gui_succeed_cancel_revert_null";
public static string GUI_SUCCEED_CANCEL_SUBMIT_NULL = "gui_succeed_cancel_submit_null";
public static string GUI_SUCCEED_CREATED = "gui_succeed_created";
public static string GUI_SUCCEED_CREATED_NULL = "gui_succeed_created_null";
public static string GUI_SUCCEED_CREATED_SHORT = "gui_succeed_created_short";
public static string GUI_SUCCEED_DELETED = "gui_succeed_deleted";
public static string GUI_SUCCEED_DELETED_NULL = "gui_succeed_deleted_null";
public static string GUI_SUCCEED_DELETED_SHORT = "gui_succeed_deleted_short";
public static string GUI_SUCCEED_RECEIVE_NULL = "gui_succeed_receive_null";
public static string GUI_SUCCEED_REVERT_NULL = "gui_succeed_revert_null";
public static string GUI_SUCCEED_SAVED_NULL = "gui_succeed_saved_null";
public static string GUI_SUCCEED_SEND_MAIL_NULL = "gui_succeed_send_mail_null";
public static string GUI_SUCCEED_SUBMIT_NULL = "gui_succeed_submit_null";
public static string GUI_SUCCEED_UPDATED = "gui_succeed_updated";
public static string GUI_SUCCEED_UPDATED_NULL = "gui_succeed_updated_null";
public static string GUI_SUCCEED_UPDATED_RECORD = "gui_succeed_updated_record";
public static string GUI_SUCCEED_UPDATED_SHORT = "gui_succeed_updated_short";
public static string GUI_TITLE_CONFIRMATION = "gui_title_confirmation";
public static string GUI_VALID_INPUT = "gui_valid_input";
public static string GUI_VALID_SELECT = "gui_valid_select";
public static string GUI_VALID_SELECT_RECORD = "gui_valid_select_record";
public static string WEB_EXCEPTION_MESSAGE = "web_exception_message";
private readonly IContext context;
private readonly ILocaleMessageManager localeMessageManager;
public SecurityMessagePolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager)
{
this.context = context;
this.localeMessageManager = localeMessageManager;
this.Name = typeof(SecurityMessagePolicy).Name;
}
}
}
/*
INSERT INTO [dbo].[locale]([created_datetime],[created_by],[updated_datetime],[updated_by],[group_name],[lang],[name],[value],[order_by]) VALUES
(GETDATE(),'patch',GETDATE(),'patch','SecurityMessagePolicy','zh-cn','gui_valid_select',N'请选择一个有效的{0}。',0),
(GETDATE(),'patch',GETDATE(),'patch','SecurityMessagePolicy','en','gui_valid_select',N'Please select a valid {0}',0)
*/
@@ -0,0 +1,18 @@
namespace CloudBuilder.Security.Policy
{
public partial class SecurityPermissionPolicy
{
//***BEGIN***
public const string SecurityUser = "SecurityUser";
public const string SecurityMaster = "SecurityMaster";
public const string SecurityGeneratorNumber = "SecurityGeneratorNumber";
public const string SecurityPermission = "SecurityPermission";
public const string SecurityFunction = "SecurityFunction";
public const string SecurityGroup = "SecurityGroup";
public const string SecurityActor = "SecurityActor";
public const string Locale = "Locale";
public const string SecurityUserPreference = "SecurityUserPreference";
public const string SecurityLock = "SecurityLock";
//***END***
}
}
@@ -0,0 +1,13 @@
using CloudBuilder.Core.Authorization;
namespace CloudBuilder.Security.Policy
{
/// <summary>
/// 用戶自定义文件-功能名称
/// </summary>
[TypeScript]
public partial class SecurityPermissionPolicy
{
public const string CanSeeAllUser = "CanSeeAllUser";
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class SecurityPrefixPolicy
{
public const string SECURITY_USER = "SECURITY_USER";
public const string SECURITY_USER_USER_NAME = "USER_NAME";
public const string SECURITY_USER_FORMAT = "000000";
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class SecuritySettingsPolicy
{
public const string SecuritySettings_RsaPublicKey = "SecuritySettings:RsaPublicKey";
public const string SecuritySettings_RsaPrivateKey = "SecuritySettings:RsaPrivateKey";
public const string SecuritySettings_DescKey = "SecuritySettings:DescKey";
}
}
@@ -0,0 +1,23 @@
using CloudBuilder.Core.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
[TypeScript]
public class SecurityUserPolicy
{
/// <summary>
/// 普通用户首次注册给予的角色
/// </summary>
public const string SECURITY_USER_BASE_ACTOR = "SecurityUserBaseActor";
/// <summary>
/// 用户登录可以出错的次数
/// </summary>
public const int ERROR_LOGIN_COUNT = 5;
}
}
@@ -0,0 +1,57 @@
using CloudBuilder.Core.DependencyInjection.Policy;
using CloudBuilder.Core.DependencyInjection.Request;
using CloudBuilder.Core.Policy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Security.Policy
{
public class SecurityUserTypePolicy : LocalePolicy, IPolicy
{
public const string NORMAL_USERS = "N";
public const string ICTI_USERS = "I";
public const string SEDEX_USERS = "S";
public const string KOHLS_USERS = "K";
private readonly IContext context;
private readonly ILocaleMessageManager localeMessageManager;
public SecurityUserTypePolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager)
{
this.context = context;
this.localeMessageManager = localeMessageManager;
this.Name = typeof(SecurityUserTypePolicy).Name;
}
public static bool IsNormalUser(string code)
{
return code == NORMAL_USERS;
}
public static bool IsIctiUser(string code)
{
return code == ICTI_USERS;
}
public static bool IsSedexUser(string code)
{
return code == SEDEX_USERS;
}
public static bool IsKohlsUser(string code)
{
return code == KOHLS_USERS;
}
public static bool IsAuditor(string code)
{
return IsIctiUser(code) || IsSedexUser(code) || IsKohlsUser(code);
}
}
}