├── tools ├── nuget │ └── nuget.exe └── gitlink │ └── GitLink.exe ├── doc └── img │ └── module-zero-core-template.png ├── src ├── Abp.Zero.Common │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Zero │ │ ├── Configuration │ │ │ ├── IRoleManagementConfig.cs │ │ │ ├── IUserManagementConfig.cs │ │ │ ├── UserManagementConfig.cs │ │ │ ├── RoleManagementConfig.cs │ │ │ ├── StaticRoleDefinition.cs │ │ │ ├── IAbpZeroEntityTypes.cs │ │ │ ├── ILanguageManagementConfig.cs │ │ │ ├── ModuleZeroConfigurationExtensions.cs │ │ │ └── IAbpZeroConfig.cs │ │ ├── AbpZeroConsts.cs │ │ └── Localization │ │ │ └── Source │ │ │ ├── AbpZero-zh-CN.xml │ │ │ ├── AbpZero-de.xml │ │ │ ├── AbpZero-ar.xml │ │ │ ├── AbpZero-tr.xml │ │ │ ├── AbpZero.xml │ │ │ ├── AbpZero-lv.xml │ │ │ ├── AbpZero-fa.xml │ │ │ ├── AbpZero-it.xml │ │ │ ├── AbpZero-ru.xml │ │ │ ├── AbpZero-es.xml │ │ │ ├── AbpZero-pt-BR.xml │ │ │ ├── AbpZero-lt.xml │ │ │ └── AbpZero-fr.xml │ ├── MultiTenancy │ │ ├── IAbpZeroDbMigrator.cs │ │ ├── ITenantCache.cs │ │ ├── IDbPerTenantConnectionStringResolver.cs │ │ ├── TenantCacheManagerExtensions.cs │ │ ├── TenantCacheItem.cs │ │ ├── DbPerTenantConnectionStringResolveArgs.cs │ │ ├── TenantStore.cs │ │ ├── TenantFeatureCacheItem.cs │ │ ├── TenantFeatureCacheItemInvalidator.cs │ │ └── TenantFeatureSetting.cs │ ├── Authorization │ │ ├── Roles │ │ │ ├── RolePermissionSetting.cs │ │ │ ├── RolePermissionCacheItem.cs │ │ │ ├── RoleClaim.cs │ │ │ └── PermissionEqualityComparer.cs │ │ ├── Users │ │ │ ├── UserPermissionSetting.cs │ │ │ ├── UserAccount.cs │ │ │ ├── UserClaim.cs │ │ │ └── UserPermissionCacheItem.cs │ │ ├── AbpLoginResultType.cs │ │ └── PermissionGrantInfo.cs │ ├── Organizations │ │ ├── IMustHaveOrganizationUnit.cs │ │ ├── IMayHaveOrganizationUnit.cs │ │ └── IOrganizationUnitSettings.cs │ ├── Application │ │ ├── Features │ │ │ └── IAbpZeroFeatureValueStore.cs │ │ └── Editions │ │ │ └── EditionfeatureCacheItem.cs │ ├── Runtime │ │ └── Session │ │ │ └── AbpSessionExtensions.cs │ ├── Localization │ │ ├── EmptyDictionary.cs │ │ ├── IMultiTenantLocalizationDictionary.cs │ │ └── MultiTenantLocalizationDictionaryCacheHelper.cs │ ├── Auditing │ │ └── AuditingStore.cs │ └── Configuration │ │ └── SettingExtensions.cs ├── Abp.ZeroCore │ ├── Zero │ │ ├── Localization │ │ │ └── SourceExt │ │ │ │ ├── AbpZero-de.xml │ │ │ │ ├── AbpZero-fr.xml │ │ │ │ ├── AbpZero-lv.xml │ │ │ │ ├── AbpZero-zh-CN.xml │ │ │ │ ├── AbpZero-pt-BR.xml │ │ │ │ ├── AbpZero-ru.xml │ │ │ │ ├── AbpZero-lt.xml │ │ │ │ ├── AbpZero-fa.xml │ │ │ │ └── AbpZero-it.xml │ │ ├── CollectionExtensions.cs │ │ └── AbpZeroCoreModule.cs │ ├── IdentityFramework │ │ └── AbpIdentityBuilder.cs │ └── Authorization │ │ ├── AbpZeroClaimsIdentityHelper.cs │ │ ├── Users │ │ ├── AbpLoginResult.cs │ │ └── AbpUserManagerExtensions.cs │ │ ├── AbpLoginManagerExtensions.cs │ │ └── AbpSecurityStampValidator.cs ├── Abp.Zero.AspNetCore │ ├── SignInStatus.cs │ ├── ExternalLoginUserInfo.cs │ ├── ModuleZeroAspNetCoreConfigurationExtensions.cs │ ├── AbpZeroAspNetCoreModule.cs │ ├── IAbpZeroAspNetCoreConfiguration.cs │ ├── AbpZeroAspNetCoreConfiguration.cs │ ├── AbpZeroClaimsIdentityHelper.cs │ ├── AspNetCoreUserTokenProviderAccessor.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Internal │ │ └── StreamExtensions.cs ├── Abp.Zero.NHibernate │ ├── RunMigrations.bat │ ├── Zero │ │ ├── FluentMigrator │ │ │ ├── VersionTable.cs │ │ │ └── Migrations │ │ │ │ ├── _20140830_01_Add_Columns_To_AbpRoles_Table.cs │ │ │ │ ├── _20150812_01_Add_Discriminator_To_AbpPermissions.cs │ │ │ │ ├── _20140829_01_Add_Columns_To_AbpUsers_Table.cs │ │ │ │ ├── _20150811_01_Add_AuditColumns_To_AbpUsers.cs │ │ │ │ ├── _20151230_03_Create_Indexes_For_AbpLanguages.cs │ │ │ │ ├── _20150301_01_Add_IsSuspended_To_AbpUsers_And_AbpTenants_Tables - Copy.cs │ │ │ │ ├── _20150922_01_Add_Columns_To_AbpAuditLogs.cs │ │ │ │ ├── _20151230_05_Create_Indexes_For_AbpOrganizationUnits.cs │ │ │ │ ├── _20140323_06_CreateAbpUserLoginsTable.cs │ │ │ │ ├── _20150312_01_Add_DeleteAuidit_To_AbpTenants_Tables.cs │ │ │ │ ├── _20140323_07_CreateAbpSettingsTable.cs │ │ │ │ ├── _20151230_04_Create_Indexes_For_AbpLanguages.cs │ │ │ │ ├── _20151103_01_Create_AbpLanguages_Table.cs │ │ │ │ ├── _20151230_10_Revise_AbpUserLogins.cs │ │ │ │ ├── _20151230_12_Create_Indexes_For_AbpUserRoles.cs │ │ │ │ ├── _20140323_05_CreatePermissionsTable.cs │ │ │ │ ├── _20151230_11_Create_Indexes_For_AbpUserOrganizationUnits.cs │ │ │ │ ├── _20150811_03_Add_Columns_To_AbpRoles.cs │ │ │ │ ├── _20151230_06_Create_Indexes_For_AbpPermissions.cs │ │ │ │ ├── _20151103_02_Create_AbpLanguageTexts_Table.cs │ │ │ │ ├── _20140323_04_CreateAbpUserRolesTable.cs │ │ │ │ ├── _20151230_02_Create_Indexes_For_AuditLogs.cs │ │ │ │ ├── _20140323_02_CreateAbpRolesTable.cs │ │ │ │ ├── _20151230_08_Revise_AbpSettings.cs │ │ │ │ ├── _20151230_07_Revise_AbpRoles.cs │ │ │ │ ├── _20160824_01_Add_AbpUserLoginAttempts_Table.cs │ │ │ │ ├── _20140323_01_CreateAbpTenantsTable.cs │ │ │ │ ├── _20151230_09_Revise_AbpTenants.cs │ │ │ │ └── _20150811_02_CreateAbpAuditLogsTable.cs │ │ └── NHibernate │ │ │ ├── EntityMappings │ │ │ ├── TenantFeatureSettingMap.cs │ │ │ ├── RolePermissionSettingMap.cs │ │ │ ├── UserPermissionSettingMap.cs │ │ │ ├── EditionMap.cs │ │ │ ├── UserLoginMap.cs │ │ │ ├── EditionFeatureSettingMap.cs │ │ │ ├── SettingMap.cs │ │ │ ├── UserRoleMap.cs │ │ │ ├── UserClaimMap.cs │ │ │ ├── FeatureSettingMap.cs │ │ │ ├── PermissionSettingMap.cs │ │ │ ├── UserOrganizationUnitMap.cs │ │ │ ├── ApplicationLanguageMap.cs │ │ │ ├── ApplicationLanguageTextMap.cs │ │ │ ├── OrganizationUnitMap.cs │ │ │ ├── BackgroundJobInfoMap.cs │ │ │ ├── UserLoginAttemptMap.cs │ │ │ ├── AuditLogMap.cs │ │ │ ├── AbpRoleMap.cs │ │ │ └── AbpTenantMap.cs │ │ │ └── AbpZeroNHibernateModule.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.Zero.EntityFramework │ ├── Zero │ │ └── EntityFramework │ │ │ ├── IMultiTenantSeed.cs │ │ │ └── AbpZeroEntityFrameworkModule.cs │ ├── Data │ │ └── ConnectionStringHelper.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.Zero.EntityFrameworkCore │ ├── Zero │ │ └── EntityFrameworkCore │ │ │ ├── IMultiTenantSeed.cs │ │ │ └── AbpZeroTenantDbContext.cs │ ├── Data │ │ └── ConnectionStringHelper.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.ZeroCore.EntityFrameworkCore │ ├── Zero │ │ └── EntityFrameworkCore │ │ │ ├── IMultiTenantSeed.cs │ │ │ └── AbpZeroTenantDbContext.cs │ └── Data │ │ └── ConnectionStringHelper.cs ├── Abp.ZeroCore.IdentityServer4.EntityFrameworkCore │ └── IdentityServer4 │ │ ├── IAbpPersistedGrantDbContext.cs │ │ ├── AbpZeroCoreIdentityServerEntityFrameworkCoreModule.cs │ │ └── AbpZeroIdentityServerBuilderEntityFrameworkCoreExtensions.cs ├── Abp.Zero │ ├── Authorization │ │ ├── Users │ │ │ ├── IUserTokenProviderAccessor.cs │ │ │ ├── NullUserTokenProviderAccessor.cs │ │ │ ├── AbpUser.cs │ │ │ └── AbpLoginResult.cs │ │ └── AbpLoginManagerExtensions.cs │ ├── IdentityFramework │ │ ├── IdentityEmailService.cs │ │ └── AbpIdentityResult.cs │ └── Zero │ │ └── AbpZeroCoreModule.cs ├── Abp.Zero.Ldap │ ├── Ldap │ │ ├── Configuration │ │ │ ├── IAbpZeroLdapModuleConfig.cs │ │ │ ├── ModuleZeroLdapConfigurationExtensions.cs │ │ │ ├── ILdapSettings.cs │ │ │ ├── AbpZeroLdapModuleConfig.cs │ │ │ └── LdapSettingNames.cs │ │ └── Localization │ │ │ └── Source │ │ │ ├── AbpZero-zh-CN.xml │ │ │ ├── AbpZero-fa.xml │ │ │ ├── AbpZero-tr.xml │ │ │ ├── AbpZero.xml │ │ │ ├── AbpZero-ar.xml │ │ │ ├── AbpZero-es.xml │ │ │ ├── AbpZero-lv.xml │ │ │ └── AbpZero-lt.xml │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.Zero.Owin │ ├── AbpZeroOwinModule.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Owin │ │ ├── AbpZeroOwinAppBuilderExtensions.cs │ │ └── OwinUserTokenProviderAccessor.cs └── Abp.ZeroCore.IdentityServer4 │ └── IdentityServer4 │ ├── PersistedGrantEntity.cs │ ├── AbpIdentityServerOptions.cs │ ├── AbpClaimsService.cs │ └── AbpZeroCoreIdentityServerModule.cs ├── test ├── Abp.Zero.SampleApp.NHibernateTests │ ├── SQLite.Interop.dll │ ├── NHibernate │ │ ├── Mappings │ │ │ ├── UserMap.cs │ │ │ ├── RoleMap.cs │ │ │ ├── TenantMap.cs │ │ │ └── UserAccountMap.cs │ │ ├── TestDatas │ │ │ ├── InitialTenantsBuilder.cs │ │ │ └── InitialTestDataBuilder.cs │ │ ├── UserManager_Tests.cs │ │ └── SampleAppNHibernateModule.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.ZeroCore.SampleApp │ ├── Application │ │ ├── AppConsts.cs │ │ ├── AppFeatures.cs │ │ ├── Users │ │ │ ├── IUserAppService.cs │ │ │ ├── UserDto.cs │ │ │ └── UserAppService.cs │ │ ├── AppAuthorizationProvider.cs │ │ ├── AppLocalizationHelper.cs │ │ ├── AppStaticRoleNames.cs │ │ └── AppFeatureProvider.cs │ ├── Core │ │ ├── Tenant.cs │ │ ├── Role.cs │ │ ├── User.cs │ │ └── ServicesCollectionDependencyRegistrar.cs │ ├── EntityFramework │ │ ├── AbpZeroTemplateDbContextConfigurer.cs │ │ ├── Seed │ │ │ └── Host │ │ │ │ └── InitialHostDbBuilder.cs │ │ └── SampleAppDbContext.cs │ └── Abp.ZeroCore.SampleApp.csproj ├── Abp.ZeroCore.IdentityServer4.Tests │ └── IdentityServer4 │ │ ├── AbpZeroIdentityServerTestBase.cs │ │ └── DependencyInjection_Tests.cs ├── Abp.Zero.SampleApp │ ├── Users │ │ ├── User.cs │ │ ├── Dto │ │ │ ├── ResetPasswordInput.cs │ │ │ ├── CreateUserInput.cs │ │ │ └── UpdateUserInput.cs │ │ ├── IUserAppService.cs │ │ └── UserStore.cs │ ├── MultiTenancy │ │ ├── Tenant.cs │ │ └── TenantManager.cs │ ├── Roles │ │ ├── Role.cs │ │ ├── RoleStore.cs │ │ └── RoleManager.cs │ ├── Authorization │ │ ├── AppPermissionChecker.cs │ │ └── AppAuthorizationProvider.cs │ ├── Editions │ │ └── EditionManager.cs │ ├── Configuration │ │ └── AppSettingProvider.cs │ ├── Features │ │ ├── AppFeatureProvider.cs │ │ └── FeatureValueStore.cs │ ├── SampleAppModule.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.Zero.SampleApp.EntityFrameworkCore │ ├── Program.cs │ ├── AppDbContext.cs │ ├── TestDataBuilders │ │ ├── TenantDatas │ │ │ └── TenantDataBuilder.cs │ │ └── HostDatas │ │ │ └── HostDataBuilder.cs │ ├── SampleAppEntityFrameworkCoreModule.cs │ ├── AbpProjectNameDbContextFactory.cs │ ├── AppEfRepositoryBase.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.Zero.SampleApp.EntityFramework │ ├── EntityFramework │ │ ├── AppDbContext.cs │ │ ├── SampleAppEntityFrameworkModule.cs │ │ └── AppEfRepositoryBase.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Abp.ZeroCore.Tests │ ├── Zero │ │ ├── TestData │ │ │ ├── TestDataBuilder.cs │ │ │ └── TestRolesBuilder.cs │ │ ├── Users │ │ │ └── UserAppService_Tests.cs │ │ ├── Roles │ │ │ └── RoleStore_Tests.cs │ │ └── AbpZeroTestModule.cs │ └── Abp.ZeroCore.Tests.csproj ├── Abp.Zero.SampleApp.Tests │ ├── TestDatas │ │ ├── InitialTenantsBuilder.cs │ │ └── InitialTestDataBuilder.cs │ ├── Localization │ │ └── SimpleLocalization_Tests.cs │ ├── SampleAppTestModule.cs │ ├── IdentityFramework │ │ └── IdentityResultHelper_Tests.cs │ ├── MultiTenancy │ │ └── TenantManager_Tests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Users │ │ ├── UserManager_Update_Tests.cs │ │ └── UserRepository_Tests.cs ├── Abp.Zero.SampleApp.EntityFrameworkCore.ConsoleAppTest │ ├── log4net.config │ └── Properties │ │ └── AssemblyInfo.cs └── Abp.Zero.SampleApp.EntityFrameworkCore.Tests │ └── Properties │ └── AssemblyInfo.cs ├── README.md ├── common.props └── LICENSE /tools/nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnetboilerplate/module-zero-forsaken/HEAD/tools/nuget/nuget.exe -------------------------------------------------------------------------------- /tools/gitlink/GitLink.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnetboilerplate/module-zero-forsaken/HEAD/tools/gitlink/GitLink.exe -------------------------------------------------------------------------------- /doc/img/module-zero-core-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnetboilerplate/module-zero-forsaken/HEAD/doc/img/module-zero-core-template.png -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Abp.Zero")] 4 | [assembly: InternalsVisibleTo("Abp.ZeroCore")] -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/SQLite.Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnetboilerplate/module-zero-forsaken/HEAD/test/Abp.Zero.SampleApp.NHibernateTests/SQLite.Interop.dll -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-de.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-fr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-lv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-zh-CN.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-pt-BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/SignInStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.AspNetCore 2 | { 3 | public enum SignInStatus 4 | { 5 | RequiresVerification, 6 | Success, 7 | Failure, 8 | LockedOut 9 | } 10 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.ZeroCore.SampleApp.Application 2 | { 3 | public static class AppConsts 4 | { 5 | public const string LocalizationSourceName = "SampleApp"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/RunMigrations.bat: -------------------------------------------------------------------------------- 1 | ..\packages\FluentMigrator.1.6.1\tools\Migrate.exe /connection "Server=localhost; Database=AbpZeroTestDb; Trusted_Connection=True;" /db sqlserver /target "bin\Debug\Abp.Zero.NHibernate.dll" 2 | pause 3 | -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFramework/Zero/EntityFramework/IMultiTenantSeed.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | 3 | namespace Abp.Zero.EntityFramework 4 | { 5 | public interface IMultiTenantSeed 6 | { 7 | AbpTenantBase Tenant { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppFeatures.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.ZeroCore.SampleApp.Application 2 | { 3 | public static class AppFeatures 4 | { 5 | public const string SimpleBooleanFeature = "SimpleBooleanFeature"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFrameworkCore/Zero/EntityFrameworkCore/IMultiTenantSeed.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | 3 | namespace Abp.Zero.EntityFrameworkCore 4 | { 5 | public interface IMultiTenantSeed 6 | { 7 | AbpTenantBase Tenant { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore.EntityFrameworkCore/Zero/EntityFrameworkCore/IMultiTenantSeed.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | 3 | namespace Abp.Zero.EntityFrameworkCore 4 | { 5 | public interface IMultiTenantSeed 6 | { 7 | AbpTenantBase Tenant { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/IRoleManagementConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | public interface IRoleManagementConfig 6 | { 7 | List StaticRoles { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/AbpZeroConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero 2 | { 3 | public class AbpZeroConsts 4 | { 5 | /// 6 | /// "AbpZero" 7 | /// 8 | public const string LocalizationSourceName = "AbpZero"; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/IAbpZeroDbMigrator.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.MultiTenancy 2 | { 3 | public interface IAbpZeroDbMigrator 4 | { 5 | void CreateOrMigrateForHost(); 6 | 7 | void CreateOrMigrateForTenant(AbpTenantBase tenant); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/Users/IUserAppService.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Services; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Application.Users 4 | { 5 | public interface IUserAppService : IAsyncCrudAppService 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **IMPORTANT NOTICE:** This repository is moved to ASP.NET Boilerplate repository and it is deprecated now. Please refer to ASP.NET Boilerplate repository. 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/Mappings/UserMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.NHibernate.EntityMappings; 2 | using Abp.Zero.SampleApp.Users; 3 | 4 | namespace Abp.Zero.SampleApp.NHibernate.Mappings 5 | { 6 | public class UserMap : AbpUserMap 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.IdentityServer4.Tests/IdentityServer4/AbpZeroIdentityServerTestBase.cs: -------------------------------------------------------------------------------- 1 | using Abp.TestBase; 2 | 3 | namespace Abp.IdentityServer4 4 | { 5 | public abstract class AbpZeroIdentityServerTestBase : AbpIntegratedTestBase 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4.EntityFrameworkCore/IdentityServer4/IAbpPersistedGrantDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Abp.IdentityServer4 4 | { 5 | public interface IAbpPersistedGrantDbContext 6 | { 7 | DbSet PersistedGrants { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/User.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | 3 | namespace Abp.Zero.SampleApp.Users 4 | { 5 | public class User : AbpUser 6 | { 7 | public override string ToString() 8 | { 9 | return string.Format("[User {0}] {1}", Id, UserName); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/Mappings/RoleMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.NHibernate.EntityMappings; 2 | using Abp.Zero.SampleApp.Roles; 3 | using Abp.Zero.SampleApp.Users; 4 | 5 | namespace Abp.Zero.SampleApp.NHibernate.Mappings 6 | { 7 | public class RoleMap : AbpRoleMap 8 | { 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/Abp.Zero/Authorization/Users/IUserTokenProviderAccessor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity; 2 | 3 | namespace Abp.Authorization.Users 4 | { 5 | public interface IUserTokenProviderAccessor 6 | { 7 | IUserTokenProvider GetUserTokenProviderOrNull() 8 | where TUser : AbpUser; 9 | } 10 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/Mappings/TenantMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.NHibernate.EntityMappings; 2 | using Abp.Zero.SampleApp.MultiTenancy; 3 | using Abp.Zero.SampleApp.Users; 4 | 5 | namespace Abp.Zero.SampleApp.NHibernate.Mappings 6 | { 7 | public class TenantMap : AbpTenantMap 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Configuration/IAbpZeroLdapModuleConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Abp.Zero.Ldap.Configuration 4 | { 5 | public interface IAbpZeroLdapModuleConfig 6 | { 7 | bool IsEnabled { get; } 8 | 9 | Type AuthenticationSourceType { get; } 10 | 11 | void Enable(Type authenticationSourceType); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/IUserManagementConfig.cs: -------------------------------------------------------------------------------- 1 | using Abp.Collections; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | /// 6 | /// User management configuration. 7 | /// 8 | public interface IUserManagementConfig 9 | { 10 | ITypeList ExternalAuthenticationSources { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/ITenantCache.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.MultiTenancy 2 | { 3 | public interface ITenantCache 4 | { 5 | TenantCacheItem Get(int tenantId); 6 | 7 | TenantCacheItem Get(string tenancyName); 8 | 9 | TenantCacheItem GetOrNull(string tenancyName); 10 | 11 | TenantCacheItem GetOrNull(int tenantId); 12 | } 13 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/Users/UserDto.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Services.Dto; 2 | using Abp.AutoMapper; 3 | using Abp.ZeroCore.SampleApp.Core; 4 | 5 | namespace Abp.ZeroCore.SampleApp.Application.Users 6 | { 7 | [AutoMap(typeof(User))] 8 | public class UserDto : EntityDto 9 | { 10 | public string UserName { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/Dto/ResetPasswordInput.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.SampleApp.Users.Dto 2 | { 3 | public class ResetPasswordInput 4 | { 5 | public int? TenantId { get; set; } 6 | 7 | public long UserId { get; set; } 8 | 9 | public string ResetCode { get; set; } 10 | 11 | public string Password { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppAuthorizationProvider.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Application 4 | { 5 | public class AppAuthorizationProvider : AuthorizationProvider 6 | { 7 | public override void SetPermissions(IPermissionDefinitionContext context) 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Core/Tenant.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Core 4 | { 5 | public class Tenant : AbpTenant 6 | { 7 | protected Tenant() 8 | { 9 | 10 | } 11 | 12 | public Tenant(string tenancyName, string name) 13 | : base(tenancyName, name) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppLocalizationHelper.cs: -------------------------------------------------------------------------------- 1 | using Abp.Localization; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Application 4 | { 5 | public static class AppLocalizationHelper 6 | { 7 | public static ILocalizableString L(string name) 8 | { 9 | return new LocalizableString(name, AppConsts.LocalizationSourceName); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.IdentityServer4.Tests/IdentityServer4/DependencyInjection_Tests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Abp.IdentityServer4 4 | { 5 | public class DependencyInjection_Tests: AbpZeroIdentityServerTestBase 6 | { 7 | [Fact] 8 | public void Should_Inject_AbpPersistedGrantStore() 9 | { 10 | Resolve(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Core/Role.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Core 4 | { 5 | public class Role : AbpRole 6 | { 7 | public Role() 8 | { 9 | 10 | } 11 | 12 | public Role(int? tenantId, string name, string displayName) 13 | : base(tenantId, name, displayName) 14 | { 15 | 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Roles/RolePermissionSetting.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Authorization.Roles 2 | { 3 | /// 4 | /// Used to store setting for a permission for a role. 5 | /// 6 | public class RolePermissionSetting : PermissionSetting 7 | { 8 | /// 9 | /// Role id. 10 | /// 11 | public virtual int RoleId { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Users/UserPermissionSetting.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Authorization.Users 2 | { 3 | /// 4 | /// Used to store setting for a permission for a user. 5 | /// 6 | public class UserPermissionSetting : PermissionSetting 7 | { 8 | /// 9 | /// User id. 10 | /// 11 | public virtual long UserId { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/MultiTenancy/Tenant.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | using Abp.Zero.SampleApp.Users; 3 | 4 | namespace Abp.Zero.SampleApp.MultiTenancy 5 | { 6 | public class Tenant : AbpTenant 7 | { 8 | protected Tenant() 9 | { 10 | 11 | } 12 | 13 | public Tenant(string tenancyName, string name) 14 | : base(tenancyName, name) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/UserManagementConfig.cs: -------------------------------------------------------------------------------- 1 | using Abp.Collections; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | public class UserManagementConfig : IUserManagementConfig 6 | { 7 | public ITypeList ExternalAuthenticationSources { get; set; } 8 | 9 | public UserManagementConfig() 10 | { 11 | ExternalAuthenticationSources = new TypeList(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/VersionTable.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator.VersionTableInfo; 2 | 3 | namespace Abp.Zero.FluentMigrator 4 | { 5 | [VersionTableMetaData] 6 | public class VersionTable : DefaultVersionTableMetaData 7 | { 8 | public override string TableName 9 | { 10 | get 11 | { 12 | return "AbpVersionInfo"; 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Roles/Role.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Zero.SampleApp.Users; 3 | 4 | namespace Abp.Zero.SampleApp.Roles 5 | { 6 | public class Role : AbpRole 7 | { 8 | public Role() 9 | { 10 | 11 | } 12 | 13 | public Role(int? tenantId, string name, string displayName) 14 | : base(tenantId, name, displayName) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Authorization/AppPermissionChecker.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | using Abp.Zero.SampleApp.Roles; 3 | using Abp.Zero.SampleApp.Users; 4 | 5 | namespace Abp.Zero.SampleApp.Authorization 6 | { 7 | public class AppPermissionChecker : PermissionChecker 8 | { 9 | public AppPermissionChecker(UserManager userManager) 10 | : base(userManager) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/RoleManagementConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | internal class RoleManagementConfig : IRoleManagementConfig 6 | { 7 | public List StaticRoles { get; private set; } 8 | 9 | public RoleManagementConfig() 10 | { 11 | StaticRoles = new List(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/Program.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.SampleApp.EntityFrameworkCore 2 | { 3 | /* WORKAROUND 4 | * This is needed since .NET CLI does not support class library projects! 5 | * See https://docs.efproject.net/en/latest/cli/dotnet.html#preview-1-known-issues 6 | */ 7 | public class Program 8 | { 9 | public static void Main() 10 | { 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Abp.Zero/Authorization/Users/NullUserTokenProviderAccessor.cs: -------------------------------------------------------------------------------- 1 | using Abp.Dependency; 2 | using Microsoft.AspNet.Identity; 3 | 4 | namespace Abp.Authorization.Users 5 | { 6 | public class NullUserTokenProviderAccessor : IUserTokenProviderAccessor, ISingletonDependency 7 | { 8 | public IUserTokenProvider GetUserTokenProviderOrNull() where TUser : AbpUser 9 | { 10 | return null; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/EntityFramework/AbpZeroTemplateDbContextConfigurer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Abp.ZeroCore.SampleApp.EntityFramework 4 | { 5 | public static class AbpZeroTemplateDbContextConfigurer 6 | { 7 | public static void Configure(DbContextOptionsBuilder builder, string connectionString) 8 | { 9 | builder.UseSqlServer(connectionString); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/TenantFeatureSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | using FluentNHibernate.Mapping; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class TenantFeatureSettingMap : SubclassMap 7 | { 8 | public TenantFeatureSettingMap() 9 | { 10 | DiscriminatorValue("TenantFeatureSetting"); 11 | 12 | Map(x => x.TenantId); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140830_01_Add_Columns_To_AbpRoles_Table.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2014083001)] 6 | public class _20140830_01_Add_Columns_To_AbpRoles_Table : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpRoles") 11 | .AddTenantIdColumnAsNullable(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppStaticRoleNames.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.ZeroCore.SampleApp.Application 2 | { 3 | public static class AppStaticRoleNames 4 | { 5 | public static class Host 6 | { 7 | public const string Admin = "Admin"; 8 | } 9 | 10 | public static class Tenants 11 | { 12 | public const string Admin = "Admin"; 13 | 14 | public const string User = "User"; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-ru.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Email 5 | Секретный код 6 | Ваш секретный код: {0} 7 | Смс 8 | Ваш секретный код: {0} 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Organizations/IMustHaveOrganizationUnit.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Organizations 2 | { 3 | /// 4 | /// This interface is implemented entities those must have an . 5 | /// 6 | public interface IMustHaveOrganizationUnit 7 | { 8 | /// 9 | /// 's Id which this entity belongs to. 10 | /// 11 | long OrganizationUnitId { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-zh-CN.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Application/Features/IAbpZeroFeatureValueStore.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Abp.Application.Features 4 | { 5 | public interface IAbpZeroFeatureValueStore : IFeatureValueStore 6 | { 7 | Task GetValueOrNullAsync(int tenantId, string featureName); 8 | Task GetEditionValueOrNullAsync(int editionId, string featureName); 9 | Task SetEditionFeatureValueAsync(int editionId, string featureName, string value); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/RolePermissionSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using FluentNHibernate.Mapping; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class RolePermissionSettingMap : SubclassMap 7 | { 8 | public RolePermissionSettingMap() 9 | { 10 | DiscriminatorValue("RolePermissionSetting"); 11 | 12 | Map(x => x.RoleId).Not.Nullable(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserPermissionSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using FluentNHibernate.Mapping; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class UserPermissionSettingMap : SubclassMap 7 | { 8 | public UserPermissionSettingMap() 9 | { 10 | DiscriminatorValue("UserPermissionSetting"); 11 | 12 | Map(x => x.UserId).Not.Nullable(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/Users/UserAppService.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Services; 2 | using Abp.Domain.Repositories; 3 | using Abp.ZeroCore.SampleApp.Core; 4 | 5 | namespace Abp.ZeroCore.SampleApp.Application.Users 6 | { 7 | public class UserAppService : AsyncCrudAppService, IUserAppService 8 | { 9 | public UserAppService(IRepository repository) 10 | : base(repository) 11 | { 12 | 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/StaticRoleDefinition.cs: -------------------------------------------------------------------------------- 1 | using Abp.MultiTenancy; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | public class StaticRoleDefinition 6 | { 7 | public string RoleName { get; private set; } 8 | 9 | public MultiTenancySides Side { get; private set; } 10 | 11 | public StaticRoleDefinition(string roleName, MultiTenancySides side) 12 | { 13 | RoleName = roleName; 14 | Side = side; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/EditionMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Editions; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class EditionMap : EntityMap 7 | { 8 | public EditionMap() 9 | : base("AbpEditions") 10 | { 11 | Map(x => x.Name); 12 | Map(x => x.DisplayName); 13 | 14 | this.MapFullAudited(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserLoginMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class UserLoginMap : EntityMap 7 | { 8 | public UserLoginMap() 9 | : base("AbpUserLogins") 10 | { 11 | Map(x => x.UserId); 12 | Map(x => x.LoginProvider); 13 | Map(x => x.ProviderKey); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-lt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | El. paštas 5 | AbpZeroTemplate Saugumo Kodas 6 | Jūsų saugumo kodas: {0} 7 | Sms 8 | Jusu saugumo kodas: {0} 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-fa.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/IUserAppService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Application.Services; 3 | using Abp.Zero.SampleApp.Users.Dto; 4 | 5 | namespace Abp.Zero.SampleApp.Users 6 | { 7 | public interface IUserAppService : IApplicationService 8 | { 9 | void CreateUser(CreateUserInput input); 10 | 11 | void UpdateUser(UpdateUserInput input); 12 | 13 | void DeleteUser(long userId); 14 | 15 | Task ResetPassword(ResetPasswordInput input); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-fa.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-tr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-ar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/EditionFeatureSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using FluentNHibernate.Mapping; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class EditionFeatureSettingMap : SubclassMap 7 | { 8 | public EditionFeatureSettingMap() 9 | { 10 | DiscriminatorValue("EditionFeatureSetting"); 11 | 12 | References(x => x.Edition).Column("EditionId").Not.Nullable(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-es.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-lv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150812_01_Add_Discriminator_To_AbpPermissions.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015081201)] 6 | public class _20150812_01_Add_Discriminator_To_AbpPermissions : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpPermissions") 11 | .AddColumn("Discriminator").AsString(128).NotNullable(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/Dto/CreateUserInput.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Abp.Zero.SampleApp.Users.Dto 4 | { 5 | public class CreateUserInput 6 | { 7 | [Required] 8 | public string Name { get; set; } 9 | 10 | [Required] 11 | public virtual string Surname { get; set; } 12 | 13 | [Required] 14 | public virtual string UserName { get; set; } 15 | 16 | [Required] 17 | public virtual string EmailAddress { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Localization/Source/AbpZero-lt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140829_01_Add_Columns_To_AbpUsers_Table.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2014082901)] 6 | public class _20140829_01_Add_Columns_To_AbpUsers_Table : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpUsers") 11 | .AddCreationAuditColumns() 12 | .AddColumn("LastLoginTime").AsDateTime().Nullable(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFramework/EntityFramework/AppDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using Abp.Zero.EntityFramework; 3 | using Abp.Zero.SampleApp.MultiTenancy; 4 | using Abp.Zero.SampleApp.Roles; 5 | using Abp.Zero.SampleApp.Users; 6 | 7 | namespace Abp.Zero.SampleApp.EntityFramework 8 | { 9 | public class AppDbContext : AbpZeroDbContext 10 | { 11 | public AppDbContext(DbConnection existingConnection) 12 | : base(existingConnection, true) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/SettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Configuration; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class SettingMap : EntityMap 7 | { 8 | public SettingMap() 9 | : base("AbpSettings") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.UserId); 13 | Map(x => x.Name); 14 | Map(x => x.Value); 15 | 16 | this.MapAudited(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Application/Editions/EditionfeatureCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Abp.Application.Editions 5 | { 6 | [Serializable] 7 | public class EditionfeatureCacheItem 8 | { 9 | public const string CacheStoreName = "AbpZeroEditionFeatures"; 10 | 11 | public IDictionary FeatureValues { get; set; } 12 | 13 | public EditionfeatureCacheItem() 14 | { 15 | FeatureValues = new Dictionary(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserRoleMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class UserRoleMap : EntityMap 7 | { 8 | public UserRoleMap() 9 | : base("AbpUserRoles") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.UserId); 13 | Map(x => x.RoleId); 14 | 15 | this.MapCreationAudited(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/IdentityFramework/AbpIdentityBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNetCore.Identity; 3 | 4 | namespace Microsoft.Extensions.DependencyInjection 5 | { 6 | public class AbpIdentityBuilder : IdentityBuilder 7 | { 8 | public Type TenantType { get; } 9 | 10 | public AbpIdentityBuilder(IdentityBuilder identityBuilder, Type tenantType) 11 | : base(identityBuilder.UserType, identityBuilder.RoleType, identityBuilder.Services) 12 | { 13 | TenantType = tenantType; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/AppDbContext.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.EntityFrameworkCore; 2 | using Abp.Zero.SampleApp.MultiTenancy; 3 | using Abp.Zero.SampleApp.Roles; 4 | using Abp.Zero.SampleApp.Users; 5 | using Microsoft.EntityFrameworkCore; 6 | 7 | namespace Abp.Zero.SampleApp.EntityFrameworkCore 8 | { 9 | public class AppDbContext : AbpZeroDbContext 10 | { 11 | public AppDbContext(DbContextOptions options) 12 | : base(options) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/TestDataBuilders/TenantDatas/TenantDataBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.SampleApp.EntityFrameworkCore.TestDataBuilders.TenantDatas 2 | { 3 | public class TenantDataBuilder 4 | { 5 | private readonly AppDbContext _context; 6 | 7 | public TenantDataBuilder(AppDbContext context) 8 | { 9 | _context = context; 10 | } 11 | 12 | public void Build(int tenantId) 13 | { 14 | new TenantUserBuilder(_context).Build(tenantId); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/AbpLoginResultType.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Authorization 2 | { 3 | public enum AbpLoginResultType : byte 4 | { 5 | Success = 1, 6 | 7 | InvalidUserNameOrEmailAddress, 8 | 9 | InvalidPassword, 10 | 11 | UserIsNotActive, 12 | 13 | InvalidTenancyName, 14 | 15 | TenantIsNotActive, 16 | 17 | UserEmailIsNotConfirmed, 18 | 19 | UnknownExternalLogin, 20 | 21 | LockedOut, 22 | 23 | UserPhoneNumberIsNotConfirmed, 24 | } 25 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Editions/EditionManager.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Editions; 2 | using Abp.Application.Features; 3 | using Abp.Domain.Repositories; 4 | 5 | namespace Abp.Zero.SampleApp.Editions 6 | { 7 | public class EditionManager : AbpEditionManager 8 | { 9 | public EditionManager( 10 | IRepository editionRepository, 11 | IAbpZeroFeatureValueStore featureValueStore) 12 | : base( 13 | editionRepository, 14 | featureValueStore) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFramework/EntityFramework/SampleAppEntityFrameworkModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Modules; 3 | using Abp.Zero.EntityFramework; 4 | 5 | namespace Abp.Zero.SampleApp.EntityFramework 6 | { 7 | [DependsOn(typeof(AbpZeroEntityFrameworkModule), typeof(SampleAppModule))] 8 | public class SampleAppEntityFrameworkModule : AbpModule 9 | { 10 | public override void Initialize() 11 | { 12 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/SampleAppEntityFrameworkCoreModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Modules; 3 | using Abp.Zero.EntityFrameworkCore; 4 | 5 | namespace Abp.Zero.SampleApp.EntityFrameworkCore 6 | { 7 | [DependsOn(typeof(AbpZeroEntityFrameworkCoreModule), typeof(SampleAppModule))] 8 | public class SampleAppEntityFrameworkCoreModule : AbpModule 9 | { 10 | public override void Initialize() 11 | { 12 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/TestDataBuilders/HostDatas/HostDataBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.SampleApp.EntityFrameworkCore.TestDataBuilders.HostDatas 2 | { 3 | public class HostDataBuilder 4 | { 5 | private readonly AppDbContext _context; 6 | 7 | public HostDataBuilder(AppDbContext context) 8 | { 9 | _context = context; 10 | } 11 | 12 | public void Build() 13 | { 14 | new HostUserBuilder(_context).Build(); 15 | new HostTenantsBuilder(_context).Build(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Organizations/IMayHaveOrganizationUnit.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Organizations 2 | { 3 | /// 4 | /// This interface is implemented entities those may have an . 5 | /// 6 | public interface IMayHaveOrganizationUnit 7 | { 8 | /// 9 | /// 's Id which this entity belongs to. 10 | /// Can be null if this entity is not related to any . 11 | /// 12 | long? OrganizationUnitId { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserClaimMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class UserClaimMap : EntityMap 7 | { 8 | public UserClaimMap() 9 | : base("AbpUserClaims") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.UserId); 13 | Map(x => x.ClaimType); 14 | Map(x => x.ClaimValue); 15 | 16 | this.MapCreationAudited(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero/Authorization/Users/AbpUser.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities.Auditing; 2 | using Microsoft.AspNet.Identity; 3 | 4 | namespace Abp.Authorization.Users 5 | { 6 | /// 7 | /// Represents a user. 8 | /// 9 | public abstract class AbpUser : AbpUserBase, IUser, IFullAudited 10 | where TUser : AbpUser 11 | { 12 | public virtual TUser DeleterUser { get; set; } 13 | 14 | public virtual TUser CreatorUser { get; set; } 15 | 16 | public virtual TUser LastModifierUser { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150811_01_Add_AuditColumns_To_AbpUsers.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015081101)] 6 | public class _20150811_01_Add_AuditColumns_To_AbpUsers : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpUsers") 11 | .AddColumn("LastModificationTime").AsDateTime().Nullable() 12 | .AddColumn("LastModifierUserId").AsInt64().Nullable().ForeignKey("AbpUsers", "Id"); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/FeatureSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class FeatureSettingMap : EntityMap 7 | { 8 | public FeatureSettingMap() 9 | : base("AbpFeatures") 10 | { 11 | DiscriminateSubClassesOnColumn("Discriminator"); 12 | 13 | Map(x => x.Name); 14 | Map(x => x.Value); 15 | 16 | this.MapCreationAudited(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/PermissionSettingMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class PermissionSettingMap : EntityMap 7 | { 8 | public PermissionSettingMap() 9 | : base("AbpPermissions") 10 | { 11 | DiscriminateSubClassesOnColumn("Discriminator"); 12 | 13 | Map(x => x.Name); 14 | Map(x => x.IsGranted); 15 | 16 | this.MapCreationAudited(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/IDbPerTenantConnectionStringResolver.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Uow; 2 | 3 | namespace Abp.MultiTenancy 4 | { 5 | /// 6 | /// Extends to 7 | /// get connection string for given tenant. 8 | /// 9 | public interface IDbPerTenantConnectionStringResolver : IConnectionStringResolver 10 | { 11 | /// 12 | /// Gets the connection string for given args. 13 | /// 14 | string GetNameOrConnectionString(DbPerTenantConnectionStringResolveArgs args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/IAbpZeroEntityTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | public interface IAbpZeroEntityTypes 6 | { 7 | /// 8 | /// User type of the application. 9 | /// 10 | Type User { get; set; } 11 | 12 | /// 13 | /// Role type of the application. 14 | /// 15 | Type Role { get; set; } 16 | 17 | /// 18 | /// Tenant type of the application. 19 | /// 20 | Type Tenant { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserOrganizationUnitMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class UserOrganizationUnitMap : EntityMap 7 | { 8 | public UserOrganizationUnitMap() 9 | : base("AbpUserOrganizationUnits") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.UserId); 13 | Map(x => x.OrganizationUnitId); 14 | 15 | this.MapCreationAudited(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/ILanguageManagementConfig.cs: -------------------------------------------------------------------------------- 1 | using Abp.Localization.Dictionaries; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | /// 6 | /// Used to configure language management. 7 | /// 8 | public interface ILanguageManagementConfig 9 | { 10 | /// 11 | /// Enables the database localization. 12 | /// Replaces all localization sources 13 | /// with database based localization source. 14 | /// 15 | void EnableDbLocalization(); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/ApplicationLanguageMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Localization; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class ApplicationLanguageMap : EntityMap 7 | { 8 | public ApplicationLanguageMap() 9 | : base("AbpLanguages") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.Name); 13 | Map(x => x.DisplayName); 14 | Map(x => x.Icon); 15 | 16 | this.MapFullAudited(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Authorization/AbpZeroClaimsIdentityHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Claims; 3 | using Abp.Runtime.Security; 4 | 5 | namespace Abp.Authorization 6 | { 7 | internal static class AbpZeroClaimsIdentityHelper 8 | { 9 | public static int? GetTenantId(ClaimsPrincipal principal) 10 | { 11 | var tenantIdOrNull = principal?.FindFirstValue(AbpClaimTypes.TenantId); 12 | if (tenantIdOrNull == null) 13 | { 14 | return null; 15 | } 16 | 17 | return Convert.ToInt32(tenantIdOrNull); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/CollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using JetBrains.Annotations; 5 | 6 | namespace Abp.Zero 7 | { 8 | internal static class CollectionExtensions 9 | { 10 | public static IList RemoveAll([NotNull] this ICollection source, Func predicate) 11 | { 12 | var items = source.Where(predicate).ToList(); 13 | 14 | foreach (var item in items) 15 | { 16 | source.Remove(item); 17 | } 18 | 19 | return items; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_03_Create_Indexes_For_AbpLanguages.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123003)] 6 | public class _20151230_03_Create_Indexes_For_AbpLanguages : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_TenantId_Name") 11 | .OnTable("AbpLanguages") 12 | .OnColumn("TenantId").Ascending() 13 | .OnColumn("Name").Ascending() 14 | .WithOptions().NonClustered(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Configuration/AppSettingProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Abp.Configuration; 3 | 4 | namespace Abp.Zero.SampleApp.Configuration 5 | { 6 | public class AppSettingProvider : SettingProvider 7 | { 8 | public override IEnumerable GetSettingDefinitions(SettingDefinitionProviderContext context) 9 | { 10 | return new List 11 | { 12 | new SettingDefinition("Setting1", "1"), 13 | new SettingDefinition("Setting2", "A") 14 | }; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/ExternalLoginUserInfo.cs: -------------------------------------------------------------------------------- 1 | using Abp.Extensions; 2 | using Microsoft.AspNet.Identity; 3 | 4 | namespace Abp.Zero.AspNetCore 5 | { 6 | public class ExternalLoginUserInfo 7 | { 8 | public string Name { get; set; } 9 | public string Surname { get; set; } 10 | public string EmailAddress { get; set; } 11 | 12 | public UserLoginInfo LoginInfo { get; set; } 13 | 14 | public bool HasAllNonEmpty() 15 | { 16 | return !Name.IsNullOrEmpty() && 17 | !Surname.IsNullOrEmpty() && 18 | !EmailAddress.IsNullOrEmpty(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150301_01_Add_IsSuspended_To_AbpUsers_And_AbpTenants_Tables - Copy.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015030101)] 6 | public class _20150301_01_Add_IsActive_To_AbpUsers_And_AbpTenants_Tables : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpUsers").AddColumn("IsActive").AsBoolean().NotNullable().WithDefaultValue(true); 11 | Alter.Table("AbpTenants").AddColumn("IsActive").AsBoolean().NotNullable().WithDefaultValue(true); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150922_01_Add_Columns_To_AbpAuditLogs.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015092201)] 6 | public class _20150922_01_Add_Columns_To_AbpAuditLogs : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpAuditLogs") 11 | .AddColumn("ImpersonatorUserId").AsInt64().Nullable() 12 | .AddColumn("ImpersonatorTenantId").AsInt32().Nullable() 13 | .AddColumn("CustomData").AsString(2000).Nullable(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantCacheManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Runtime.Caching; 2 | 3 | namespace Abp.MultiTenancy 4 | { 5 | public static class TenantCacheManagerExtensions 6 | { 7 | public static ITypedCache GetTenantCache(this ICacheManager cacheManager) 8 | { 9 | return cacheManager.GetCache(TenantCacheItem.CacheName); 10 | } 11 | 12 | public static ITypedCache GetTenantByNameCache(this ICacheManager cacheManager) 13 | { 14 | return cacheManager.GetCache(TenantCacheItem.ByNameCacheName); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_05_Create_Indexes_For_AbpOrganizationUnits.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123005)] 6 | public class _20151230_05_Create_Indexes_For_AbpOrganizationUnits : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_TenantId_ParentId") 11 | .OnTable("AbpOrganizationUnits") 12 | .OnColumn("TenantId").Ascending() 13 | .OnColumn("ParentId").Ascending() 14 | .WithOptions().NonClustered(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/ApplicationLanguageTextMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Localization; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class ApplicationLanguageTextMap : EntityMap 7 | { 8 | public ApplicationLanguageTextMap() 9 | : base("AbpLanguageTexts") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.LanguageName); 13 | Map(x => x.Source); 14 | Map(x => x.Key); 15 | Map(x => x.Value); 16 | 17 | this.MapAudited(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-zh-CN.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4.EntityFrameworkCore/IdentityServer4/AbpZeroCoreIdentityServerEntityFrameworkCoreModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.Modules; 2 | using Abp.Reflection.Extensions; 3 | using Abp.Zero.EntityFrameworkCore; 4 | 5 | namespace Abp.IdentityServer4 6 | { 7 | [DependsOn(typeof(AbpZeroCoreIdentityServerModule), typeof(AbpZeroCoreEntityFrameworkCoreModule))] 8 | public class AbpZeroCoreIdentityServerEntityFrameworkCoreModule : AbpModule 9 | { 10 | public override void Initialize() 11 | { 12 | IocManager.RegisterAssemblyByConvention(typeof(AbpZeroCoreIdentityServerEntityFrameworkCoreModule).GetAssembly()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/Dto/UpdateUserInput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Abp.Zero.SampleApp.Users.Dto 5 | { 6 | public class UpdateUserInput 7 | { 8 | [Required] 9 | public long Id { get; set; } 10 | 11 | [Required] 12 | public string Name { get; set; } 13 | 14 | [Required] 15 | public virtual string Surname { get; set; } 16 | 17 | [Required] 18 | public virtual string UserName { get; set; } 19 | 20 | [Required] 21 | public virtual string EmailAddress { get; set; } 22 | 23 | public DateTime? LastLoginTime { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_06_CreateAbpUserLoginsTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032306)] 7 | public class _20140323_06_CreateAbpUserLoginsTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpUserLogins") 12 | .WithIdAsInt64() 13 | .WithUserId() 14 | .WithColumn("LoginProvider").AsAnsiString(100).NotNullable() 15 | .WithColumn("ProviderKey").AsAnsiString(100).NotNullable(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150312_01_Add_DeleteAuidit_To_AbpTenants_Tables.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2015031201)] 7 | public class _20150312_01_Add_DeleteAuidit_To_AbpTenants_Tables : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Alter.Table("AbpUsers") 12 | .AddIsDeletedColumn() 13 | .AddColumn("DeleterUserId").AsInt64().Nullable().ForeignKey("AbpUsers", "Id") 14 | .AddColumn("DeletionTime").AsDateTime().Nullable(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/OrganizationUnitMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.NHibernate.EntityMappings; 2 | using Abp.Organizations; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class OrganizationUnitMap : EntityMap 7 | { 8 | public OrganizationUnitMap() 9 | : base("AbpOrganizationUnits") 10 | { 11 | Map(x => x.TenantId); 12 | References(x => x.Parent).Column("ParentId").Nullable(); 13 | //Map(x => x.ParentId); 14 | Map(x => x.Code); 15 | Map(x => x.DisplayName); 16 | 17 | this.MapFullAudited(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4.EntityFrameworkCore/IdentityServer4/AbpZeroIdentityServerBuilderEntityFrameworkCoreExtensions.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Stores; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace Abp.IdentityServer4 5 | { 6 | public static class AbpZeroIdentityServerBuilderEntityFrameworkCoreExtensions 7 | { 8 | public static IIdentityServerBuilder AddAbpPersistedGrants(this IIdentityServerBuilder builder) 9 | where TDbContext : IAbpPersistedGrantDbContext 10 | { 11 | builder.Services.AddTransient(); 12 | return builder; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Abp.Zero.Owin/AbpZeroOwinModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Authorization.Users; 3 | using Abp.Modules; 4 | using Abp.Zero; 5 | using Abp.Configuration.Startup; 6 | using Abp.Owin; 7 | 8 | namespace Abp 9 | { 10 | [DependsOn(typeof(AbpZeroCoreModule))] 11 | public class AbpZeroOwinModule : AbpModule 12 | { 13 | public override void PreInitialize() 14 | { 15 | Configuration.ReplaceService(); 16 | } 17 | 18 | public override void Initialize() 19 | { 20 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4/IdentityServer4/PersistedGrantEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using Abp.Domain.Entities; 4 | 5 | namespace Abp.IdentityServer4 6 | { 7 | [Table("AbpPersistedGrants")] 8 | public class PersistedGrantEntity : Entity 9 | { 10 | public virtual string Type { get; set; } 11 | 12 | public virtual string SubjectId { get; set; } 13 | 14 | public virtual string ClientId { get; set; } 15 | 16 | public virtual DateTime CreationTime { get; set; } 17 | 18 | public virtual DateTime? Expiration { get; set; } 19 | 20 | public virtual string Data { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Application/AppFeatureProvider.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.UI.Inputs; 3 | 4 | using static Abp.ZeroCore.SampleApp.Application.AppLocalizationHelper; 5 | 6 | namespace Abp.ZeroCore.SampleApp.Application 7 | { 8 | public class AppFeatureProvider : FeatureProvider 9 | { 10 | public override void SetFeatures(IFeatureDefinitionContext context) 11 | { 12 | context.Create( 13 | AppFeatures.SimpleBooleanFeature, 14 | defaultValue: "false", 15 | displayName: L("SimpleBooleanFeature"), 16 | inputType: new CheckboxInputType() 17 | ); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Abp.MultiTenancy 4 | { 5 | [Serializable] 6 | public class TenantCacheItem 7 | { 8 | public const string CacheName = "AbpZeroTenantCache"; 9 | 10 | public const string ByNameCacheName = "AbpZeroTenantByNameCache"; 11 | 12 | public int Id { get; set; } 13 | 14 | public string Name { get; set; } 15 | 16 | public string TenancyName { get; set; } 17 | 18 | public string ConnectionString { get; set; } 19 | 20 | public int? EditionId { get; set; } 21 | 22 | public bool IsActive { get; set; } 23 | 24 | public object CustomData { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/TestDatas/InitialTenantsBuilder.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.SampleApp.MultiTenancy; 2 | using NHibernate; 3 | 4 | namespace Abp.Zero.SampleApp.NHibernate.TestDatas 5 | { 6 | public class InitialTenantsBuilder 7 | { 8 | private readonly ISession _session; 9 | 10 | public InitialTenantsBuilder(ISession session) 11 | { 12 | _session = session; 13 | } 14 | 15 | public void Build() 16 | { 17 | CreateTenants(); 18 | } 19 | 20 | private void CreateTenants() 21 | { 22 | _session.Save(new Tenant(Tenant.DefaultTenantName, Tenant.DefaultTenantName)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Roles/RoleStore.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.Domain.Repositories; 4 | using Abp.Zero.SampleApp.Users; 5 | 6 | namespace Abp.Zero.SampleApp.Roles 7 | { 8 | public class RoleStore : AbpRoleStore 9 | { 10 | public RoleStore( 11 | IRepository roleRepository, 12 | IRepository userRoleRepository, 13 | IRepository rolePermissionSettingRepository) 14 | : base( 15 | roleRepository, 16 | userRoleRepository, 17 | rolePermissionSettingRepository) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Configuration/ModuleZeroLdapConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Configuration.Startup; 2 | 3 | namespace Abp.Zero.Ldap.Configuration 4 | { 5 | /// 6 | /// Extension methods for module zero configurations. 7 | /// 8 | public static class ModuleZeroLdapConfigurationExtensions 9 | { 10 | /// 11 | /// Configures ABP Zero LDAP module. 12 | /// 13 | /// 14 | public static IAbpZeroLdapModuleConfig ZeroLdap(this IModuleConfigurations moduleConfigurations) 15 | { 16 | return moduleConfigurations.AbpConfiguration.Get(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFramework/Data/ConnectionStringHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Abp.Data 4 | { 5 | public static class ConnectionStringHelper 6 | { 7 | /// 8 | /// Gets connection string from given connection string or name. 9 | /// 10 | public static string GetConnectionString(string nameOrConnectionString) 11 | { 12 | var connStrSection = ConfigurationManager.ConnectionStrings[nameOrConnectionString]; 13 | if (connStrSection != null) 14 | { 15 | return connStrSection.ConnectionString; 16 | } 17 | 18 | return nameOrConnectionString; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFrameworkCore/Data/ConnectionStringHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Abp.Data 4 | { 5 | public static class ConnectionStringHelper 6 | { 7 | /// 8 | /// Gets connection string from given connection string or name. 9 | /// 10 | public static string GetConnectionString(string nameOrConnectionString) 11 | { 12 | var connStrSection = ConfigurationManager.ConnectionStrings[nameOrConnectionString]; 13 | if (connStrSection != null) 14 | { 15 | return connStrSection.ConnectionString; 16 | } 17 | 18 | return nameOrConnectionString; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/ModuleZeroAspNetCoreConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Configuration.Startup; 2 | 3 | namespace Abp.Zero.AspNetCore 4 | { 5 | /// 6 | /// Extension methods for module zero configurations. 7 | /// 8 | public static class ModuleZeroAspNetCoreConfigurationExtensions 9 | { 10 | /// 11 | /// Configures ABP Zero AspNetCore module. 12 | /// 13 | /// 14 | public static IAbpZeroAspNetCoreConfiguration ZeroAspNetCore(this IModuleConfigurations moduleConfigurations) 15 | { 16 | return moduleConfigurations.AbpConfiguration.Get(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/ModuleZeroConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Configuration.Startup; 2 | 3 | namespace Abp.Zero.Configuration 4 | { 5 | /// 6 | /// Extension methods for module zero configurations. 7 | /// 8 | public static class ModuleZeroConfigurationExtensions 9 | { 10 | /// 11 | /// Used to configure module zero. 12 | /// 13 | /// 14 | /// 15 | public static IAbpZeroConfig Zero(this IModuleConfigurations moduleConfigurations) 16 | { 17 | return moduleConfigurations.AbpConfiguration.Get(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero/IdentityFramework/IdentityEmailService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Dependency; 3 | using Abp.Net.Mail; 4 | using Microsoft.AspNet.Identity; 5 | 6 | namespace Abp.IdentityFramework 7 | { 8 | public class IdentityEmailMessageService : IIdentityMessageService, ITransientDependency 9 | { 10 | private readonly IEmailSender _emailSender; 11 | 12 | public IdentityEmailMessageService(IEmailSender emailSender) 13 | { 14 | _emailSender = emailSender; 15 | } 16 | 17 | public virtual Task SendAsync(IdentityMessage message) 18 | { 19 | return _emailSender.SendAsync(message.Destination, message.Subject, message.Body); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Zero/TestData/TestDataBuilder.cs: -------------------------------------------------------------------------------- 1 | using Abp.ZeroCore.SampleApp.EntityFramework; 2 | 3 | namespace Abp.Zero.TestData 4 | { 5 | public class TestDataBuilder 6 | { 7 | private readonly SampleAppDbContext _context; 8 | private readonly int _tenantId; 9 | 10 | public TestDataBuilder(SampleAppDbContext context, int tenantId) 11 | { 12 | _context = context; 13 | _tenantId = tenantId; 14 | } 15 | 16 | public void Create() 17 | { 18 | new TestRolesBuilder(_context, _tenantId).Create(); 19 | new TestOrganizationUnitsBuilder(_context, _tenantId).Create(); 20 | 21 | _context.SaveChanges(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/Mappings/UserAccountMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.SampleApp.NHibernate.Mappings 5 | { 6 | public class UserAccountMap : EntityMap 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | public UserAccountMap() : base("AbpUserAccounts") 12 | { 13 | Map(x => x.TenantId); 14 | Map(x => x.UserId); 15 | Map(x => x.UserName); 16 | Map(x => x.EmailAddress); 17 | Map(x => x.UserLinkId); 18 | Map(x => x.LastLoginTime); 19 | 20 | this.MapFullAudited(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_07_CreateAbpSettingsTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032307)] 7 | public class _20140323_07_CreateAbpSettingsTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpSettings") 12 | .WithIdAsInt64() 13 | .WithTenantIdAsNullable() 14 | .WithNullableUserId() 15 | .WithColumn("Name").AsAnsiString(128).NotNullable() 16 | .WithColumn("Value").AsString().NotNullable() 17 | .WithAuditColumns(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_04_Create_Indexes_For_AbpLanguages.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123004)] 6 | public class _20151230_04_Create_Indexes_For_AbpLanguages : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_TenantId_LanguageName_Source_Key") 11 | .OnTable("AbpLanguageTexts") 12 | .OnColumn("TenantId").Ascending() 13 | .OnColumn("LanguageName").Ascending() 14 | .OnColumn("Source").Ascending() 15 | .OnColumn("Key").Ascending() 16 | .WithOptions().NonClustered(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/EntityFramework/Seed/Host/InitialHostDbBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.ZeroCore.SampleApp.EntityFramework.Seed.Host 2 | { 3 | public class InitialHostDbBuilder 4 | { 5 | private readonly SampleAppDbContext _context; 6 | 7 | public InitialHostDbBuilder(SampleAppDbContext context) 8 | { 9 | _context = context; 10 | } 11 | 12 | public void Create() 13 | { 14 | new DefaultEditionCreator(_context).Create(); 15 | new DefaultLanguagesCreator(_context).Create(); 16 | new HostRoleAndUserCreator(_context).Create(); 17 | new DefaultSettingsCreator(_context).Create(); 18 | 19 | _context.SaveChanges(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/BackgroundJobInfoMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.BackgroundJobs; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class BackgroundJobInfoMap : EntityMap 7 | { 8 | public BackgroundJobInfoMap() 9 | : base("AbpBackgroundJobs") 10 | { 11 | Map(x => x.JobType); 12 | Map(x => x.JobArgs); 13 | Map(x => x.TryCount); 14 | Map(x => x.NextTryTime); 15 | Map(x => x.LastTryTime); 16 | Map(x => x.IsAbandoned); 17 | Map(x => x.Priority).CustomType(); 18 | 19 | this.MapCreationAudited(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/TestDatas/InitialTenantsBuilder.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.SampleApp.EntityFramework; 2 | using Abp.Zero.SampleApp.MultiTenancy; 3 | 4 | namespace Abp.Zero.SampleApp.Tests.TestDatas 5 | { 6 | public class InitialTenantsBuilder 7 | { 8 | private readonly AppDbContext _context; 9 | 10 | public InitialTenantsBuilder(AppDbContext context) 11 | { 12 | _context = context; 13 | } 14 | 15 | public void Build() 16 | { 17 | CreateTenants(); 18 | } 19 | 20 | private void CreateTenants() 21 | { 22 | _context.Tenants.Add(new Tenant(Tenant.DefaultTenantName, Tenant.DefaultTenantName)); 23 | _context.SaveChanges(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Authorization/AppAuthorizationProvider.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | using Abp.Localization; 3 | 4 | namespace Abp.Zero.SampleApp.Authorization 5 | { 6 | public class AppAuthorizationProvider : AuthorizationProvider 7 | { 8 | public override void SetPermissions(IPermissionDefinitionContext context) 9 | { 10 | context.CreatePermission("Permission1", new FixedLocalizableString("Permission1")); 11 | context.CreatePermission("Permission2", new FixedLocalizableString("Permission2")); 12 | context.CreatePermission("Permission3", new FixedLocalizableString("Permission3")); 13 | context.CreatePermission("Permission4", new FixedLocalizableString("Permission4")); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/MultiTenancy/TenantManager.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.Domain.Repositories; 3 | using Abp.MultiTenancy; 4 | using Abp.Zero.SampleApp.Editions; 5 | using Abp.Zero.SampleApp.Users; 6 | 7 | namespace Abp.Zero.SampleApp.MultiTenancy 8 | { 9 | public class TenantManager : AbpTenantManager 10 | { 11 | public TenantManager( 12 | IRepository tenantRepository, 13 | IRepository tenantFeatureRepository, 14 | EditionManager editionManager, 15 | IAbpZeroFeatureValueStore featureValueStore) : 16 | base(tenantRepository, tenantFeatureRepository, editionManager, featureValueStore) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Abp.Zero/IdentityFramework/AbpIdentityResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNet.Identity; 3 | 4 | namespace Abp.IdentityFramework 5 | { 6 | public class AbpIdentityResult : IdentityResult 7 | { 8 | public AbpIdentityResult() 9 | { 10 | 11 | } 12 | 13 | public AbpIdentityResult(IEnumerable errors) 14 | : base(errors) 15 | { 16 | 17 | } 18 | 19 | public AbpIdentityResult(params string[] errors) 20 | :base(errors) 21 | { 22 | 23 | } 24 | 25 | public static AbpIdentityResult Failed(params string[] errors) 26 | { 27 | return new AbpIdentityResult(errors); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/UserManager_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Zero.SampleApp.Users; 3 | using Shouldly; 4 | using Xunit; 5 | 6 | namespace Abp.Zero.SampleApp.NHibernate 7 | { 8 | public class UserManager_Tests : NHibernateTestBase 9 | { 10 | private readonly UserManager _userManager; 11 | 12 | public UserManager_Tests() 13 | { 14 | _userManager = Resolve(); 15 | } 16 | 17 | [Fact] 18 | public async Task Should_Find_User_By_Name() 19 | { 20 | var admin = await _userManager.FindByNameAsync(User.AdminUserName); 21 | admin.ShouldNotBeNull(); 22 | admin.UserName.ShouldBe(User.AdminUserName); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Runtime/Session/AbpSessionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Authorization.Users; 3 | 4 | namespace Abp.Runtime.Session 5 | { 6 | public static class AbpSessionExtensions 7 | { 8 | public static bool IsUser(this IAbpSession session, AbpUserBase user) 9 | { 10 | if (session == null) 11 | { 12 | throw new ArgumentNullException(nameof(session)); 13 | } 14 | 15 | if (user == null) 16 | { 17 | throw new ArgumentNullException(nameof(user)); 18 | } 19 | 20 | return session.TenantId == user.TenantId && 21 | session.UserId.HasValue && 22 | session.UserId.Value == user.Id; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore.EntityFrameworkCore/Data/ConnectionStringHelper.cs: -------------------------------------------------------------------------------- 1 | #if NET46 2 | using System.Configuration; 3 | #endif 4 | 5 | namespace Abp.Data 6 | { 7 | public static class ConnectionStringHelper 8 | { 9 | /// 10 | /// Gets connection string from given connection string or name. 11 | /// 12 | public static string GetConnectionString(string nameOrConnectionString) 13 | { 14 | #if NET46 15 | var connStrSection = ConfigurationManager.ConnectionStrings[nameOrConnectionString]; 16 | if (connStrSection != null) 17 | { 18 | return connStrSection.ConnectionString; 19 | } 20 | #endif 21 | 22 | return nameOrConnectionString; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151103_01_Create_AbpLanguages_Table.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2015110301)] 7 | public class _20151103_01_Create_AbpLanguages_Table : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpLanguages") 12 | .WithIdAsInt32() 13 | .WithTenantIdAsNullable() 14 | .WithColumn("Name").AsString(10).NotNullable() 15 | .WithColumn("DisplayName").AsString(64).NotNullable() 16 | .WithColumn("Icon").AsString(128).Nullable() 17 | .WithFullAuditColumns(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/AbpZeroAspNetCoreModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Authorization.Users; 3 | using Abp.Configuration.Startup; 4 | using Abp.Modules; 5 | 6 | namespace Abp.Zero.AspNetCore 7 | { 8 | [DependsOn(typeof(AbpZeroCoreModule))] 9 | public class AbpZeroAspNetCoreModule : AbpModule 10 | { 11 | public override void PreInitialize() 12 | { 13 | IocManager.Register(); 14 | Configuration.ReplaceService(); 15 | } 16 | 17 | public override void Initialize() 18 | { 19 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/AbpProjectNameDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Infrastructure; 3 | 4 | namespace Abp.Zero.SampleApp.EntityFrameworkCore 5 | { 6 | /* This class is needed to run "dotnet ef ..." commands from command line on development. Not used anywhere else */ 7 | public class AbpProjectNameDbContextFactory : IDbContextFactory 8 | { 9 | public AppDbContext Create(DbContextFactoryOptions options) 10 | { 11 | var builder = new DbContextOptionsBuilder(); 12 | 13 | builder.UseSqlServer("Server=localhost; Database=AbpZeroMigrateTest; Trusted_Connection=True;"); 14 | 15 | return new AppDbContext(builder.Options); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/TestDatas/InitialTestDataBuilder.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | namespace Abp.Zero.SampleApp.NHibernate.TestDatas 4 | { 5 | public class InitialTestDataBuilder 6 | { 7 | private readonly ISession _session; 8 | 9 | public InitialTestDataBuilder(ISession session) 10 | { 11 | _session = session; 12 | } 13 | 14 | public void Build() 15 | { 16 | new InitialTenantsBuilder(_session).Build(); 17 | new InitialUsersBuilder(_session).Build(); 18 | new InitialTestLanguagesBuilder(_session).Build(); 19 | new InitialTestOrganizationUnitsBuilder(_session).Build(); 20 | new InitialUserOrganizationUnitsBuilder(_session).Build(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/IAbpZeroAspNetCoreConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity; 2 | 3 | namespace Abp.Zero.AspNetCore 4 | { 5 | public interface IAbpZeroAspNetCoreConfiguration 6 | { 7 | /// 8 | /// Authentication scheme of the application. 9 | /// 10 | string AuthenticationScheme { get; set; } 11 | 12 | /// 13 | /// Default value: . 14 | /// 15 | string TwoFactorAuthenticationScheme { get; set; } 16 | 17 | /// 18 | /// Default value: . 19 | /// 20 | string TwoFactorRememberBrowserAuthenticationScheme { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4/IdentityServer4/AbpIdentityServerOptions.cs: -------------------------------------------------------------------------------- 1 | using System.IdentityModel.Tokens.Jwt; 2 | using Abp.Runtime.Security; 3 | 4 | namespace Abp.IdentityServer4 5 | { 6 | public class AbpIdentityServerOptions 7 | { 8 | /// 9 | /// Updates to be compatible with identity server claims. 10 | /// Default: true. 11 | /// 12 | public bool UpdateJwtSecurityTokenHandlerDefaultInboundClaimTypeMap { get; set; } = true; 13 | 14 | /// 15 | /// Updates to be compatible with identity server claims. 16 | /// Default: true. 17 | /// 18 | public bool UpdateAbpClaimTypes { get; set; } = true; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_10_Revise_AbpUserLogins.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123010)] 6 | public class _20151230_10_Revise_AbpUserLogins : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Column("LoginProvider").OnTable("AbpUserLogins").AsString(128).NotNullable(); 11 | Alter.Column("ProviderKey").OnTable("AbpUserLogins").AsString(256).NotNullable(); 12 | 13 | Create.Index("IX_UserId_LoginProvider") 14 | .OnTable("AbpUserLogins") 15 | .OnColumn("UserId").Ascending() 16 | .OnColumn("LoginProvider").Ascending() 17 | .WithOptions().NonClustered(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Core/User.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Core 4 | { 5 | public class User : AbpUser 6 | { 7 | public override string ToString() 8 | { 9 | return string.Format("[User {0}] {1}", Id, UserName); 10 | } 11 | 12 | public static User CreateTenantAdminUser(int tenantId, string emailAddress) 13 | { 14 | var user = new User 15 | { 16 | TenantId = tenantId, 17 | UserName = AdminUserName, 18 | Name = AdminUserName, 19 | Surname = AdminUserName, 20 | EmailAddress = emailAddress 21 | }; 22 | 23 | user.SetNormalizedNames(); 24 | 25 | return user; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/AbpZeroAspNetCoreConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity; 2 | 3 | namespace Abp.Zero.AspNetCore 4 | { 5 | internal class AbpZeroAspNetCoreConfiguration : IAbpZeroAspNetCoreConfiguration 6 | { 7 | public string AuthenticationScheme { get; set; } 8 | 9 | public string TwoFactorAuthenticationScheme { get; set; } 10 | 11 | public string TwoFactorRememberBrowserAuthenticationScheme { get; set; } 12 | 13 | public AbpZeroAspNetCoreConfiguration() 14 | { 15 | AuthenticationScheme = "AppAuthenticationScheme"; 16 | TwoFactorAuthenticationScheme = DefaultAuthenticationTypes.TwoFactorCookie; 17 | TwoFactorRememberBrowserAuthenticationScheme = DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Roles/RolePermissionCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Abp.Authorization.Roles 5 | { 6 | /// 7 | /// Used to cache permissions of a role. 8 | /// 9 | [Serializable] 10 | public class RolePermissionCacheItem 11 | { 12 | public const string CacheStoreName = "AbpZeroRolePermissions"; 13 | 14 | public long RoleId { get; set; } 15 | 16 | public HashSet GrantedPermissions { get; set; } 17 | 18 | public RolePermissionCacheItem() 19 | { 20 | GrantedPermissions = new HashSet(); 21 | } 22 | 23 | public RolePermissionCacheItem(int roleId) 24 | : this() 25 | { 26 | RoleId = roleId; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_12_Create_Indexes_For_AbpUserRoles.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123012)] 6 | public class _20151230_12_Create_Indexes_For_AbpUserRoles : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_RoleId") 11 | .OnTable("AbpUserRoles") 12 | .OnColumn("RoleId").Ascending() 13 | .WithOptions().NonClustered(); 14 | 15 | Create.Index("IX_UserId_RoleId") 16 | .OnTable("AbpUserRoles") 17 | .OnColumn("UserId").Ascending() 18 | .OnColumn("RoleId").Ascending() 19 | .WithOptions().NonClustered(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/Localization/SimpleLocalization_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Threading; 3 | using Abp.Localization; 4 | using Shouldly; 5 | using Xunit; 6 | 7 | namespace Abp.Zero.SampleApp.Tests.Localization 8 | { 9 | public class SimpleLocalization_Tests : SampleAppTestBase 10 | { 11 | [Theory] 12 | [InlineData("en")] 13 | [InlineData("en-US")] 14 | [InlineData("en-GB")] 15 | public void Test1(string cultureName) 16 | { 17 | Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(cultureName); 18 | 19 | Resolve() 20 | .GetString(AbpZeroConsts.LocalizationSourceName, "Identity.UserNotInRole") 21 | .ShouldBe("User is not in role."); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_05_CreatePermissionsTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032305)] 7 | public class _20140323_05_CreatePermissionsTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpPermissions") 12 | .WithIdAsInt64() 13 | .WithColumn("RoleId").AsInt32().Nullable().ForeignKey("AbpRoles", "Id") 14 | .WithNullableUserId() 15 | .WithColumn("Name").AsAnsiString(128).NotNullable() 16 | .WithColumn("IsGranted").AsBoolean().NotNullable().WithDefaultValue(true) 17 | .WithCreationAuditColumns(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_11_Create_Indexes_For_AbpUserOrganizationUnits.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123011)] 6 | public class _20151230_11_Create_Indexes_For_AbpUserOrganizationUnits : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_OrganizationUnitId") 11 | .OnTable("AbpUserOrganizationUnits") 12 | .OnColumn("OrganizationUnitId").Ascending() 13 | .WithOptions().NonClustered(); 14 | 15 | Create.Index("IX_UserId") 16 | .OnTable("AbpUserOrganizationUnits") 17 | .OnColumn("UserId").Ascending() 18 | .WithOptions().NonClustered(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore.ConsoleAppTest/log4net.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Configuration/ILdapSettings.cs: -------------------------------------------------------------------------------- 1 | using System.DirectoryServices.AccountManagement; 2 | using System.Threading.Tasks; 3 | 4 | namespace Abp.Zero.Ldap.Configuration 5 | { 6 | /// 7 | /// Used to obtain current values of LDAP settings. 8 | /// This abstraction allows to define a different source for settings than SettingManager (see default implementation: ). 9 | /// 10 | public interface ILdapSettings 11 | { 12 | Task GetIsEnabled(int? tenantId); 13 | 14 | Task GetContextType(int? tenantId); 15 | 16 | Task GetContainer(int? tenantId); 17 | 18 | Task GetDomain(int? tenantId); 19 | 20 | Task GetUserName(int? tenantId); 21 | 22 | Task GetPassword(int? tenantId); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/UserLoginAttemptMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | using Abp.Authorization.Users; 3 | using Abp.NHibernate.EntityMappings; 4 | 5 | namespace Abp.Zero.NHibernate.EntityMappings 6 | { 7 | public class UserLoginAttemptMap : EntityMap 8 | { 9 | public UserLoginAttemptMap() 10 | : base("AbpUserLoginAttempts") 11 | { 12 | Map(x => x.TenantId); 13 | Map(x => x.TenancyName); 14 | Map(x => x.UserId); 15 | Map(x => x.UserNameOrEmailAddress); 16 | Map(x => x.ClientIpAddress); 17 | Map(x => x.ClientName); 18 | Map(x => x.BrowserInfo); 19 | Map(x => x.Result).CustomType(); 20 | 21 | this.MapCreationTime(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Zero/Users/UserAppService_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Application.Services.Dto; 3 | using Abp.ZeroCore.SampleApp.Application.Users; 4 | using Shouldly; 5 | using Xunit; 6 | 7 | namespace Abp.Zero.Users 8 | { 9 | public class UserAppService_Tests: AbpZeroTestBase 10 | { 11 | private readonly IUserAppService _userAppService; 12 | 13 | public UserAppService_Tests() 14 | { 15 | _userAppService = Resolve(); 16 | } 17 | 18 | [Fact] 19 | public async Task Should_Get_All_Users() 20 | { 21 | var users = await _userAppService.GetAll(new PagedAndSortedResultRequestDto()); 22 | users.TotalCount.ShouldBeGreaterThan(0); 23 | users.Items.Count.ShouldBeGreaterThan(0); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150811_03_Add_Columns_To_AbpRoles.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015081103)] 6 | public class _20150811_03_Add_Columns_To_AbpRoles : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Table("AbpRoles") 11 | .AddColumn("IsStatic").AsBoolean().NotNullable().WithDefaultValue(false) 12 | .AddColumn("IsDefault").AsBoolean().NotNullable().WithDefaultValue(false) 13 | .AddColumn("IsDeleted").AsBoolean().NotNullable().WithDefaultValue(false) 14 | .AddColumn("DeleterUserId").AsInt64().Nullable().ForeignKey("AbpUsers", "Id") 15 | .AddColumn("DeletionTime").AsDateTime().Nullable(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Roles/RoleManager.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization; 2 | using Abp.Authorization.Roles; 3 | using Abp.Domain.Uow; 4 | using Abp.Runtime.Caching; 5 | using Abp.Zero.Configuration; 6 | using Abp.Zero.SampleApp.Users; 7 | 8 | namespace Abp.Zero.SampleApp.Roles 9 | { 10 | public class RoleManager : AbpRoleManager 11 | { 12 | public RoleManager( 13 | RoleStore store, 14 | IPermissionManager permissionManager, 15 | IRoleManagementConfig roleManagementConfig, 16 | ICacheManager cacheManager, 17 | IUnitOfWorkManager unitOfWorkManager) 18 | : base( 19 | store, 20 | permissionManager, 21 | roleManagementConfig, 22 | cacheManager, 23 | unitOfWorkManager) 24 | { 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Users/UserAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using Abp.Domain.Entities.Auditing; 4 | using Abp.MultiTenancy; 5 | 6 | namespace Abp.Authorization.Users 7 | { 8 | /// 9 | /// Represents a summary user 10 | /// 11 | [Table("AbpUserAccounts")] 12 | [MultiTenancySide(MultiTenancySides.Host)] 13 | public class UserAccount : FullAuditedEntity 14 | { 15 | public virtual int? TenantId { get; set; } 16 | 17 | public virtual long UserId { get; set; } 18 | 19 | public virtual long? UserLinkId { get; set; } 20 | 21 | public virtual string UserName { get; set; } 22 | 23 | public virtual string EmailAddress { get; set; } 24 | 25 | public virtual DateTime? LastLoginTime { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.3.0 4 | $(NoWarn);CS1591 5 | http://www.aspnetboilerplate.com/images/abp_nupkg.png 6 | http://www.aspnetboilerplate.com/ 7 | https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/LICENSE 8 | git 9 | https://github.com/aspnetboilerplate/aspnetboilerplate 10 | 11 | 12 | 13 | NET452 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/AbpZeroClaimsIdentityHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Claims; 3 | using System.Security.Principal; 4 | using Abp.Runtime.Security; 5 | using Microsoft.AspNet.Identity; 6 | 7 | namespace Abp.Zero.AspNetCore 8 | { 9 | internal static class AbpZeroClaimsIdentityHelper 10 | { 11 | public static int? GetTenantId(IIdentity identity) 12 | { 13 | if (identity == null) 14 | { 15 | return null; 16 | } 17 | 18 | var claimsIdentity = identity as ClaimsIdentity; 19 | 20 | var tenantIdOrNull = claimsIdentity?.FindFirstValue(AbpClaimTypes.TenantId); 21 | if (tenantIdOrNull == null) 22 | { 23 | return null; 24 | } 25 | 26 | return Convert.ToInt32(tenantIdOrNull); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFrameworkCore/Zero/EntityFrameworkCore/AbpZeroTenantDbContext.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.MultiTenancy; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace Abp.Zero.EntityFrameworkCore 7 | { 8 | [MultiTenancySide(MultiTenancySides.Host)] 9 | public abstract class AbpZeroTenantDbContext : AbpZeroCommonDbContext 10 | where TRole : AbpRole 11 | where TUser : AbpUser 12 | where TSelf: AbpZeroTenantDbContext 13 | { 14 | 15 | /// 16 | /// 17 | /// 18 | /// 19 | protected AbpZeroTenantDbContext(DbContextOptions options) 20 | :base(options) 21 | { 22 | 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore.EntityFrameworkCore/Zero/EntityFrameworkCore/AbpZeroTenantDbContext.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.MultiTenancy; 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace Abp.Zero.EntityFrameworkCore 7 | { 8 | [MultiTenancySide(MultiTenancySides.Host)] 9 | public abstract class AbpZeroTenantDbContext : AbpZeroCommonDbContext 10 | where TRole : AbpRole 11 | where TUser : AbpUser 12 | where TSelf: AbpZeroTenantDbContext 13 | { 14 | 15 | /// 16 | /// 17 | /// 18 | /// 19 | protected AbpZeroTenantDbContext(DbContextOptions options) 20 | :base(options) 21 | { 22 | 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/AspNetCoreUserTokenProviderAccessor.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Microsoft.AspNet.Identity; 3 | using Microsoft.AspNetCore.DataProtection; 4 | 5 | namespace Abp.Zero.AspNetCore 6 | { 7 | public class AspNetCoreUserTokenProviderAccessor : IUserTokenProviderAccessor 8 | { 9 | private readonly IDataProtectionProvider _dataProtectionProvider; 10 | 11 | public AspNetCoreUserTokenProviderAccessor(IDataProtectionProvider dataProtectionProvider) 12 | { 13 | _dataProtectionProvider = dataProtectionProvider; 14 | } 15 | 16 | public IUserTokenProvider GetUserTokenProviderOrNull() 17 | where TUser : AbpUser 18 | { 19 | return new DataProtectorUserTokenProvider(_dataProtectionProvider.CreateProtector("ASP.NET Identity")); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Localization/EmptyDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using Abp.Localization.Dictionaries; 4 | 5 | namespace Abp.Localization 6 | { 7 | internal class EmptyDictionary : ILocalizationDictionary 8 | { 9 | public CultureInfo CultureInfo { get; private set; } 10 | 11 | public EmptyDictionary(CultureInfo cultureInfo) 12 | { 13 | CultureInfo = cultureInfo; 14 | } 15 | 16 | public LocalizedString GetOrNull(string name) 17 | { 18 | return null; 19 | } 20 | 21 | public IReadOnlyList GetAllStrings() 22 | { 23 | return new LocalizedString[0]; 24 | } 25 | 26 | public string this[string name] 27 | { 28 | get { return null; } 29 | set { } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Configuration/IAbpZeroConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.Configuration 2 | { 3 | /// 4 | /// Configuration options for zero module. 5 | /// 6 | public interface IAbpZeroConfig 7 | { 8 | /// 9 | /// Gets role management config. 10 | /// 11 | IRoleManagementConfig RoleManagement { get; } 12 | 13 | /// 14 | /// Gets user management config. 15 | /// 16 | IUserManagementConfig UserManagement { get; } 17 | 18 | /// 19 | /// Gets language management config. 20 | /// 21 | ILanguageManagementConfig LanguageManagement { get; } 22 | 23 | /// 24 | /// Gets entity type config. 25 | /// 26 | IAbpZeroEntityTypes EntityTypes { get; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_06_Create_Indexes_For_AbpPermissions.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123006)] 6 | public class _20151230_06_Create_Indexes_For_AbpPermissions : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_RoleId_Name") 11 | .OnTable("AbpPermissions") 12 | .OnColumn("RoleId").Ascending() 13 | .OnColumn("Name").Ascending() 14 | .WithOptions().NonClustered(); 15 | 16 | Create.Index("IX_UserId_Name") 17 | .OnTable("AbpPermissions") 18 | .OnColumn("UserId").Ascending() 19 | .OnColumn("Name").Ascending() 20 | .WithOptions().NonClustered(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-de.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151103_02_Create_AbpLanguageTexts_Table.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2015110302)] 7 | public class _20151103_02_Create_AbpLanguageTexts_Table : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpLanguageTexts") 12 | .WithIdAsInt64() 13 | .WithTenantIdAsNullable() 14 | .WithColumn("LanguageName").AsString(10).NotNullable() 15 | .WithColumn("Source").AsString(128).NotNullable() 16 | .WithColumn("Key").AsString(256).NotNullable() 17 | .WithColumn("Value").AsString(64 * 1024 * 1024).NotNullable() //64KB 18 | .WithAuditColumns(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/DbPerTenantConnectionStringResolveArgs.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Uow; 2 | 3 | namespace Abp.MultiTenancy 4 | { 5 | public class DbPerTenantConnectionStringResolveArgs : ConnectionStringResolveArgs 6 | { 7 | public int? TenantId { get; set; } 8 | 9 | public DbPerTenantConnectionStringResolveArgs(int? tenantId, MultiTenancySides? multiTenancySide = null) 10 | : base(multiTenancySide) 11 | { 12 | TenantId = tenantId; 13 | } 14 | 15 | public DbPerTenantConnectionStringResolveArgs(int? tenantId, ConnectionStringResolveArgs baseArgs) 16 | { 17 | TenantId = tenantId; 18 | MultiTenancySide = baseArgs.MultiTenancySide; 19 | 20 | foreach (var kvPair in baseArgs) 21 | { 22 | Add(kvPair.Key, kvPair.Value); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Configuration/AbpZeroLdapModuleConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Zero.Configuration; 3 | 4 | namespace Abp.Zero.Ldap.Configuration 5 | { 6 | public class AbpZeroLdapModuleConfig : IAbpZeroLdapModuleConfig 7 | { 8 | public bool IsEnabled { get; private set; } 9 | 10 | public Type AuthenticationSourceType { get; private set; } 11 | 12 | private readonly IAbpZeroConfig _zeroConfig; 13 | 14 | public AbpZeroLdapModuleConfig(IAbpZeroConfig zeroConfig) 15 | { 16 | _zeroConfig = zeroConfig; 17 | } 18 | 19 | public void Enable(Type authenticationSourceType) 20 | { 21 | AuthenticationSourceType = authenticationSourceType; 22 | IsEnabled = true; 23 | 24 | _zeroConfig.UserManagement.ExternalAuthenticationSources.Add(authenticationSourceType); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/TestDatas/InitialTestDataBuilder.cs: -------------------------------------------------------------------------------- 1 | using Abp.Zero.SampleApp.EntityFramework; 2 | using EntityFramework.DynamicFilters; 3 | 4 | namespace Abp.Zero.SampleApp.Tests.TestDatas 5 | { 6 | public class InitialTestDataBuilder 7 | { 8 | private readonly AppDbContext _context; 9 | 10 | public InitialTestDataBuilder(AppDbContext context) 11 | { 12 | _context = context; 13 | } 14 | 15 | public void Build() 16 | { 17 | _context.DisableAllFilters(); 18 | 19 | new InitialTenantsBuilder(_context).Build(); 20 | new InitialUsersBuilder(_context).Build(); 21 | new InitialTestLanguagesBuilder(_context).Build(); 22 | new InitialTestOrganizationUnitsBuilder(_context).Build(); 23 | new InitialUserOrganizationUnitsBuilder(_context).Build(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_04_CreateAbpUserRolesTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032304)] 7 | public class _20140323_04_CreateAbpUserRolesTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpUserRoles") 12 | .WithIdAsInt64() 13 | .WithUserId() 14 | .WithColumn("RoleId").AsInt32().NotNullable().ForeignKey("AbpRoles", "Id") 15 | .WithCreationAuditColumns(); 16 | 17 | Insert.IntoTable("AbpUserRoles").Row( 18 | new 19 | { 20 | UserId = 1, 21 | RoleId = 1 22 | } 23 | ); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_02_Create_Indexes_For_AuditLogs.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123002)] 6 | public class _20151230_02_Create_Indexes_For_AuditLogs : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Create.Index("IX_TenantId_ExecutionTime") 11 | .OnTable("AbpAuditLogs") 12 | .OnColumn("TenantId").Ascending() 13 | .OnColumn("ExecutionTime").Ascending() 14 | .WithOptions().NonClustered(); 15 | 16 | Create.Index("IX_UserId_ExecutionTime") 17 | .OnTable("AbpAuditLogs") 18 | .OnColumn("UserId").Ascending() 19 | .OnColumn("ExecutionTime").Ascending() 20 | .WithOptions().NonClustered(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/EntityFramework/SampleAppDbContext.cs: -------------------------------------------------------------------------------- 1 | using Abp.IdentityServer4; 2 | using Abp.Zero.EntityFrameworkCore; 3 | using Abp.ZeroCore.SampleApp.Core; 4 | using Microsoft.EntityFrameworkCore; 5 | using Abp.IdentityServer4; 6 | 7 | namespace Abp.ZeroCore.SampleApp.EntityFramework 8 | { 9 | public class SampleAppDbContext : AbpZeroDbContext, IAbpPersistedGrantDbContext 10 | { 11 | public DbSet PersistedGrants { get; set; } 12 | 13 | public SampleAppDbContext(DbContextOptions options) 14 | : base(options) 15 | { 16 | } 17 | 18 | protected override void OnModelCreating(ModelBuilder modelBuilder) 19 | { 20 | base.OnModelCreating(modelBuilder); 21 | 22 | modelBuilder.ConfigurePersistedGrantEntity(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_02_CreateAbpRolesTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032303)] 7 | public class _20140323_03_CreateAbpRolesTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpRoles") 12 | .WithIdAsInt32() 13 | .WithColumn("Name").AsString(50).NotNullable() 14 | .WithColumn("DisplayName").AsString(100).NotNullable() 15 | .WithAuditColumns(); 16 | 17 | Insert.IntoTable("AbpRoles").Row( 18 | new 19 | { 20 | Name = "Admin", 21 | DisplayName = "Admin" 22 | } 23 | ); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Abp.Zero.Owin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.Owin")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("81d2351f-6ca1-4976-86eb-63946ebd0a36")] 20 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.AspNetCore")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("8ee2acff-cb44-4a7e-8fe7-5709ad245f44")] 20 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/AbpZeroNHibernateModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Configuration.Startup; 3 | using Abp.Modules; 4 | using Abp.NHibernate; 5 | 6 | namespace Abp.Zero.NHibernate 7 | { 8 | /// 9 | /// Startup class for ABP Zero NHibernate module. 10 | /// 11 | [DependsOn(typeof(AbpZeroCoreModule), typeof(AbpNHibernateModule))] 12 | public class AbpZeroNHibernateModule : AbpModule 13 | { 14 | public override void PreInitialize() 15 | { 16 | Configuration.Modules.AbpNHibernate().FluentConfiguration 17 | .Mappings( 18 | m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()) 19 | ); 20 | } 21 | 22 | public override void Initialize() 23 | { 24 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Features/AppFeatureProvider.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.Dependency; 3 | using Abp.UI.Inputs; 4 | 5 | namespace Abp.Zero.SampleApp.Features 6 | { 7 | public class AppFeatureProvider : FeatureProvider 8 | { 9 | public const string MyBoolFeature = "MyBoolFeature"; 10 | public const string MyNumericFeature = "MyNumericFeature"; 11 | 12 | private readonly IIocResolver _iocResolver; //Just for injection testing 13 | 14 | public AppFeatureProvider(IIocResolver iocResolver) 15 | { 16 | _iocResolver = iocResolver; 17 | } 18 | 19 | public override void SetFeatures(IFeatureDefinitionContext context) 20 | { 21 | var boolFeature = context.Create(MyBoolFeature, "false", inputType: new CheckboxInputType()); 22 | var numericFrature = boolFeature.CreateChildFeature(MyNumericFeature, "42"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/AuditLogMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Auditing; 2 | using Abp.NHibernate.EntityMappings; 3 | 4 | namespace Abp.Zero.NHibernate.EntityMappings 5 | { 6 | public class AuditLogMap : EntityMap 7 | { 8 | public AuditLogMap() 9 | : base("AbpAuditLogs") 10 | { 11 | Map(x => x.TenantId); 12 | Map(x => x.UserId); 13 | Map(x => x.ServiceName); 14 | Map(x => x.MethodName); 15 | Map(x => x.Parameters); 16 | Map(x => x.ExecutionTime); 17 | Map(x => x.ExecutionDuration); 18 | Map(x => x.ClientIpAddress); 19 | Map(x => x.ClientName); 20 | Map(x => x.BrowserInfo); 21 | Map(x => x.Exception); 22 | Map(x => x.ImpersonatorUserId); 23 | Map(x => x.ImpersonatorTenantId); 24 | Map(x => x.CustomData); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Auditing/AuditingStore.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Dependency; 3 | using Abp.Domain.Repositories; 4 | 5 | namespace Abp.Auditing 6 | { 7 | /// 8 | /// Implements to save auditing informations to database. 9 | /// 10 | public class AuditingStore : IAuditingStore, ITransientDependency 11 | { 12 | private readonly IRepository _auditLogRepository; 13 | 14 | /// 15 | /// Creates a new . 16 | /// 17 | public AuditingStore(IRepository auditLogRepository) 18 | { 19 | _auditLogRepository = auditLogRepository; 20 | } 21 | 22 | public virtual Task SaveAsync(AuditInfo auditInfo) 23 | { 24 | return _auditLogRepository.InsertAsync(AuditLog.CreateFromAuditInfo(auditInfo)); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Roles/RoleClaim.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using System.Security.Claims; 3 | using Abp.Domain.Entities; 4 | using Abp.Domain.Entities.Auditing; 5 | 6 | namespace Abp.Authorization.Roles 7 | { 8 | [Table("AbpRoleClaims")] 9 | public class RoleClaim : CreationAuditedEntity, IMayHaveTenant 10 | { 11 | public virtual int? TenantId { get; set; } 12 | 13 | public virtual int RoleId { get; set; } 14 | 15 | public virtual string ClaimType { get; set; } 16 | 17 | public virtual string ClaimValue { get; set; } 18 | 19 | public RoleClaim() 20 | { 21 | 22 | } 23 | 24 | public RoleClaim(AbpRoleBase role, Claim claim) 25 | { 26 | TenantId = role.TenantId; 27 | RoleId = role.Id; 28 | ClaimType = claim.Type; 29 | ClaimValue = claim.Value; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Users/UserClaim.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using System.Security.Claims; 3 | using Abp.Domain.Entities; 4 | using Abp.Domain.Entities.Auditing; 5 | 6 | namespace Abp.Authorization.Users 7 | { 8 | [Table("AbpUserClaims")] 9 | public class UserClaim : CreationAuditedEntity, IMayHaveTenant 10 | { 11 | public virtual int? TenantId { get; set; } 12 | 13 | public virtual long UserId { get; set; } 14 | 15 | public virtual string ClaimType { get; set; } 16 | 17 | public virtual string ClaimValue { get; set; } 18 | 19 | public UserClaim() 20 | { 21 | 22 | } 23 | 24 | public UserClaim(AbpUserBase user, Claim claim) 25 | { 26 | TenantId = user.TenantId; 27 | UserId = user.Id; 28 | ClaimType = claim.Type; 29 | ClaimValue = claim.Value; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFramework/EntityFramework/AppEfRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities; 2 | using Abp.Domain.Repositories; 3 | using Abp.EntityFramework; 4 | using Abp.EntityFramework.Repositories; 5 | 6 | namespace Abp.Zero.SampleApp.EntityFramework 7 | { 8 | public class AppEfRepositoryBase : EfRepositoryBase 9 | where TEntity : class, IEntity 10 | { 11 | public AppEfRepositoryBase(IDbContextProvider dbContextProvider) 12 | : base(dbContextProvider) 13 | { 14 | } 15 | } 16 | 17 | public class AppEfRepositoryBase : AppEfRepositoryBase, IRepository 18 | where TEntity : class, IEntity 19 | { 20 | public AppEfRepositoryBase(IDbContextProvider dbContextProvider) 21 | : base(dbContextProvider) 22 | { 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/AppEfRepositoryBase.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities; 2 | using Abp.Domain.Repositories; 3 | using Abp.EntityFrameworkCore; 4 | using Abp.EntityFrameworkCore.Repositories; 5 | 6 | namespace Abp.Zero.SampleApp.EntityFrameworkCore 7 | { 8 | public class AppEfRepositoryBase : EfCoreRepositoryBase 9 | where TEntity : class, IEntity 10 | { 11 | public AppEfRepositoryBase(IDbContextProvider dbContextProvider) 12 | : base(dbContextProvider) 13 | { 14 | } 15 | } 16 | 17 | public class AppEfRepositoryBase : AppEfRepositoryBase, IRepository 18 | where TEntity : class, IEntity 19 | { 20 | public AppEfRepositoryBase(IDbContextProvider dbContextProvider) 21 | : base(dbContextProvider) 22 | { 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.SampleApp.NHibernateTests")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("fa3e87c5-7273-461c-ae9f-67b416e07949")] 20 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/SampleAppTestModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Modules; 3 | using Abp.TestBase; 4 | using Abp.Zero.Ldap; 5 | using Abp.Zero.SampleApp.EntityFramework; 6 | using Castle.MicroKernel.Registration; 7 | using Microsoft.Owin.Security; 8 | using NSubstitute; 9 | 10 | namespace Abp.Zero.SampleApp.Tests 11 | { 12 | [DependsOn( 13 | typeof(SampleAppEntityFrameworkModule), 14 | typeof(AbpZeroLdapModule), 15 | typeof(AbpTestBaseModule))] 16 | public class SampleAppTestModule : AbpModule 17 | { 18 | public override void PreInitialize() 19 | { 20 | Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(2); 21 | } 22 | 23 | public override void Initialize() 24 | { 25 | IocManager.IocContainer.Register( 26 | Component.For().Instance(Substitute.For()) 27 | ); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.SampleApp.EntityFrameworkCore")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("76e2cce7-a61f-4700-9054-9923645e41cc")] 20 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.SampleApp.EntityFrameworkCore.Tests")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("9223f076-ece7-4381-9bbf-f3e33073b91a")] 20 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.NHibernateTests/NHibernate/SampleAppNHibernateModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Reflection; 4 | using Abp.Configuration.Startup; 5 | using Abp.Modules; 6 | using Abp.Zero.NHibernate; 7 | using FluentNHibernate.Cfg.Db; 8 | using NHibernate.Tool.hbm2ddl; 9 | 10 | namespace Abp.Zero.SampleApp.NHibernate 11 | { 12 | [DependsOn(typeof(AbpZeroNHibernateModule), typeof(SampleAppModule))] 13 | public class SampleAppNHibernateModule : AbpModule 14 | { 15 | public override void PreInitialize() 16 | { 17 | Configuration.Modules.AbpNHibernate().FluentConfiguration 18 | .Database(SQLiteConfiguration.Standard.InMemory()) 19 | .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly())) 20 | .ExposeConfiguration(cfg => new SchemaExport(cfg).Execute(true, true, false, IocManager.Resolve(), Console.Out)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Zero/Roles/RoleStore_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Domain.Uow; 3 | using Abp.ZeroCore.SampleApp.Core; 4 | using Shouldly; 5 | using Xunit; 6 | 7 | namespace Abp.Zero.Roles 8 | { 9 | public class RoleStore_Tests : AbpZeroTestBase 10 | { 11 | private readonly RoleStore _roleStore; 12 | 13 | public RoleStore_Tests() 14 | { 15 | _roleStore = Resolve(); 16 | } 17 | 18 | [Fact] 19 | public async Task Should_Get_Role_Claims() 20 | { 21 | using (var uow = Resolve().Begin()) 22 | { 23 | var role = await _roleStore.FindByNameAsync("ADMIN"); 24 | role.ShouldNotBeNull(); 25 | 26 | var claims = await _roleStore.GetClaimsAsync(role); 27 | 28 | claims.ShouldNotBeNull(); 29 | 30 | await uow.CompleteAsync(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/PermissionGrantInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Authorization 2 | { 3 | /// 4 | /// Represents a permission with information. 5 | /// 6 | public class PermissionGrantInfo 7 | { 8 | /// 9 | /// Name of the permission. 10 | /// 11 | public string Name { get; private set; } 12 | 13 | /// 14 | /// Is this permission granted Prohibited? 15 | /// 16 | public bool IsGranted { get; private set; } 17 | 18 | /// 19 | /// Creates a new instance of . 20 | /// 21 | /// 22 | /// 23 | public PermissionGrantInfo(string name, bool isGranted) 24 | { 25 | Name = name; 26 | IsGranted = isGranted; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/AbpRoleMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.MultiTenancy; 4 | using Abp.NHibernate.EntityMappings; 5 | 6 | namespace Abp.Zero.NHibernate.EntityMappings 7 | { 8 | /// 9 | /// Base class for role mapping. 10 | /// 11 | public abstract class AbpRoleMap : EntityMap 12 | where TRole : AbpRole 13 | where TUser : AbpUser 14 | { 15 | /// 16 | /// Constructor. 17 | /// 18 | protected AbpRoleMap() 19 | : base("AbpRoles") 20 | { 21 | Map(x => x.TenantId); 22 | Map(x => x.Name); 23 | Map(x => x.DisplayName); 24 | Map(x => x.IsStatic); 25 | Map(x => x.IsDefault); 26 | 27 | this.MapFullAudited(); 28 | 29 | Polymorphism.Explicit(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantStore.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.MultiTenancy 2 | { 3 | public class TenantStore : ITenantStore 4 | { 5 | private readonly ITenantCache _tenantCache; 6 | 7 | public TenantStore(ITenantCache tenantCache) 8 | { 9 | _tenantCache = tenantCache; 10 | } 11 | 12 | public TenantInfo Find(int tenantId) 13 | { 14 | var tenant = _tenantCache.GetOrNull(tenantId); 15 | if (tenant == null) 16 | { 17 | return null; 18 | } 19 | 20 | return new TenantInfo(tenant.Id, tenant.TenancyName); 21 | } 22 | 23 | public TenantInfo Find(string tenancyName) 24 | { 25 | var tenant = _tenantCache.GetOrNull(tenancyName); 26 | if (tenant == null) 27 | { 28 | return null; 29 | } 30 | 31 | return new TenantInfo(tenant.Id, tenant.TenancyName); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFrameworkCore.ConsoleAppTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Abp.Zero.SampleApp.EntityFrameworkCore.ConsoleAppTest")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("25f73233-3922-4bc0-ac1c-2042613dec5e")] 20 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/IdentityFramework/IdentityResultHelper_Tests.cs: -------------------------------------------------------------------------------- 1 | using Abp.IdentityFramework; 2 | using Abp.Localization; 3 | using Microsoft.AspNet.Identity; 4 | using Shouldly; 5 | using Xunit; 6 | 7 | namespace Abp.Zero.SampleApp.Tests.IdentityFramework 8 | { 9 | public class IdentityResultHelper_Tests : SampleAppTestBase 10 | { 11 | [Fact] 12 | public void Should_Localize_IdentityFramework_Messages() 13 | { 14 | var localizationManager = Resolve(); 15 | 16 | IdentityResultExtensions 17 | .LocalizeErrors(IdentityResult.Failed("Incorrect password."), localizationManager) 18 | .ShouldBe("Incorrect password."); 19 | 20 | IdentityResultExtensions 21 | .LocalizeErrors(IdentityResult.Failed("Passwords must be at least 6 characters."), localizationManager) 22 | .ShouldBe("Passwords must be at least 6 characters."); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Localization/IMultiTenantLocalizationDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Abp.Localization.Dictionaries; 3 | 4 | namespace Abp.Localization 5 | { 6 | /// 7 | /// Extends to add tenant and database based localization. 8 | /// 9 | public interface IMultiTenantLocalizationDictionary : ILocalizationDictionary 10 | { 11 | /// 12 | /// Gets a . 13 | /// 14 | /// TenantId or null for host. 15 | /// Localization key name. 16 | LocalizedString GetOrNull(int? tenantId, string name); 17 | 18 | /// 19 | /// Gets all s. 20 | /// 21 | /// TenantId or null for host. 22 | IReadOnlyList GetAllStrings(int? tenantId); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-ar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/MultiTenancy/TenantManager_Tests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Zero.SampleApp.MultiTenancy; 3 | using Shouldly; 4 | using Xunit; 5 | 6 | namespace Abp.Zero.SampleApp.Tests.MultiTenancy 7 | { 8 | public class TenantManager_Tests : SampleAppTestBase 9 | { 10 | private readonly TenantManager _tenantManager; 11 | 12 | public TenantManager_Tests() 13 | { 14 | _tenantManager = Resolve(); 15 | } 16 | 17 | [Fact] 18 | public async Task Should_Not_Create_Duplicate_Tenant() 19 | { 20 | await _tenantManager.CreateAsync(new Tenant("Tenant-X", "Tenant X")); 21 | 22 | //Trying to re-create with same tenancy name 23 | 24 | await Assert.ThrowsAnyAsync(async () => 25 | { 26 | await _tenantManager.CreateAsync(new Tenant("Tenant-X", "Tenant X")); 27 | }); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Abp.Zero/Zero/AbpZeroCoreModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Localization.Dictionaries.Xml; 3 | using Abp.Localization.Sources; 4 | using Abp.Modules; 5 | 6 | namespace Abp.Zero 7 | { 8 | [DependsOn(typeof(AbpZeroCommonModule))] 9 | public class AbpZeroCoreModule : AbpModule 10 | { 11 | public override void PreInitialize() 12 | { 13 | Configuration.Localization.Sources.Extensions.Add( 14 | new LocalizationSourceExtensionInfo( 15 | AbpZeroConsts.LocalizationSourceName, 16 | new XmlEmbeddedFileLocalizationDictionaryProvider( 17 | Assembly.GetExecutingAssembly(), "Abp.Zero.Localization.SourceExt" 18 | ) 19 | ) 20 | ); 21 | } 22 | 23 | public override void Initialize() 24 | { 25 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/AbpZeroCoreModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.Localization.Dictionaries.Xml; 2 | using Abp.Localization.Sources; 3 | using Abp.Modules; 4 | using Abp.Reflection.Extensions; 5 | 6 | namespace Abp.Zero 7 | { 8 | [DependsOn(typeof(AbpZeroCommonModule))] 9 | public class AbpZeroCoreModule : AbpModule 10 | { 11 | public override void PreInitialize() 12 | { 13 | Configuration.Localization.Sources.Extensions.Add( 14 | new LocalizationSourceExtensionInfo( 15 | AbpZeroConsts.LocalizationSourceName, 16 | new XmlEmbeddedFileLocalizationDictionaryProvider( 17 | typeof(AbpZeroCoreModule).GetAssembly(), "Abp.Zero.Localization.SourceExt" 18 | ) 19 | ) 20 | ); 21 | } 22 | 23 | public override void Initialize() 24 | { 25 | IocManager.RegisterAssemblyByConvention(typeof(AbpZeroCoreModule).GetAssembly()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-tr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Abp.Zero.AspNetCore/Internal/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | namespace Abp.Zero.AspNetCore.Internal 6 | { 7 | internal static class StreamExtensions 8 | { 9 | internal static readonly Encoding DefaultEncoding = new UTF8Encoding(false, true); 10 | 11 | public static BinaryReader CreateReader(this Stream stream) 12 | { 13 | return new BinaryReader(stream, DefaultEncoding, true); 14 | } 15 | 16 | public static BinaryWriter CreateWriter(this Stream stream) 17 | { 18 | return new BinaryWriter(stream, DefaultEncoding, true); 19 | } 20 | 21 | public static DateTimeOffset ReadDateTimeOffset(this BinaryReader reader) 22 | { 23 | return new DateTimeOffset(reader.ReadInt64(), TimeSpan.Zero); 24 | } 25 | 26 | public static void Write(this BinaryWriter writer, DateTimeOffset value) 27 | { 28 | writer.Write(value.UtcTicks); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_08_Revise_AbpSettings.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123008)] 6 | public class _20151230_08_Revise_AbpSettings : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Column("Name").OnTable("AbpSettings").AsString(256).NotNullable(); 11 | Alter.Column("Value").OnTable("AbpSettings").AsString(2000).Nullable(); 12 | 13 | Create.Index("IX_UserId_Name") 14 | .OnTable("AbpSettings") 15 | .OnColumn("UserId").Ascending() 16 | .OnColumn("Name").Ascending() 17 | .WithOptions().NonClustered(); 18 | 19 | Create.Index("IX_TenantId_Name") 20 | .OnTable("AbpSettings") 21 | .OnColumn("TenantId").Ascending() 22 | .OnColumn("Name").Ascending() 23 | .WithOptions().NonClustered(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Abp.Zero/Authorization/Users/AbpLoginResult.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using Abp.MultiTenancy; 3 | 4 | namespace Abp.Authorization.Users 5 | { 6 | public class AbpLoginResult 7 | where TTenant : AbpTenant 8 | where TUser : AbpUserBase 9 | { 10 | public AbpLoginResultType Result { get; private set; } 11 | 12 | public TTenant Tenant { get; private set; } 13 | 14 | public TUser User { get; private set; } 15 | 16 | public ClaimsIdentity Identity { get; private set; } 17 | 18 | public AbpLoginResult(AbpLoginResultType result, TTenant tenant = null, TUser user = null) 19 | { 20 | Result = result; 21 | Tenant = tenant; 22 | User = user; 23 | } 24 | 25 | public AbpLoginResult(TTenant tenant, TUser user, ClaimsIdentity identity) 26 | : this(AbpLoginResultType.Success, tenant) 27 | { 28 | User = user; 29 | Identity = identity; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4/IdentityServer4/AbpClaimsService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Security.Claims; 4 | using Abp.Runtime.Security; 5 | using IdentityServer4.Services; 6 | using Microsoft.Extensions.Logging; 7 | 8 | namespace Abp.IdentityServer4 9 | { 10 | public class AbpClaimsService : DefaultClaimsService 11 | { 12 | public AbpClaimsService(IProfileService profile, ILogger logger) 13 | : base(profile, logger) 14 | { 15 | } 16 | 17 | protected override IEnumerable GetOptionalClaims(ClaimsPrincipal subject) 18 | { 19 | var tenantClaim = subject.FindFirst(AbpClaimTypes.TenantId); 20 | if (tenantClaim == null) 21 | { 22 | return base.GetOptionalClaims(subject); 23 | } 24 | else 25 | { 26 | return base.GetOptionalClaims(subject).Union(new[] { tenantClaim }); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Authorization/Users/AbpLoginResult.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using Abp.MultiTenancy; 3 | 4 | namespace Abp.Authorization.Users 5 | { 6 | public class AbpLoginResult 7 | where TTenant : AbpTenant 8 | where TUser : AbpUserBase 9 | { 10 | public AbpLoginResultType Result { get; private set; } 11 | 12 | public TTenant Tenant { get; private set; } 13 | 14 | public TUser User { get; private set; } 15 | 16 | public ClaimsIdentity Identity { get; private set; } 17 | 18 | public AbpLoginResult(AbpLoginResultType result, TTenant tenant = null, TUser user = null) 19 | { 20 | Result = result; 21 | Tenant = tenant; 22 | User = user; 23 | } 24 | 25 | public AbpLoginResult(TTenant tenant, TUser user, ClaimsIdentity identity) 26 | : this(AbpLoginResultType.Success, tenant) 27 | { 28 | User = user; 29 | Identity = identity; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Localization/MultiTenantLocalizationDictionaryCacheHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Abp.Runtime.Caching; 3 | 4 | namespace Abp.Localization 5 | { 6 | /// 7 | /// A helper to implement localization cache. 8 | /// 9 | public static class MultiTenantLocalizationDictionaryCacheHelper 10 | { 11 | /// 12 | /// The cache name. 13 | /// 14 | public const string CacheName = "AbpZeroMultiTenantLocalizationDictionaryCache"; 15 | 16 | public static ITypedCache> GetMultiTenantLocalizationDictionaryCache(this ICacheManager cacheManager) 17 | { 18 | return cacheManager.GetCache(CacheName).AsTyped>(); 19 | } 20 | 21 | public static string CalculateCacheKey(int? tenantId, string sourceName, string languageName) 22 | { 23 | return sourceName + "#" + languageName + "#" + (tenantId ?? 0); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-lv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/SampleAppModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Modules; 3 | using Abp.Zero.Configuration; 4 | using Abp.Zero.SampleApp.Authorization; 5 | using Abp.Zero.SampleApp.Configuration; 6 | using Abp.Zero.SampleApp.Features; 7 | 8 | namespace Abp.Zero.SampleApp 9 | { 10 | [DependsOn(typeof(AbpZeroCoreModule))] 11 | public class SampleAppModule : AbpModule 12 | { 13 | public override void PreInitialize() 14 | { 15 | Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); 16 | 17 | Configuration.Features.Providers.Add(); 18 | 19 | Configuration.Authorization.Providers.Add(); 20 | Configuration.Settings.Providers.Add(); 21 | Configuration.MultiTenancy.IsEnabled = true; 22 | } 23 | 24 | public override void Initialize() 25 | { 26 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Roles/PermissionEqualityComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Abp.Authorization.Roles 4 | { 5 | /// 6 | /// Equality comparer for objects. 7 | /// 8 | internal class PermissionEqualityComparer : IEqualityComparer 9 | { 10 | public static PermissionEqualityComparer Instance { get { return _instance; } } 11 | private static PermissionEqualityComparer _instance = new PermissionEqualityComparer(); 12 | 13 | public bool Equals(Permission x, Permission y) 14 | { 15 | if (x == null && y == null) 16 | { 17 | return true; 18 | } 19 | if (x == null || y == null) 20 | { 21 | return false; 22 | } 23 | 24 | return Equals(x.Name, y.Name); 25 | } 26 | 27 | public int GetHashCode(Permission permission) 28 | { 29 | return permission.Name.GetHashCode(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Abp.Zero.Tests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Volosoft")] 11 | [assembly: AssemblyProduct("Abp.Zero.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("2758d172-c92b-47f3-9e7f-749ad6a7ec0d")] -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Abp.Zero.SampleApp")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Volosoft")] 11 | [assembly: AssemblyProduct("Abp.Zero.SampleApp")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("1c3887c7-22c7-401f-881c-bc16a2b6d448")] -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Authorization/Users/UserPermissionCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Abp.Authorization.Users 5 | { 6 | /// 7 | /// Used to cache roles and permissions of a user. 8 | /// 9 | [Serializable] 10 | public class UserPermissionCacheItem 11 | { 12 | public const string CacheStoreName = "AbpZeroUserPermissions"; 13 | 14 | public long UserId { get; set; } 15 | 16 | public List RoleIds { get; set; } 17 | 18 | public HashSet GrantedPermissions { get; set; } 19 | 20 | public HashSet ProhibitedPermissions { get; set; } 21 | 22 | public UserPermissionCacheItem() 23 | { 24 | RoleIds = new List(); 25 | GrantedPermissions = new HashSet(); 26 | ProhibitedPermissions = new HashSet(); 27 | } 28 | 29 | public UserPermissionCacheItem(long userId) 30 | : this() 31 | { 32 | UserId = userId; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Abp.ZeroCore.SampleApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp1.0 5 | Abp.ZeroCore.SampleApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_07_Revise_AbpRoles.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123007)] 6 | public class _20151230_07_Revise_AbpRoles : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Column("Name").OnTable("AbpRoles").AsString(32).NotNullable(); 11 | Alter.Column("DisplayName").OnTable("AbpRoles").AsString(64).NotNullable(); 12 | 13 | Create.Index("IX_IsDeleted_TenantId_Name") 14 | .OnTable("AbpRoles") 15 | .OnColumn("IsDeleted").Ascending() 16 | .OnColumn("TenantId").Ascending() 17 | .OnColumn("Name").Ascending() 18 | .WithOptions().NonClustered(); 19 | 20 | Create.Index("IX_TenantId_Name") 21 | .OnTable("AbpRoles") 22 | .OnColumn("TenantId").Ascending() 23 | .OnColumn("Name").Ascending() 24 | .WithOptions().NonClustered(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-fa.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-it.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-ru.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Abp.Zero/Authorization/AbpLoginManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.MultiTenancy; 4 | using Abp.Threading; 5 | 6 | namespace Abp.Authorization 7 | { 8 | public static class AbpLogInManagerExtensions 9 | { 10 | public static AbpLoginResult Login( 11 | this AbpLogInManager logInManager, 12 | string userNameOrEmailAddress, 13 | string plainPassword, 14 | string tenancyName = null, 15 | bool shouldLockout = true) 16 | where TTenant : AbpTenant 17 | where TRole : AbpRole, new() 18 | where TUser : AbpUser 19 | { 20 | return AsyncHelper.RunSync( 21 | () => logInManager.LoginAsync( 22 | userNameOrEmailAddress, 23 | plainPassword, 24 | tenancyName, 25 | shouldLockout 26 | ) 27 | ); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Users/UserStore.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.Domain.Repositories; 3 | using Abp.Domain.Uow; 4 | using Abp.Zero.SampleApp.Roles; 5 | 6 | namespace Abp.Zero.SampleApp.Users 7 | { 8 | public class UserStore : AbpUserStore 9 | { 10 | public UserStore( 11 | IRepository userRepository, 12 | IRepository userLoginRepository, 13 | IRepository userRoleRepository, 14 | IRepository roleRepository, 15 | IRepository userPermissionSettingRepository, 16 | IUnitOfWorkManager unitOfWorkManager, 17 | IRepository userClaimRepository) 18 | : base( 19 | userRepository, 20 | userLoginRepository, 21 | userRoleRepository, 22 | roleRepository, 23 | userPermissionSettingRepository, 24 | unitOfWorkManager, 25 | userClaimRepository) 26 | { 27 | 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantFeatureCacheItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Abp.MultiTenancy 5 | { 6 | /// 7 | /// Used to store features of a Tenant in the cache. 8 | /// 9 | [Serializable] 10 | public class TenantFeatureCacheItem 11 | { 12 | /// 13 | /// The cache store name. 14 | /// 15 | public const string CacheStoreName = "AbpZeroTenantFeatures"; 16 | 17 | /// 18 | /// Edition of the tenant. 19 | /// 20 | public int? EditionId { get; set; } 21 | 22 | /// 23 | /// Feature values. 24 | /// 25 | public IDictionary FeatureValues { get; private set; } 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public TenantFeatureCacheItem() 31 | { 32 | FeatureValues = new Dictionary(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Authorization/AbpLoginManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Roles; 2 | using Abp.Authorization.Users; 3 | using Abp.MultiTenancy; 4 | using Abp.Threading; 5 | 6 | namespace Abp.Authorization 7 | { 8 | public static class AbpLogInManagerExtensions 9 | { 10 | public static AbpLoginResult Login( 11 | this AbpLogInManager logInManager, 12 | string userNameOrEmailAddress, 13 | string plainPassword, 14 | string tenancyName = null, 15 | bool shouldLockout = true) 16 | where TTenant : AbpTenant 17 | where TRole : AbpRole, new() 18 | where TUser : AbpUser 19 | { 20 | return AsyncHelper.RunSync( 21 | () => logInManager.LoginAsync( 22 | userNameOrEmailAddress, 23 | plainPassword, 24 | tenancyName, 25 | shouldLockout 26 | ) 27 | ); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-es.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Abp.Zero.Owin/Owin/AbpZeroOwinAppBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.Dependency; 3 | using Abp.Extensions; 4 | using Microsoft.Owin.Security.DataProtection; 5 | using Owin; 6 | 7 | namespace Abp.Owin 8 | { 9 | public static class AbpZeroOwinAppBuilderExtensions 10 | { 11 | public static void RegisterDataProtectionProvider(this IAppBuilder app) 12 | { 13 | if (!IocManager.Instance.IsRegistered()) 14 | { 15 | throw new AbpException("IUserTokenProviderAccessor is not registered!"); 16 | } 17 | 18 | var providerAccessor = IocManager.Instance.Resolve(); 19 | if (!(providerAccessor is OwinUserTokenProviderAccessor)) 20 | { 21 | throw new AbpException($"IUserTokenProviderAccessor should be instance of {nameof(OwinUserTokenProviderAccessor)}!"); 22 | } 23 | 24 | providerAccessor.As().DataProtectionProvider = app.GetDataProtectionProvider(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Abp.Zero.Ldap")] 8 | [assembly: AssemblyDescription("ASP.NET Boilerplate - Module Zero - Active Directory Integration")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Volosoft")] 11 | [assembly: AssemblyProduct("Abp.Zero.Ldap")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("f5e590a4-6f9a-4b3c-b4c2-935737e369a0")] -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp/Features/FeatureValueStore.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.Domain.Repositories; 3 | using Abp.Domain.Uow; 4 | using Abp.MultiTenancy; 5 | using Abp.Runtime.Caching; 6 | using Abp.Zero.SampleApp.MultiTenancy; 7 | using Abp.Zero.SampleApp.Users; 8 | 9 | namespace Abp.Zero.SampleApp.Features 10 | { 11 | public class FeatureValueStore : AbpFeatureValueStore 12 | { 13 | public FeatureValueStore(ICacheManager cacheManager, 14 | IRepository tenantFeatureRepository, 15 | IRepository tenantRepository, 16 | IRepository editionFeatureRepository, 17 | IFeatureManager featureManager, 18 | IUnitOfWorkManager unitOfWorkManager) 19 | : base( 20 | cacheManager, 21 | tenantFeatureRepository, 22 | tenantRepository, 23 | editionFeatureRepository, 24 | featureManager, 25 | unitOfWorkManager) 26 | { 27 | 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Owin/Owin/OwinUserTokenProviderAccessor.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Castle.Core.Logging; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.AspNet.Identity.Owin; 5 | using Microsoft.Owin.Security.DataProtection; 6 | 7 | namespace Abp.Owin 8 | { 9 | public class OwinUserTokenProviderAccessor : IUserTokenProviderAccessor 10 | { 11 | public ILogger Logger { get; set; } 12 | 13 | public IDataProtectionProvider DataProtectionProvider { get; set; } 14 | 15 | public OwinUserTokenProviderAccessor() 16 | { 17 | Logger = NullLogger.Instance; 18 | } 19 | 20 | public IUserTokenProvider GetUserTokenProviderOrNull() 21 | where TUser : AbpUser 22 | { 23 | if (DataProtectionProvider == null) 24 | { 25 | Logger.Debug("DataProtectionProvider has not been set yet."); 26 | return null; 27 | } 28 | 29 | return new DataProtectorTokenProvider(DataProtectionProvider.Create("ASP.NET Identity")); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.EntityFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Abp.Zero.SampleApp.EntityFramework")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Volosoft")] 11 | [assembly: AssemblyProduct("Abp.Zero.SampleApp.EntityFramework")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("a13fc3e6-9eee-4c2b-923a-2060f716ec78")] -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-pt-BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/NHibernate/EntityMappings/AbpTenantMap.cs: -------------------------------------------------------------------------------- 1 | using Abp.Authorization.Users; 2 | using Abp.MultiTenancy; 3 | using Abp.NHibernate.EntityMappings; 4 | 5 | namespace Abp.Zero.NHibernate.EntityMappings 6 | { 7 | /// 8 | /// Base class to map classes derived from 9 | /// 10 | /// Tenant type 11 | /// User type 12 | public abstract class AbpTenantMap : EntityMap 13 | where TTenant : AbpTenant 14 | where TUser : AbpUser 15 | { 16 | /// 17 | /// Constructor. 18 | /// 19 | protected AbpTenantMap() 20 | : base("AbpTenants") 21 | { 22 | References(x => x.Edition).Column("EditionId").Nullable(); 23 | 24 | Map(x => x.TenancyName); 25 | Map(x => x.Name); 26 | Map(x => x.IsActive); 27 | 28 | this.MapFullAudited(); 29 | 30 | Polymorphism.Explicit(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-lt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Zero/TestData/TestRolesBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Security.Claims; 3 | using Abp.Authorization.Roles; 4 | using Abp.ZeroCore.SampleApp.Core; 5 | using Abp.ZeroCore.SampleApp.EntityFramework; 6 | 7 | namespace Abp.Zero.TestData 8 | { 9 | public class TestRolesBuilder 10 | { 11 | private readonly SampleAppDbContext _context; 12 | private readonly int _tenantId; 13 | 14 | public TestRolesBuilder(SampleAppDbContext context, int tenantId) 15 | { 16 | _context = context; 17 | _tenantId = tenantId; 18 | } 19 | 20 | public void Create() 21 | { 22 | var role = new Role(_tenantId, "ADMIN", "ADMIN") 23 | { 24 | Claims = new List() 25 | }; 26 | 27 | role.Claims.Add(new RoleClaim(role, new Claim("MyClaim1", "MyClaim1Value"))); 28 | role.Claims.Add(new RoleClaim(role, new Claim("MyClaim2", "MyClaim2Value"))); 29 | 30 | _context.Roles.Add(role); 31 | 32 | _context.SaveChanges(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("AbpAbp.Zero.NHibernate")] 9 | [assembly: AssemblyDescription("ASP.NET Boilerplate - Module Zero - NHibernate Integration")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Volosoft")] 12 | [assembly: AssemblyProduct("Abp.Zero.NHibernate")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("12048deb-de48-485c-a607-ca63d77cee17")] -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Configuration/SettingExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Configuration 2 | { 3 | /// 4 | /// Implements methods to convert objects between SettingInfo and Setting classes. 5 | /// 6 | internal static class SettingExtensions 7 | { 8 | /// 9 | /// Creates new object from given object. 10 | /// 11 | public static Setting ToSetting(this SettingInfo settingInfo) 12 | { 13 | return settingInfo == null 14 | ? null 15 | : new Setting(settingInfo.TenantId, settingInfo.UserId, settingInfo.Name, settingInfo.Value); 16 | } 17 | 18 | /// 19 | /// Creates new object from given object. 20 | /// 21 | public static SettingInfo ToSettingInfo(this Setting setting) 22 | { 23 | return setting == null 24 | ? null 25 | : new SettingInfo(setting.TenantId, setting.UserId, setting.Name, setting.Value); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 ASP.NET Boilerplate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20160824_01_Add_AbpUserLoginAttempts_Table.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2016082401)] 7 | public class _20160824_01_Add_AbpUserLoginAttempts_Table : Migration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpUserLoginAttempts") 12 | .WithTenantIdAsNullable() 13 | .WithColumn("TenancyName").AsString(64).Nullable() 14 | .WithNullableUserId() 15 | .WithColumn("UserNameOrEmailAddress").AsString(255).Nullable() 16 | .WithColumn("ClientIpAddress").AsString(64).Nullable() 17 | .WithColumn("ClientName").AsString(128).Nullable() 18 | .WithColumn("BrowserInfo").AsString(256).Nullable() 19 | .WithColumn("Result").AsByte().NotNullable() 20 | .WithCreationTimeColumn(); 21 | } 22 | 23 | public override void Down() 24 | { 25 | Delete.Table("AbpUserLoginAttempts"); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Abp.Zero.EntityFramework")] 9 | [assembly: AssemblyDescription("ASP.NET Boilerplate - Module Zero - EntityFramework Integration")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Volosoft")] 12 | [assembly: AssemblyProduct("Abp.Zero.EntityFramework")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("785da0b0-f1f6-4a13-8672-fb3088a26c80")] 24 | -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFrameworkCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Abp.Zero.EntityFramework")] 9 | [assembly: AssemblyDescription("ASP.NET Boilerplate - Module Zero - EntityFramework Integration")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Volosoft")] 12 | [assembly: AssemblyProduct("Abp.Zero.EntityFramework")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("785da0b0-f1f6-4a13-8672-fb3088a26c80")] 24 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Authorization/AbpSecurityStampValidator.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Abp.Authorization.Roles; 3 | using Abp.Authorization.Users; 4 | using Abp.Domain.Uow; 5 | using Abp.MultiTenancy; 6 | using Microsoft.AspNetCore.Authentication.Cookies; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.AspNetCore.Identity; 9 | using Microsoft.Extensions.Options; 10 | 11 | namespace Abp.Authorization 12 | { 13 | public class AbpSecurityStampValidator : SecurityStampValidator 14 | where TTenant : AbpTenant 15 | where TRole : AbpRole, new() 16 | where TUser : AbpUser 17 | { 18 | public AbpSecurityStampValidator( 19 | IOptions options, 20 | AbpSignInManager signInManager) 21 | : base( 22 | options, 23 | signInManager) 24 | { 25 | } 26 | 27 | [UnitOfWork] 28 | public override Task ValidateAsync(CookieValidatePrincipalContext context) 29 | { 30 | return base.ValidateAsync(context); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Authorization/Users/AbpUserManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Authorization.Roles; 3 | using Abp.Threading; 4 | 5 | namespace Abp.Authorization.Users 6 | { 7 | /// 8 | /// Extension methods for . 9 | /// 10 | public static class AbpUserManagerExtensions 11 | { 12 | /// 13 | /// Check whether a user is granted for a permission. 14 | /// 15 | /// User manager 16 | /// User id 17 | /// Permission name 18 | public static bool IsGranted(AbpUserManager manager, long userId, string permissionName) 19 | where TRole : AbpRole, new() 20 | where TUser : AbpUser 21 | { 22 | if (manager == null) 23 | { 24 | throw new ArgumentNullException(nameof(manager)); 25 | } 26 | 27 | return AsyncHelper.RunSync(() => manager.IsGrantedAsync(userId, permissionName)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/Users/UserManager_Update_Tests.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Uow; 2 | using Abp.Zero.SampleApp.Users; 3 | using Microsoft.AspNet.Identity; 4 | using Shouldly; 5 | using Xunit; 6 | 7 | namespace Abp.Zero.SampleApp.Tests.Users 8 | { 9 | public class UserManager_Update_Tests : SampleAppTestBase 10 | { 11 | private readonly UserManager _userManager; 12 | private readonly IUnitOfWorkManager _unitOfWorkManager; 13 | 14 | public UserManager_Update_Tests() 15 | { 16 | _userManager = Resolve(); 17 | _unitOfWorkManager = Resolve(); 18 | 19 | AbpSession.TenantId = 1; //Default tenant 20 | } 21 | 22 | [Fact] 23 | public void Should_Not_Change_Admin_UserName() 24 | { 25 | using (var uow = _unitOfWorkManager.Begin()) 26 | { 27 | var adminUser = _userManager.FindByName("admin"); 28 | 29 | adminUser.UserName = "tuana"; 30 | 31 | _userManager.Update(adminUser).Succeeded.ShouldBeFalse(); 32 | 33 | uow.Complete(); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20140323_01_CreateAbpTenantsTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2014032301)] 7 | public class _20140323_01_CreateAbpTenantsTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpTenants") 12 | .WithIdAsInt32() 13 | .WithColumn("TenancyName").AsString(32).NotNullable() 14 | .WithColumn("Name").AsString(128).NotNullable() 15 | .WithCreationTimeColumn(); 16 | 17 | Create.Index("AbpTenants_TenancyName") 18 | .OnTable("AbpTenants") 19 | .OnColumn("TenancyName").Ascending() 20 | .WithOptions().Unique() 21 | .WithOptions().NonClustered(); 22 | 23 | //Default tenant 24 | Insert.IntoTable("AbpTenants").Row( 25 | new 26 | { 27 | TenancyName = "Default", //Reserved TenancyName 28 | Name = "Default" 29 | }); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Abp.ZeroCore.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp1.0 5 | Abp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20151230_09_Revise_AbpTenants.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | 3 | namespace Abp.Zero.FluentMigrator.Migrations 4 | { 5 | [Migration(2015123009)] 6 | public class _20151230_09_Revise_AbpTenants : AutoReversingMigration 7 | { 8 | public override void Up() 9 | { 10 | Alter.Column("TenancyName").OnTable("AbpTenants").AsString(64).NotNullable(); 11 | 12 | Alter.Table("AbpTenants") 13 | .AddColumn("EditionId").AsInt32().Nullable().ForeignKey("AbpEditions", "Id") 14 | .AddCreatorUserIdColumn() 15 | .AddModificationAuditColumns() 16 | .AddDeletionAuditColumns(); 17 | 18 | Create.Index("IX_EditionId") 19 | .OnTable("AbpTenants") 20 | .OnColumn("EditionId").Ascending() 21 | .WithOptions().NonClustered(); 22 | 23 | Create.Index("IX_IsDeleted_TenancyName") 24 | .OnTable("AbpTenants") 25 | .OnColumn("IsDeleted").Ascending() 26 | .OnColumn("TenancyName").Ascending() 27 | .WithOptions().NonClustered(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantFeatureCacheItemInvalidator.cs: -------------------------------------------------------------------------------- 1 | using Abp.Dependency; 2 | using Abp.Events.Bus.Entities; 3 | using Abp.Events.Bus.Handlers; 4 | using Abp.Runtime.Caching; 5 | 6 | namespace Abp.MultiTenancy 7 | { 8 | /// 9 | /// This class handles related events and invalidated tenant feature cache items if needed. 10 | /// 11 | public class TenantFeatureCacheItemInvalidator : 12 | IEventHandler>, 13 | ITransientDependency 14 | { 15 | private readonly ICacheManager _cacheManager; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The cache manager. 21 | public TenantFeatureCacheItemInvalidator(ICacheManager cacheManager) 22 | { 23 | _cacheManager = cacheManager; 24 | } 25 | 26 | public void HandleEvent(EntityChangedEventData eventData) 27 | { 28 | _cacheManager.GetTenantFeatureCache().Remove(eventData.Entity.TenantId); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /test/Abp.Zero.SampleApp.Tests/Users/UserRepository_Tests.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Repositories; 2 | using Abp.Zero.SampleApp.Users; 3 | using Shouldly; 4 | using Xunit; 5 | 6 | namespace Abp.Zero.SampleApp.Tests.Users 7 | { 8 | public class UserRepository_Tests : SampleAppTestBase 9 | { 10 | [Fact] 11 | public void Should_Insert_And_Retrieve_User() 12 | { 13 | var userRepository = LocalIocManager.Resolve>(); 14 | 15 | userRepository.FirstOrDefault(u => u.EmailAddress == "admin@aspnetboilerplate.com").ShouldBe(null); 16 | 17 | userRepository.Insert(new User 18 | { 19 | TenantId = null, 20 | UserName = "admin", 21 | Name = "System", 22 | Surname = "Administrator", 23 | EmailAddress = "admin@aspnetboilerplate.com", 24 | IsEmailConfirmed = true, 25 | Password = "AM4OLBpptxBYmM79lGOX9egzZk3vIQU3d/gFCJzaBjAPXzYIK3tQ2N7X4fcrHtElTw==" //123qwe 26 | }); 27 | 28 | userRepository.FirstOrDefault(u => u.EmailAddress == "admin@aspnetboilerplate.com").ShouldNotBe(null); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Abp.Zero.NHibernate/Zero/FluentMigrator/Migrations/_20150811_02_CreateAbpAuditLogsTable.cs: -------------------------------------------------------------------------------- 1 | using Abp.FluentMigrator.Extensions; 2 | using FluentMigrator; 3 | 4 | namespace Abp.Zero.FluentMigrator.Migrations 5 | { 6 | [Migration(2015081102)] 7 | public class _20150811_02_CreateAbpAuditLogsTable : AutoReversingMigration 8 | { 9 | public override void Up() 10 | { 11 | Create.Table("AbpAuditLogs") 12 | .WithIdAsInt64() 13 | .WithTenantIdAsNullable() 14 | .WithNullableUserId() 15 | .WithColumn("ServiceName").AsString(256).Nullable() 16 | .WithColumn("MethodName").AsString(256).Nullable() 17 | .WithColumn("Parameters").AsString(1024).Nullable() 18 | .WithColumn("ExecutionTime").AsDateTime().NotNullable() 19 | .WithColumn("ExecutionDuration").AsInt32().NotNullable() 20 | .WithColumn("ClientIpAddress").AsString(64).Nullable() 21 | .WithColumn("ClientName").AsString(128).Nullable() 22 | .WithColumn("BrowserInfo").AsString(256).Nullable() 23 | .WithColumn("Exception").AsString(2000).Nullable(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /test/Abp.ZeroCore.SampleApp/Core/ServicesCollectionDependencyRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Abp.ZeroCore.SampleApp.Core 4 | { 5 | public static class ServicesCollectionDependencyRegistrar 6 | { 7 | public static void Register(ServiceCollection services) 8 | { 9 | services.AddLogging(); 10 | 11 | services.AddAbpIdentity() 12 | .AddAbpTenantManager() 13 | .AddAbpEditionManager() 14 | .AddAbpRoleManager() 15 | .AddAbpUserManager() 16 | .AddAbpSignInManager() 17 | .AddAbpLogInManager() 18 | .AddAbpUserClaimsPrincipalFactory() 19 | .AddAbpSecurityStampValidator() 20 | .AddPermissionChecker() 21 | .AddAbpUserStore() 22 | .AddAbpRoleStore() 23 | .AddFeatureValueStore() 24 | .AddDefaultTokenProviders(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Zero/Localization/Source/AbpZero-fr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore.IdentityServer4/IdentityServer4/AbpZeroCoreIdentityServerModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.AutoMapper; 2 | using Abp.Modules; 3 | using Abp.Reflection.Extensions; 4 | using Abp.Zero; 5 | using IdentityServer4.Models; 6 | 7 | namespace Abp.IdentityServer4 8 | { 9 | [DependsOn(typeof(AbpZeroCoreModule), typeof(AbpAutoMapperModule))] 10 | public class AbpZeroCoreIdentityServerModule : AbpModule 11 | { 12 | public override void PreInitialize() 13 | { 14 | Configuration.Modules.AbpAutoMapper().Configurators.Add(config => 15 | { 16 | //PersistedGrant -> PersistedGrantEntity 17 | config.CreateMap() 18 | .ForMember(d => d.Id, c => c.MapFrom(s => s.Key)); 19 | 20 | //PersistedGrantEntity -> PersistedGrant 21 | config.CreateMap() 22 | .ForMember(d => d.Key, c => c.MapFrom(s => s.Id)); 23 | }); 24 | } 25 | 26 | public override void Initialize() 27 | { 28 | IocManager.RegisterAssemblyByConvention(typeof(AbpZeroCoreIdentityServerModule).GetAssembly()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/Abp.ZeroCore.Tests/Zero/AbpZeroTestModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.AutoMapper; 3 | using Abp.Modules; 4 | using Abp.Reflection.Extensions; 5 | using Abp.TestBase; 6 | using Abp.Zero.Configuration; 7 | using Abp.ZeroCore.SampleApp; 8 | 9 | namespace Abp.Zero 10 | { 11 | [DependsOn(typeof(AbpZeroCoreSampleAppModule), typeof(AbpTestBaseModule))] 12 | public class AbpZeroTestModule : AbpModule 13 | { 14 | public AbpZeroTestModule(AbpZeroCoreSampleAppModule sampleAppModule) 15 | { 16 | sampleAppModule.SkipDbContextRegistration = true; 17 | } 18 | 19 | public override void PreInitialize() 20 | { 21 | Configuration.Modules.AbpAutoMapper().UseStaticMapper = false; 22 | Configuration.BackgroundJobs.IsJobExecutionEnabled = false; 23 | Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); 24 | Configuration.UnitOfWork.IsTransactional = false; 25 | } 26 | 27 | public override void Initialize() 28 | { 29 | IocManager.RegisterAssemblyByConvention(typeof(AbpZeroTestModule).GetAssembly()); 30 | TestServiceCollectionRegistrar.Register(IocManager); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Abp.Zero.Common/MultiTenancy/TenantFeatureSetting.cs: -------------------------------------------------------------------------------- 1 | using Abp.Application.Features; 2 | using Abp.Domain.Entities; 3 | 4 | namespace Abp.MultiTenancy 5 | { 6 | /// 7 | /// Feature setting for a Tenant (). 8 | /// 9 | public class TenantFeatureSetting : FeatureSetting, IMustHaveTenant 10 | { 11 | /// 12 | /// Tenant's Id. 13 | /// 14 | public virtual int TenantId { get; set; } 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public TenantFeatureSetting() 20 | { 21 | 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The tenant identifier. 28 | /// Feature name. 29 | /// Feature value. 30 | public TenantFeatureSetting(int tenantId, string name, string value) 31 | :base(name, value) 32 | { 33 | TenantId = tenantId; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Abp.Zero.Common/Organizations/IOrganizationUnitSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Abp.Organizations 4 | { 5 | /// 6 | /// Used to get settings related to OrganizationUnits. 7 | /// 8 | public interface IOrganizationUnitSettings 9 | { 10 | /// 11 | /// GetsMaximum allowed organization unit membership count for a user. 12 | /// Returns value for current tenant. 13 | /// 14 | int MaxUserMembershipCount { get; } 15 | 16 | /// 17 | /// Gets Maximum allowed organization unit membership count for a user. 18 | /// Returns value for given tenant. 19 | /// 20 | /// The tenant Id or null for the host. 21 | Task GetMaxUserMembershipCountAsync(int? tenantId); 22 | 23 | /// 24 | /// Sets Maximum allowed organization unit membership count for a user. 25 | /// 26 | /// The tenant Id or null for the host. 27 | /// Setting value. 28 | /// 29 | Task SetMaxUserMembershipCountAsync(int? tenantId, int value); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Abp.Zero.EntityFramework/Zero/EntityFramework/AbpZeroEntityFrameworkModule.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Abp.Domain.Uow; 3 | using Abp.EntityFramework; 4 | using Abp.Modules; 5 | using Abp.MultiTenancy; 6 | using Castle.MicroKernel.Registration; 7 | 8 | namespace Abp.Zero.EntityFramework 9 | { 10 | /// 11 | /// Entity framework integration module for ASP.NET Boilerplate Zero. 12 | /// 13 | [DependsOn(typeof(AbpZeroCoreModule), typeof(AbpEntityFrameworkModule))] 14 | public class AbpZeroEntityFrameworkModule : AbpModule 15 | { 16 | public override void PreInitialize() 17 | { 18 | Configuration.ReplaceService(typeof(IConnectionStringResolver), () => 19 | { 20 | IocManager.IocContainer.Register( 21 | Component.For() 22 | .ImplementedBy() 23 | .LifestyleTransient() 24 | ); 25 | }); 26 | } 27 | 28 | public override void Initialize() 29 | { 30 | IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Abp.ZeroCore/Zero/Localization/SourceExt/AbpZero-it.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Si è verificato un errore non gestito. 5 | Email '{0}' già utilizzata. 6 | Email '{0}' non valida. 7 | Token non valido. 8 | Nome utente {0} non valido, sono ammesse solo lettere e numeri. 9 | Password errata. 10 | La password deve avere almeno {0} caratteri. 11 | Il ruolo {0} non esiste. 12 | Password già impostata per l'utente. 13 | Ruolo già assegnato all'utente. 14 | Blocco non abilitato per questo utente. 15 | L'utente {0} non esiste. 16 | Ruolo mancate per l'utente. 17 | 18 | -------------------------------------------------------------------------------- /src/Abp.Zero.Ldap/Ldap/Configuration/LdapSettingNames.cs: -------------------------------------------------------------------------------- 1 | namespace Abp.Zero.Ldap.Configuration 2 | { 3 | /// 4 | /// Contains consts for LDAP setting names. 5 | /// 6 | public static class LdapSettingNames 7 | { 8 | /// 9 | /// Abp.Zero.Ldap.IsEnabled 10 | /// 11 | public const string IsEnabled = "Abp.Zero.Ldap.IsEnabled"; 12 | 13 | /// 14 | /// Abp.Zero.Ldap.ContextType 15 | /// 16 | public const string ContextType = "Abp.Zero.Ldap.ContextType"; 17 | 18 | /// 19 | /// Abp.Zero.Ldap.Container 20 | /// 21 | public const string Container = "Abp.Zero.Ldap.Container"; 22 | 23 | /// 24 | /// Abp.Zero.Ldap.Domain 25 | /// 26 | public const string Domain = "Abp.Zero.Ldap.Domain"; 27 | 28 | /// 29 | /// Abp.Zero.Ldap.UserName 30 | /// 31 | public const string UserName = "Abp.Zero.Ldap.UserName"; 32 | 33 | /// 34 | /// Abp.Zero.Ldap.Password 35 | /// 36 | public const string Password = "Abp.Zero.Ldap.Password"; 37 | } 38 | } --------------------------------------------------------------------------------