Skip to content

Commit

Permalink
Upgraded to ABP 0.5.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hikalkan committed Mar 11, 2015
1 parent 67f1d1f commit 2338fe6
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/Abp.Zero.EntityFramework/Abp.Zero.EntityFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<DocumentationFile>bin\Release\Abp.Zero.EntityFramework.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Abp, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.0.5.6.0\lib\net451\Abp.dll</HintPath>
<HintPath>..\packages\Abp.0.5.7.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Abp.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Abp.Zero.EntityFramework/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.6.0" targetFramework="net451" />
<package id="Abp" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
Expand Down
4 changes: 2 additions & 2 deletions src/Abp.Zero.NHibernate/Abp.Zero.NHibernate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<DocumentationFile>bin\Release\Abp.Zero.NHibernate.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Abp, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.0.5.6.0\lib\net451\Abp.dll</HintPath>
<HintPath>..\packages\Abp.0.5.7.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Abp.FluentMigrator, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Abp.Zero.NHibernate/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.6.0" targetFramework="net451" />
<package id="Abp" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.FluentMigrator" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.NHibernate" version="0.5.6.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
Expand Down
4 changes: 2 additions & 2 deletions src/Abp.Zero/Abp.Zero.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<DocumentationFile>bin\Release\Abp.Zero.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Abp, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.0.5.6.0\lib\net451\Abp.dll</HintPath>
<HintPath>..\packages\Abp.0.5.7.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
32 changes: 23 additions & 9 deletions src/Abp.Zero/Authorization/Roles/AbpRoleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected AbpRoleManager(AbpRoleStore<TTenant, TRole, TUser> store, IPermissionM
/// <returns>True, if the role has the permission</returns>
public virtual async Task<bool> HasPermissionAsync(string roleName, string permissionName)
{
return await HasPermissionAsync(await GetRole(roleName), _permissionManager.GetPermission(permissionName));
return await HasPermissionAsync(await GetRoleByNameAsync(roleName), _permissionManager.GetPermission(permissionName));
}

/// <summary>
Expand All @@ -66,7 +66,7 @@ public virtual async Task<bool> HasPermissionAsync(string roleName, string permi
/// <returns>True, if the role has the permission</returns>
public virtual async Task<bool> HasPermissionAsync(int roleId, string permissionName)
{
return await HasPermissionAsync(await GetRole(roleId), _permissionManager.GetPermission(permissionName));
return await HasPermissionAsync(await GetRoleByIdAsync(roleId), _permissionManager.GetPermission(permissionName));
}

/// <summary>
Expand All @@ -89,7 +89,7 @@ public async Task<bool> HasPermissionAsync(TRole role, Permission permission)
/// <returns>List of granted permissions</returns>
public virtual async Task<IReadOnlyList<Permission>> GetGrantedPermissionsAsync(int roleId)
{
return await GetGrantedPermissionsAsync(await GetRole(roleId));
return await GetGrantedPermissionsAsync(await GetRoleByIdAsync(roleId));
}

/// <summary>
Expand All @@ -99,7 +99,7 @@ public virtual async Task<IReadOnlyList<Permission>> GetGrantedPermissionsAsync(
/// <returns>List of granted permissions</returns>
public virtual async Task<IReadOnlyList<Permission>> GetGrantedPermissionsAsync(string roleName)
{
return await GetGrantedPermissionsAsync(await GetRole(roleName));
return await GetGrantedPermissionsAsync(await GetRoleByNameAsync(roleName));
}

/// <summary>
Expand Down Expand Up @@ -130,7 +130,7 @@ public virtual async Task<IReadOnlyList<Permission>> GetGrantedPermissionsAsync(
/// <param name="permissions">Permissions</param>
public virtual async Task SetGrantedPermissionsAsync(int roleId, IEnumerable<Permission> permissions)
{
await SetGrantedPermissionsAsync(await GetRole(roleId), permissions);
await SetGrantedPermissionsAsync(await GetRoleByIdAsync(roleId), permissions);
}

/// <summary>
Expand Down Expand Up @@ -250,23 +250,37 @@ public override Task<IdentityResult> DeleteAsync(TRole role)
return base.DeleteAsync(role);
}

private async Task<TRole> GetRole(int roleId)
/// <summary>
/// Gets a role by given id.
/// Throws exception if no role with given id.
/// </summary>
/// <param name="roleId">Role id</param>
/// <returns>Role</returns>
/// <exception cref="AbpException">Throws exception if no role with given id</exception>
public virtual async Task<TRole> GetRoleByIdAsync(int roleId)
{
var role = await FindByIdAsync(roleId);
if (role == null)
{
throw new AbpException("There is no role with id = " + roleId);
throw new AbpException("There is no role with id: " + roleId);
}

return role;
}

private async Task<TRole> GetRole(string roleName)
/// <summary>
/// Gets a role by given name.
/// Throws exception if no role with given roleName.
/// </summary>
/// <param name="roleName">Role name</param>
/// <returns>Role</returns>
/// <exception cref="AbpException">Throws exception if no role with given roleName</exception>
public virtual async Task<TRole> GetRoleByNameAsync(string roleName)
{
var role = await FindByNameAsync(roleName);
if (role == null)
{
throw new AbpException("There is no role with name = " + roleName);
throw new AbpException("There is no role with name: " + roleName);
}

return role;
Expand Down
13 changes: 10 additions & 3 deletions src/Abp.Zero/Authorization/Users/AbpUserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected AbpUserManager(
public virtual async Task<bool> IsGrantedAsync(long userId, string permissionName)
{
return await IsGrantedAsync(
await GetUser(userId),
await GetUserByIdAsync(userId),
_permissionManager.GetPermission(permissionName)
);
}
Expand Down Expand Up @@ -292,12 +292,19 @@ public virtual async Task<AbpLoginResult> LoginAsync(string userNameOrEmailAddre
return new AbpLoginResult(user, identity);
}

private async Task<TUser> GetUser(long userId)
/// <summary>
/// Gets a user by given id.
/// Throws exception if no user found with given id.
/// </summary>
/// <param name="userId">User id</param>
/// <returns>User</returns>
/// <exception cref="AbpException">Throws exception if no user found with given id</exception>
public virtual async Task<TUser> GetUserByIdAsync(long userId)
{
var user = await FindByIdAsync(userId);
if (user == null)
{
throw new AbpException("There is no user with id = " + userId);
throw new AbpException("There is no user with id: " + userId);
}

return user;
Expand Down
15 changes: 15 additions & 0 deletions src/Abp.Zero/MultiTenancy/AbpTenant.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Authorization.Users;
using Abp.Configuration;
Expand All @@ -15,15 +16,29 @@ public class AbpTenant<TTenant, TUser> : AuditedEntity<int, TUser>, IPassivable
where TUser : AbpUser<TTenant, TUser>
where TTenant : AbpTenant<TTenant, TUser>
{
/// <summary>
/// Max length of the <see cref="TenancyName"/> property.
/// </summary>
public const int MaxTenancyNameLength = 64;

/// <summary>
/// Max length of the <see cref="Name"/> property.
/// </summary>
public const int MaxNameLength = 128;

/// <summary>
/// Tenancy name. This property is the UNIQUE name of this Tenant.
/// It can be used as subdomain name in a web application.
/// </summary>
[Required]
[StringLength(MaxTenancyNameLength)]
public virtual string TenancyName { get; set; }

/// <summary>
/// Display name of the Tenant.
/// </summary>
[Required]
[StringLength(MaxNameLength)]
public virtual string Name { get; set; }

/// <summary>
Expand Down
7 changes: 3 additions & 4 deletions src/Abp.Zero/Runtime/Session/AbpSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Abp.Dependency;
using Abp.MultiTenancy;
using Abp.Runtime.Security;
using Abp.Zero.Configuration;
using Microsoft.AspNet.Identity;

namespace Abp.Runtime.Session
Expand Down Expand Up @@ -55,13 +54,13 @@ public int? TenantId
}
}

public MultiTenancySide MultiTenancySide
public MultiTenancySides MultiTenancySides //TODO: Rename to MultiTenancySide in ABP framework!
{
get
{
return _multiTenancy.IsEnabled && !TenantId.HasValue
? MultiTenancySide.Host
: MultiTenancySide.Tenant;
? MultiTenancySides.Host
: MultiTenancySides.Tenant;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Abp.Zero/Zero/AbpZeroCoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AbpZeroCoreModule : AbpModule
/// <summary>
/// Current version of the zero module.
/// </summary>
public const string CurrentVersion = "0.5.8.0";
public const string CurrentVersion = "0.5.9.0";

public override void PreInitialize()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Abp.Zero/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.6.0" targetFramework="net451" />
<package id="Abp" version="0.5.7.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Abp, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.0.5.6.0\lib\net451\Abp.dll</HintPath>
<HintPath>..\..\packages\Abp.0.5.7.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Abp.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.EntityFramework.0.5.6.0\lib\net451\Abp.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Abp.TestBase, Version=0.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.TestBase, Version=0.1.5.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.TestBase.0.1.4.0\lib\net451\Abp.TestBase.dll</HintPath>
<HintPath>..\..\packages\Abp.TestBase.0.1.5.0\lib\net451\Abp.TestBase.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Abp.Zero.SampleApp.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.6.0" targetFramework="net451" />
<package id="Abp" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.TestBase" version="0.1.4.0" targetFramework="net451" />
<package id="Abp.TestBase" version="0.1.5.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Abp.Zero.SampleApp/Abp.Zero.SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Abp, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.0.5.6.0\lib\net451\Abp.dll</HintPath>
<HintPath>..\..\packages\Abp.0.5.7.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Abp.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
1 change: 1 addition & 0 deletions src/Tests/Abp.Zero.SampleApp/SampleAppModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public override void PreInitialize()
{
Configuration.Authorization.Providers.Add<AppAuthorizationProvider>();
Configuration.Settings.Providers.Add<AppSettingProvider>();
Configuration.MultiTenancy.IsEnabled = true;
}

public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Abp.Zero.SampleApp/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.6.0" targetFramework="net451" />
<package id="Abp" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
Expand Down

0 comments on commit 2338fe6

Please sign in to comment.