mirror of https://github.com/abpframework/abp.git
26 changed files with 426 additions and 41 deletions
@ -0,0 +1,21 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<AssemblyName>Volo.Abp.Permissions.Application.Contracts</AssemblyName> |
||||
|
<PackageId>Volo.Abp.Permissions.Application.Contracts</PackageId> |
||||
|
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\Volo.Abp.Ddd\Volo.Abp.Ddd.csproj" /> |
||||
|
<ProjectReference Include="..\Volo.Abp.Permissions.Domain.Shared\Volo.Abp.Permissions.Domain.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
[DependsOn(typeof(AbpDddModule))] |
||||
|
[DependsOn(typeof(AbpPermissionsDomainSharedModule))] |
||||
|
public class AbpPermissionsApplicationContractsModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.AddAssemblyOf<AbpPermissionsDomainSharedModule>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
public interface IPermissionAppService : IApplicationService |
||||
|
{ |
||||
|
Task<PermissionGrantInfoDto> GetAsync([NotNull] string name, [NotNull] string providerName, [NotNull] string providerKey); |
||||
|
|
||||
|
Task<List<PermissionGrantInfoDto>> GetListAsync([NotNull] string providerName, [NotNull] string providerKey); |
||||
|
|
||||
|
Task UpdateAsync([NotNull] string providerName, [NotNull] string providerKey, UpdatePermissionsDto input); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
public class PermissionGrantInfoDto |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string ParentName { get; set; } |
||||
|
|
||||
|
public bool IsGranted { get; set; } |
||||
|
|
||||
|
public string ProviderName { get; set; } |
||||
|
|
||||
|
public string ProviderKey { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
public class UpdatePermissionDto |
||||
|
{ |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public bool IsGranted { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
public class UpdatePermissionsDto |
||||
|
{ |
||||
|
public UpdatePermissionDto[] Permissions { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<AssemblyName>Volo.Abp.Permissions.Application</AssemblyName> |
||||
|
<PackageId>Volo.Abp.Permissions.Application</PackageId> |
||||
|
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\Volo.Abp.Permissions.Application.Contracts\Volo.Abp.Permissions.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\Volo.Abp.Permissions.Domain\Volo.Abp.Permissions.Domain.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
[DependsOn(typeof(AbpPermissionsDomainModule))] |
||||
|
[DependsOn(typeof(AbpPermissionsApplicationContractsModule))] |
||||
|
public class AbpPermissionsApplicationModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.AddAssemblyOf<AbpPermissionsApplicationModule>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions |
||||
|
{ |
||||
|
public class PermissionAppService : ApplicationService, IPermissionAppService |
||||
|
{ |
||||
|
private readonly IPermissionManager _permissionManager; |
||||
|
|
||||
|
public PermissionAppService(IPermissionManager permissionManager) |
||||
|
{ |
||||
|
_permissionManager = permissionManager; |
||||
|
} |
||||
|
|
||||
|
public async Task<PermissionGrantInfoDto> GetAsync(string name, string providerName, string providerKey) |
||||
|
{ |
||||
|
var result = await _permissionManager.IsGrantedAsync(name, providerName, providerKey); |
||||
|
|
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public async Task<List<PermissionGrantInfoDto>> GetListAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public async Task UpdateAsync(string providerName, string providerKey, UpdatePermissionsDto input) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using AutoMapper; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions.Web |
||||
|
{ |
||||
|
public class AbpPermissionsWebAutoMapperProfile : Profile |
||||
|
{ |
||||
|
public AbpPermissionsWebAutoMapperProfile() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
private void CreatePermissionMappings() |
||||
|
{ |
||||
|
//...
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Permissions.Web.Localization.Resources.AbpPermissions; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions.Web |
||||
|
{ |
||||
|
[DependsOn(typeof(AbpPermissionsApplicationContractsModule))] |
||||
|
[DependsOn(typeof(AbpAspNetCoreMvcUiBootstrapModule))] |
||||
|
[DependsOn(typeof(AbpAutoMapperModule))] |
||||
|
public class AbpPermissionsWebModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.AddAssemblyResource(typeof(AbpPermissionsResource)); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(IServiceCollection services) |
||||
|
{ |
||||
|
services.AddAssemblyOf<AbpPermissionsWebModule>(); |
||||
|
|
||||
|
services.Configure<VirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<AbpPermissionsWebModule>("Volo.Abp.Permissions.Web"); |
||||
|
}); |
||||
|
|
||||
|
services.Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources.AddVirtualJson<AbpPermissionsResource>("en", "/Localization/Resources/AbpPermissions"); |
||||
|
}); |
||||
|
|
||||
|
services.Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddProfile<AbpPermissionsWebAutoMapperProfile>(validate: true); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Localization.Resources.AbpBootstrap; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Localization.Resources.AbpValidation; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions.Web.Localization.Resources.AbpPermissions |
||||
|
{ |
||||
|
[InheritResource( |
||||
|
typeof(AbpValidationResource), |
||||
|
typeof(AbpBootstrapResource))] |
||||
|
[ShortLocalizationResourceName("AbpPermissions")] |
||||
|
public class AbpPermissionsResource |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"Users": "Users", |
||||
|
"NewUser": "New user", |
||||
|
"UserName": "User name", |
||||
|
"EmailAddress": "Email address", |
||||
|
"PhoneNumber": "Phone number", |
||||
|
"UserInformations": "User informations", |
||||
|
"Roles": "Roles", |
||||
|
"Password": "Password", |
||||
|
"UserDeletionConfirmationMessage": "User '{0}' will be deleted. Do you confirm that?", |
||||
|
"TwoFactorVerification": "Two factor verification", |
||||
|
"AccountLockoutOnFailedLoginAttempts": "Locking account after failed login attempts", |
||||
|
"NewRole": "New role", |
||||
|
"RoleName": "Role name" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
{ |
||||
|
"culture": "tr", |
||||
|
"texts": { |
||||
|
"Users": "Kullanıcılar", |
||||
|
"NewUser": "Yeni kullanıcı", |
||||
|
"Actions": "İşlemler", |
||||
|
"UserName": "Kullanıcı adı", |
||||
|
"EmailAddress": "E-posta adresi", |
||||
|
"PhoneNumber": "Telefon numarası", |
||||
|
"UserInformations": "Kullanıcı bilgileri", |
||||
|
"Roles": "Roller", |
||||
|
"Close": "Kapat", |
||||
|
"Delete": "Sil", |
||||
|
"Edit": "Düzenle", |
||||
|
"Save": "Kaydet", |
||||
|
"Password": "Şifre", |
||||
|
"UserDeletionConfirmationMessage": "{0} kullanıcısı silinecektir. Onaylıyor musunuz?", |
||||
|
"TwoFactorVerification": "İki aşamalı doğrumala", |
||||
|
"AccountLockoutOnFailedLoginAttempts": "Başarısız giriş denemeleri sonrası hesabı kilitleme", |
||||
|
"NewRole": "Yeni rol", |
||||
|
"RoleName": "Rol adı", |
||||
|
"CreationTime": "Oluşturma zamanı" |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
@page |
||||
|
@using Volo.Abp.Permissions.Web.Pages.Permissions |
||||
|
@model PermissionManagementModal |
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
<form method="post" asp-page="/Identity/Roles/CreateModal"> |
||||
|
|
||||
|
<abp-modal> |
||||
|
|
||||
|
<abp-modal-header title="@L["NewRole"]"></abp-modal-header> |
||||
|
|
||||
|
<abp-modal-body> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label asp-for="RoleModel.Name"></label> |
||||
|
<input asp-for="RoleModel.Name" class="form-control"/> |
||||
|
<span asp-validation-for="RoleModel.Name" class="text-danger"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div asp-validation-summary="All" class="text-danger"></div> |
||||
|
|
||||
|
</abp-modal-body> |
||||
|
|
||||
|
<abp-modal-footer></abp-modal-footer> |
||||
|
|
||||
|
</abp-modal> |
||||
|
|
||||
|
</form> |
||||
@ -0,0 +1,33 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace Volo.Abp.Permissions.Web.Pages.Permissions |
||||
|
{ |
||||
|
public class PermissionManagementModal : AbpPageModel |
||||
|
{ |
||||
|
[BindProperty] |
||||
|
public PerminssionInfoModel[] Permissions { get; set; } |
||||
|
|
||||
|
public async Task OnGetAsync() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async Task<IActionResult> OnPostAsync() |
||||
|
{ |
||||
|
ValidateModel(); |
||||
|
|
||||
|
return NoContent(); |
||||
|
} |
||||
|
|
||||
|
public class PerminssionInfoModel |
||||
|
{ |
||||
|
[Required] |
||||
|
//[StringLength(IdentityRoleConsts.MaxNameLength)]
|
||||
|
[Display(Name = "RoleName")] |
||||
|
public string Name { get; set; } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
{ |
||||
|
"iisSettings": { |
||||
|
"windowsAuthentication": false, |
||||
|
"anonymousAuthentication": true, |
||||
|
"iisExpress": { |
||||
|
"applicationUrl": "http://localhost:49258/", |
||||
|
"sslPort": 0 |
||||
|
} |
||||
|
}, |
||||
|
"profiles": { |
||||
|
"IIS Express": { |
||||
|
"commandName": "IISExpress", |
||||
|
"launchBrowser": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
} |
||||
|
}, |
||||
|
"Volo.Abp.Permissions.Web": { |
||||
|
"commandName": "Project", |
||||
|
"launchBrowser": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
}, |
||||
|
"applicationUrl": "http://localhost:49259/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<AssemblyName>Volo.Abp.Permissions.Web</AssemblyName> |
||||
|
<PackageId>Volo.Abp.Permissions.Web</PackageId> |
||||
|
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
||||
|
<OutputType>Library</OutputType> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="wwwroot\**\*.*" /> |
||||
|
<EmbeddedResource Include="Pages\**\*.cshtml" /> |
||||
|
<EmbeddedResource Include="Localization\Resources\**\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Remove="Localization\Resources\AbpPermissions\en.json" /> |
||||
|
<EmbeddedResource Remove="Localization\Resources\AbpPermissions\tr.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" /> |
||||
|
<ProjectReference Include="..\Volo.Abp.Permissions.Application.Contracts\Volo.Abp.Permissions.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
Loading…
Reference in new issue