changes: - Masive permission update
- Enhacement security permission in app services - Permission Name creation
This commit is contained in:
@@ -14,8 +14,12 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Abp.Collections.Extensions;
|
||||
using Abp.Extensions;
|
||||
|
||||
using Abp.Authorization;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Email
|
||||
{
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Templates)]
|
||||
public class EmailTemplateAppService : ApplicationService, IEmailTemplateAppService
|
||||
{
|
||||
private readonly IRepository<SplashEmailTemplate, Guid> _emailTemplateRepository;
|
||||
@@ -51,6 +55,7 @@ namespace SplashPage.Email
|
||||
return MapToDto(template); // Use manual mapping instead of ObjectMapper
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Templates_Create)]
|
||||
public async Task<SplashEmailTemplateDto> CreateAsync(CreateSplashEmailTemplateDto input)
|
||||
{
|
||||
// Manual mapping instead of ObjectMapper
|
||||
@@ -73,6 +78,7 @@ namespace SplashPage.Email
|
||||
return MapToDto(template);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Templates_Edit)]
|
||||
public async Task<SplashEmailTemplateDto> UpdateAsync(Guid id, UpdateSplashEmailTemplateDto input)
|
||||
{
|
||||
var template = await _emailTemplateRepository.GetAsync(id);
|
||||
@@ -93,6 +99,7 @@ namespace SplashPage.Email
|
||||
return MapToDto(template);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Templates_Delete)]
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await _emailTemplateRepository.DeleteAsync(id);
|
||||
|
||||
@@ -15,8 +15,12 @@ using Abp.Extensions;
|
||||
using SplashPage.Splash.Dto;
|
||||
using Abp.Timing;
|
||||
|
||||
using Abp.Authorization;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Email.Scheduler
|
||||
{
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled)]
|
||||
public class ScheduledEmailAppService : ApplicationService, IScheduledEmailAppService
|
||||
{
|
||||
private readonly IRepository<SplashScheduledEmail, Guid> _scheduledEmailRepository;
|
||||
@@ -68,8 +72,9 @@ namespace SplashPage.Email.Scheduler
|
||||
return MapToDto(scheduledEmail);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled_Create)]
|
||||
public async Task<SplashScheduledEmailDto> CreateAsync(CreateSplashScheduledEmailDto input)
|
||||
{
|
||||
{
|
||||
// Validate email template exists
|
||||
var template = await _emailTemplateRepository.GetAsync(input.EmailTemplateId);
|
||||
if (!template.IsActive)
|
||||
@@ -107,6 +112,7 @@ namespace SplashPage.Email.Scheduler
|
||||
return await GetAsync(scheduledEmail.Id);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled_Edit)]
|
||||
public async Task<SplashScheduledEmailDto> UpdateAsync(Guid id, UpdateSplashScheduledEmailDto input)
|
||||
{
|
||||
var scheduledEmail = await _scheduledEmailRepository.GetAsync(id);
|
||||
@@ -139,11 +145,13 @@ namespace SplashPage.Email.Scheduler
|
||||
return await GetAsync(id);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled_Delete)]
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await _scheduledEmailRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled_Edit)]
|
||||
public async Task<SplashScheduledEmailDto> CancelAsync(Guid id)
|
||||
{
|
||||
var scheduledEmail = await _scheduledEmailRepository.GetAsync(id);
|
||||
@@ -160,6 +168,7 @@ namespace SplashPage.Email.Scheduler
|
||||
return await GetAsync(id);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Email_Scheduled_Edit)]
|
||||
public async Task<SplashScheduledEmailDto> ReactivateAsync(Guid id)
|
||||
{
|
||||
var scheduledEmail = await _scheduledEmailRepository.GetAsync(id);
|
||||
|
||||
@@ -17,10 +17,11 @@ using Abp.Authorization;
|
||||
using Newtonsoft.Json;
|
||||
using Abp.Linq.Extensions;
|
||||
using SplashPage.Integrations.Dtos.ZeroBounce;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Integrations
|
||||
{
|
||||
//[AbpAuthorize]
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations)]
|
||||
public class IntegrationAppService : ApplicationService, IIntegrationAppService
|
||||
{
|
||||
private readonly IRepository<SplashIntegration> _integrationRepository;
|
||||
@@ -68,6 +69,7 @@ namespace SplashPage.Integrations
|
||||
return _objectMapper.Map<SplashIntegrationDto>(entity);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Create)]
|
||||
public async Task<SplashIntegrationDto> CreateAsync(CreateSplashIntegrationDto input)
|
||||
{
|
||||
var entity = _objectMapper.Map<SplashIntegration>(input);
|
||||
@@ -78,20 +80,23 @@ namespace SplashPage.Integrations
|
||||
return _objectMapper.Map<SplashIntegrationDto>(insertedEntity);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task<SplashIntegrationDto> UpdateAsync(UpdateSplashIntegrationDto input)
|
||||
{
|
||||
var entity = await _integrationRepository.GetAsync(input.Id);
|
||||
_objectMapper.Map(input, entity);
|
||||
|
||||
|
||||
var updatedEntity = await _integrationRepository.UpdateAsync(entity);
|
||||
return _objectMapper.Map<SplashIntegrationDto>(updatedEntity);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Delete)]
|
||||
public async Task DeleteAsync(EntityDto<int> input)
|
||||
{
|
||||
await _integrationRepository.DeleteAsync(input.Id);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task Activate(EntityDto<int> integration)
|
||||
{
|
||||
var entity = await _integrationRepository.GetAsync(integration.Id);
|
||||
@@ -99,6 +104,7 @@ namespace SplashPage.Integrations
|
||||
await _integrationRepository.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task DeActivate(EntityDto<int> integration)
|
||||
{
|
||||
var entity = await _integrationRepository.GetAsync(integration.Id);
|
||||
@@ -129,18 +135,19 @@ namespace SplashPage.Integrations
|
||||
return entities.Select(MapToByokDto).ToList();
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task<ByokIntegrationDto> ActivateByokIntegrationAsync(ActivateByokIntegrationDto input)
|
||||
{
|
||||
var integration = await _integrationRepository.GetAsync(input.IntegrationId);
|
||||
|
||||
|
||||
if (!integration.IsSystemPreset)
|
||||
throw new UserFriendlyException("Only BYOK integrations can be activated this way");
|
||||
|
||||
// Desactivar otras integraciones de la misma categoría (solo una activa por categoría)
|
||||
var activeIntegrationsInCategory = await _integrationRepository.GetAll()
|
||||
.Where(x => x.Category == integration.Category &&
|
||||
x.TenantId == 1 &&
|
||||
x.IsActive &&
|
||||
.Where(x => x.Category == integration.Category &&
|
||||
x.TenantId == 1 &&
|
||||
x.IsActive &&
|
||||
x.Id != integration.Id) // Excluir la actual
|
||||
.ToListAsync();
|
||||
|
||||
@@ -152,7 +159,7 @@ namespace SplashPage.Integrations
|
||||
|
||||
// Crear configuración del usuario con API key
|
||||
var userConfig = CreateUserConfiguration(integration, input);
|
||||
|
||||
|
||||
// Actualizar la integración existente (NO crear una nueva)
|
||||
integration.IsActive = true;
|
||||
integration.UserConfiguration = JsonConvert.SerializeObject(userConfig);
|
||||
@@ -162,6 +169,7 @@ namespace SplashPage.Integrations
|
||||
return MapToByokDto(updatedEntity);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Test)]
|
||||
public async Task<IntegrationConnectionTestDto> TestByokIntegrationAsync(int integrationId)
|
||||
{
|
||||
var integration = await _integrationRepository.GetAsync(integrationId);
|
||||
@@ -215,10 +223,11 @@ namespace SplashPage.Integrations
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task DeactivateByokIntegrationAsync(int integrationId)
|
||||
{
|
||||
var integration = await _integrationRepository.GetAsync(integrationId);
|
||||
|
||||
|
||||
if (!integration.IsSystemPreset)
|
||||
throw new UserFriendlyException("Only BYOK integrations can be deactivated this way");
|
||||
|
||||
@@ -233,18 +242,19 @@ namespace SplashPage.Integrations
|
||||
throw new UserFriendlyException($"Invalid category: {category}");
|
||||
|
||||
var activeIntegration = await _integrationRepository.GetAll()
|
||||
.Where(x => x.Category == category &&
|
||||
x.TenantId == 1 &&
|
||||
.Where(x => x.Category == category &&
|
||||
x.TenantId == 1 &&
|
||||
x.IsActive)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return activeIntegration != null ? MapToByokDto(activeIntegration) : null;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Integrations_Edit)]
|
||||
public async Task<ByokIntegrationDto> UpdateApiKeyAsync(ActivateByokIntegrationDto input)
|
||||
{
|
||||
var integration = await _integrationRepository.GetAsync(input.IntegrationId);
|
||||
|
||||
|
||||
if (!integration.IsSystemPreset)
|
||||
throw new UserFriendlyException("Only BYOK integrations can be updated this way");
|
||||
|
||||
@@ -253,7 +263,7 @@ namespace SplashPage.Integrations
|
||||
|
||||
// Actualizar configuración del usuario con nuevo API key
|
||||
var userConfig = CreateUserConfiguration(integration, input);
|
||||
|
||||
|
||||
integration.UserConfiguration = JsonConvert.SerializeObject(userConfig);
|
||||
integration.Configuration = JsonConvert.SerializeObject(userConfig); // Para compatibilidad
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class TenantAppService : AsyncCrudAppService<Tenant, TenantDto, int, Page
|
||||
_abpZeroDbMigrator = abpZeroDbMigrator;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Tenants_Create)]
|
||||
public override async Task<TenantDto> CreateAsync(CreateTenantDto input)
|
||||
{
|
||||
CheckCreatePermission();
|
||||
@@ -104,6 +105,19 @@ public class TenantAppService : AsyncCrudAppService<Tenant, TenantDto, int, Page
|
||||
return query.OrderBy(input.Sorting);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Tenants_Edit)]
|
||||
public override async Task<TenantDto> UpdateAsync(TenantDto input)
|
||||
{
|
||||
CheckUpdatePermission();
|
||||
|
||||
var tenant = await Repository.GetAsync(input.Id);
|
||||
MapToEntity(input, tenant);
|
||||
|
||||
await _tenantManager.UpdateAsync(tenant);
|
||||
|
||||
return MapToEntityDto(tenant);
|
||||
}
|
||||
|
||||
protected override void MapToEntity(TenantDto updateInput, Tenant entity)
|
||||
{
|
||||
// Manually mapped since TenantDto contains non-editable properties too.
|
||||
@@ -112,6 +126,7 @@ public class TenantAppService : AsyncCrudAppService<Tenant, TenantDto, int, Page
|
||||
entity.IsActive = updateInput.IsActive;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Tenants_Delete)]
|
||||
public override async Task DeleteAsync(EntityDto<int> input)
|
||||
{
|
||||
CheckDeletePermission();
|
||||
|
||||
@@ -16,8 +16,12 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Abp.Authorization;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Perzonalization
|
||||
{
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal)]
|
||||
public class CaptivePortalAppService : ApplicationService, ICaptivePortalAppService
|
||||
{
|
||||
private readonly IImageService _imageService;
|
||||
@@ -115,6 +119,7 @@ namespace SplashPage.Perzonalization
|
||||
};
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Create)]
|
||||
public async Task<SplashCaptivePortalDto> CreatePortalAsync(CreateSplashCaptivePortalDto input)
|
||||
{
|
||||
// Validate portal name (alphanumeric, hyphens, underscores only)
|
||||
@@ -167,6 +172,7 @@ namespace SplashPage.Perzonalization
|
||||
};
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task<SplashCaptivePortalDto> UpdatePortalAsync(UpdateSplashCaptivePortalDto input)
|
||||
{
|
||||
var portal = await _captivePortalRepository.GetAsync(input.Id);
|
||||
@@ -194,6 +200,7 @@ namespace SplashPage.Perzonalization
|
||||
};
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Delete)]
|
||||
public async Task DeletePortalAsync(int id)
|
||||
{
|
||||
var portal = await _captivePortalRepository.GetAsync(id);
|
||||
@@ -276,6 +283,7 @@ namespace SplashPage.Perzonalization
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task SavePortalConfigurationAsync(string portalName, CaptivePortalCfgDto configuration)
|
||||
{
|
||||
try
|
||||
@@ -674,20 +682,21 @@ namespace SplashPage.Perzonalization
|
||||
// }
|
||||
//}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task SaveConfigurationAsync(CaptivePortalCfgDto configuration, int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Info($"SaveConfigurationAsync - Portal ID: {id}, BypassType: {configuration.BypassType}");
|
||||
|
||||
|
||||
var portal = await _captivePortalRepository.GetAsync(id);
|
||||
|
||||
|
||||
// Serializar directamente el DTO - esto mantiene la arquitectura DDD correcta
|
||||
string json = JsonConvert.SerializeObject(configuration, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
|
||||
Logger.Info($"Saving configuration JSON: {json}");
|
||||
|
||||
portal.Configuration = json;
|
||||
@@ -702,6 +711,7 @@ namespace SplashPage.Perzonalization
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task<string> SelectImageAsync(string imagePath, string imageType, int id)
|
||||
{
|
||||
try
|
||||
@@ -746,6 +756,7 @@ namespace SplashPage.Perzonalization
|
||||
// await UpdateImageListsAsync(config, null);
|
||||
//}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task PublishConfigurationAsync(int Id)
|
||||
{
|
||||
try
|
||||
@@ -763,6 +774,8 @@ namespace SplashPage.Perzonalization
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task<ImageUploadResultDto> UploadImageAsync(int id, IFormFile file, string imageType)
|
||||
{
|
||||
try
|
||||
@@ -849,6 +862,7 @@ namespace SplashPage.Perzonalization
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Captive_Portal_Edit)]
|
||||
public async Task<bool> DeleteImageAsync(int id, string imagePath)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -31,6 +31,7 @@ public class RoleAppService : AsyncCrudAppService<Role, RoleDto, int, PagedRoleR
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Roles_Create)]
|
||||
public override async Task<RoleDto> CreateAsync(CreateRoleDto input)
|
||||
{
|
||||
CheckCreatePermission();
|
||||
@@ -63,6 +64,7 @@ public class RoleAppService : AsyncCrudAppService<Role, RoleDto, int, PagedRoleR
|
||||
return new ListResultDto<RoleListDto>(ObjectMapper.Map<List<RoleListDto>>(roles));
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Roles_Edit)]
|
||||
public override async Task<RoleDto> UpdateAsync(RoleDto input)
|
||||
{
|
||||
CheckUpdatePermission();
|
||||
@@ -83,6 +85,7 @@ public class RoleAppService : AsyncCrudAppService<Role, RoleDto, int, PagedRoleR
|
||||
return MapToEntityDto(role);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Roles_Delete)]
|
||||
public override async Task DeleteAsync(EntityDto<int> input)
|
||||
{
|
||||
CheckDeletePermission();
|
||||
|
||||
@@ -12,9 +12,12 @@ using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using Abp.Authorization;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Splash
|
||||
{
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards)]
|
||||
public class SplashDashboardService : SplashPageAppServiceBase, ISplashDashboardService
|
||||
{
|
||||
private readonly IRepository<SplashDashboard> _splashDashboardRepository;
|
||||
@@ -41,6 +44,7 @@ namespace SplashPage.Splash
|
||||
_networkGroupManager = networkGroupManager;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards_Create)]
|
||||
public async Task<SplashDashboard> CreateDashboard(CreateSplashDashboardDto model)
|
||||
{
|
||||
SplashDashboard splashDashboard = new()
|
||||
@@ -61,6 +65,7 @@ namespace SplashPage.Splash
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards_Edit)]
|
||||
public async Task<bool> UpdateDashboard(UpdateSplashDashboardDto model)
|
||||
{
|
||||
try
|
||||
@@ -447,6 +452,7 @@ namespace SplashPage.Splash
|
||||
return widgetsList;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards_EditLayout)]
|
||||
public async Task<bool> SaveDashboard(int dashboardId, List<SplashWidgetDto> widgets)
|
||||
{
|
||||
var _dashboard = await _splashDashboardRepository.GetAllIncluding(d => d.Widgets).FirstOrDefaultAsync(d => d.Id == dashboardId);
|
||||
@@ -520,13 +526,14 @@ namespace SplashPage.Splash
|
||||
}
|
||||
|
||||
[UnitOfWork]
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards_Edit)]
|
||||
public async Task<bool> SetDashboardNetworks(SplashDashboardDto model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (model.SelectedNetworks.IsNullOrEmpty())
|
||||
return true;
|
||||
|
||||
|
||||
var _networksCount = await _splashMerakiNetworkRepository.GetAllReadonly().CountAsync();
|
||||
var _dashboard = await _splashDashboardRepository.GetAsync(model.dashboardId);
|
||||
|
||||
@@ -567,12 +574,13 @@ namespace SplashPage.Splash
|
||||
}
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Dashboards_Edit)]
|
||||
public async Task<bool> SetDashboardNetworkGroups(SplashDashboardDto model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _dashboard = await _splashDashboardRepository.GetAsync(model.dashboardId);
|
||||
|
||||
|
||||
// Reset only groups, keep networks
|
||||
_dashboard.SelectedNetworkGroups = [];
|
||||
_splashDashboardRepository.Update(_dashboard);
|
||||
|
||||
@@ -177,6 +177,19 @@ namespace SplashPage.Splash
|
||||
TotalVisits = networkGroups.GetOrDefault(x.NetworkId)
|
||||
}).ToListAsync();
|
||||
|
||||
if (results.IsNullOrEmpty())
|
||||
{
|
||||
return connections.GroupBy(c => new { c.NetworkId, c.NetworkName })
|
||||
.Select(g => new BranchMetric(g.Key.NetworkId, g.Key.NetworkName)
|
||||
{
|
||||
TotalPersons = 0,
|
||||
Visitors = 0,
|
||||
VisitorRate = 0,
|
||||
AverageDurationMinutes = 0,
|
||||
TotalVisits = g.Count()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
// ✅ Apply ranking rules based on query
|
||||
return ApplyRankingRules(results, RankingType.ByTotalPersons);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Abp.Domain.Repositories;
|
||||
using Abp.Authorization;
|
||||
using Abp.Domain.Repositories;
|
||||
using Abp.Domain.Uow;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -53,6 +54,7 @@ namespace SplashPage.Splash
|
||||
return val;
|
||||
}
|
||||
|
||||
[AbpAllowAnonymous]
|
||||
[UnitOfWork]
|
||||
public async Task<bool> SplashPageSubmit(CreateSplashConnectionDto model)
|
||||
{
|
||||
|
||||
@@ -19,8 +19,12 @@ using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Abp.Authorization;
|
||||
using SplashPage.Authorization;
|
||||
|
||||
namespace SplashPage.Splash
|
||||
{
|
||||
[AbpAuthorize(PermissionNames.Pages_Reports_Connections)]
|
||||
public class SplashWifiConnectionReportAppService : ApplicationService, ISplashWifiConnectionReportAppService
|
||||
{
|
||||
private readonly ISplashWifiConnectionReportRepository _reportRepository;
|
||||
@@ -57,6 +61,7 @@ namespace SplashPage.Splash
|
||||
};
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Reports_Connections_Export)]
|
||||
public async Task<byte[]> ExportToCsvAsync(PagedWifiConnectionReportRequestDto input)
|
||||
{
|
||||
input.SkipCount = 0;
|
||||
|
||||
@@ -15,8 +15,11 @@ using System.Linq.Dynamic.Core;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Abp.Authorization;
|
||||
|
||||
namespace SplashPage.Splash
|
||||
{
|
||||
[AbpAuthorize]
|
||||
public class SplashWifiScanningReportAppService : ApplicationService, ISplashWifiScanningReportAppService
|
||||
{
|
||||
private readonly ISplashWifiScanningReportRepository _reportRepository;
|
||||
|
||||
@@ -52,6 +52,7 @@ public class UserAppService : AsyncCrudAppService<User, UserDto, long, PagedUser
|
||||
_logInManager = logInManager;
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Users_Create)]
|
||||
public override async Task<UserDto> CreateAsync(CreateUserDto input)
|
||||
{
|
||||
CheckCreatePermission();
|
||||
@@ -75,6 +76,7 @@ public class UserAppService : AsyncCrudAppService<User, UserDto, long, PagedUser
|
||||
return MapToEntityDto(user);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Users_Edit)]
|
||||
public override async Task<UserDto> UpdateAsync(UserDto input)
|
||||
{
|
||||
CheckUpdatePermission();
|
||||
@@ -93,8 +95,11 @@ public class UserAppService : AsyncCrudAppService<User, UserDto, long, PagedUser
|
||||
return await GetAsync(input);
|
||||
}
|
||||
|
||||
[AbpAuthorize(PermissionNames.Pages_Users_Delete)]
|
||||
public override async Task DeleteAsync(EntityDto<long> input)
|
||||
{
|
||||
CheckDeletePermission();
|
||||
|
||||
var user = await _userManager.GetUserByIdAsync(input.Id);
|
||||
await _userManager.DeleteAsync(user);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,66 @@
|
||||
|
||||
public static class PermissionNames
|
||||
{
|
||||
// Tenants
|
||||
public const string Pages_Tenants = "Pages.Tenants";
|
||||
public const string Pages_Tenants_Create = "Pages.Tenants.Create";
|
||||
public const string Pages_Tenants_Edit = "Pages.Tenants.Edit";
|
||||
public const string Pages_Tenants_Delete = "Pages.Tenants.Delete";
|
||||
|
||||
// Users
|
||||
public const string Pages_Users = "Pages.Users";
|
||||
public const string Pages_Users_Create = "Pages.Users.Create";
|
||||
public const string Pages_Users_Edit = "Pages.Users.Edit";
|
||||
public const string Pages_Users_Delete = "Pages.Users.Delete";
|
||||
public const string Pages_Users_Activation = "Pages.Users.Activation";
|
||||
|
||||
// Roles
|
||||
public const string Pages_Roles = "Pages.Roles";
|
||||
public const string Pages_Roles_Create = "Pages.Roles.Create";
|
||||
public const string Pages_Roles_Edit = "Pages.Roles.Edit";
|
||||
public const string Pages_Roles_Delete = "Pages.Roles.Delete";
|
||||
|
||||
// Captive Portal
|
||||
public const string Pages_Captive_Portal = "Pages.CP";
|
||||
|
||||
public const string Pages_Integrations = "Pages.Integrations";
|
||||
public const string Pages_Captive_Portal_Create = "Pages.CP.Create";
|
||||
public const string Pages_Captive_Portal_Edit = "Pages.CP.Edit";
|
||||
public const string Pages_Captive_Portal_Delete = "Pages.CP.Delete";
|
||||
|
||||
// Integrations
|
||||
public const string Pages_Integrations = "Pages.Integrations";
|
||||
public const string Pages_Integrations_Create = "Pages.Integrations.Create";
|
||||
public const string Pages_Integrations_Edit = "Pages.Integrations.Edit";
|
||||
public const string Pages_Integrations_Delete = "Pages.Integrations.Delete";
|
||||
public const string Pages_Integrations_Test = "Pages.Integrations.Test";
|
||||
|
||||
// Email Templates
|
||||
public const string Pages_Email_Templates = "Pages.Email.Templates";
|
||||
public const string Pages_Email_Templates_Create = "Pages.Email.Templates.Create";
|
||||
public const string Pages_Email_Templates_Edit = "Pages.Email.Templates.Edit";
|
||||
public const string Pages_Email_Templates_Delete = "Pages.Email.Templates.Delete";
|
||||
|
||||
// Scheduled Emails
|
||||
public const string Pages_Email_Scheduled = "Pages.Email.Scheduled";
|
||||
public const string Pages_Email_Scheduled_Create = "Pages.Email.Scheduled.Create";
|
||||
public const string Pages_Email_Scheduled_Edit = "Pages.Email.Scheduled.Edit";
|
||||
public const string Pages_Email_Scheduled_Delete = "Pages.Email.Scheduled.Delete";
|
||||
public const string Pages_Email_Scheduled_Send = "Pages.Email.Scheduled.Send";
|
||||
|
||||
// Reports
|
||||
public const string Pages_Reports = "Pages.Reports";
|
||||
public const string Pages_Reports_Connections = "Pages.Reports.Connections";
|
||||
public const string Pages_Reports_Connections_Export = "Pages.Reports.Connections.Export";
|
||||
public const string Pages_Reports_Scanning = "Pages.Reports.Scanning";
|
||||
public const string Pages_Reports_Scanning_Export = "Pages.Reports.Scanning.Export";
|
||||
|
||||
// Dashboards
|
||||
public const string Pages_Dashboards = "Pages.Dashboards";
|
||||
public const string Pages_Dashboards_Create = "Pages.Dashboards.Create";
|
||||
public const string Pages_Dashboards_Edit = "Pages.Dashboards.Edit";
|
||||
public const string Pages_Dashboards_EditLayout = "Pages.Dashboards.EditLayout";
|
||||
public const string Pages_Dashboards_Delete = "Pages.Dashboards.Delete";
|
||||
|
||||
// Network Groups
|
||||
public const string Pages_Administration_NetworkGroups = "Pages.Administration.NetworkGroups";
|
||||
public const string Pages_Administration_NetworkGroups_Create = "Pages.Administration.NetworkGroups.Create";
|
||||
public const string Pages_Administration_NetworkGroups_Edit = "Pages.Administration.NetworkGroups.Edit";
|
||||
|
||||
@@ -8,13 +8,64 @@ public class SplashPageAuthorizationProvider : AuthorizationProvider
|
||||
{
|
||||
public override void SetPermissions(IPermissionDefinitionContext context)
|
||||
{
|
||||
context.CreatePermission(PermissionNames.Pages_Users, L("Users"));
|
||||
context.CreatePermission(PermissionNames.Pages_Users_Activation, L("UsersActivation"));
|
||||
context.CreatePermission(PermissionNames.Pages_Roles, L("Roles"));
|
||||
context.CreatePermission(PermissionNames.Pages_Tenants, L("Tenants"), multiTenancySides: MultiTenancySides.Host);
|
||||
// Tenants permissions (Host only)
|
||||
var tenantsPermission = context.CreatePermission(PermissionNames.Pages_Tenants, L("Tenants"), multiTenancySides: MultiTenancySides.Host);
|
||||
tenantsPermission.CreateChildPermission(PermissionNames.Pages_Tenants_Create, L("CreatingTenant"));
|
||||
tenantsPermission.CreateChildPermission(PermissionNames.Pages_Tenants_Edit, L("EditingTenant"));
|
||||
tenantsPermission.CreateChildPermission(PermissionNames.Pages_Tenants_Delete, L("DeletingTenant"));
|
||||
|
||||
context.CreatePermission(PermissionNames.Pages_Captive_Portal, L("CaptivePortal"));
|
||||
context.CreatePermission(PermissionNames.Pages_Integrations, L("Integrations"));
|
||||
// Users permissions
|
||||
var usersPermission = context.CreatePermission(PermissionNames.Pages_Users, L("Users"));
|
||||
usersPermission.CreateChildPermission(PermissionNames.Pages_Users_Create, L("CreatingUser"));
|
||||
usersPermission.CreateChildPermission(PermissionNames.Pages_Users_Edit, L("EditingUser"));
|
||||
usersPermission.CreateChildPermission(PermissionNames.Pages_Users_Delete, L("DeletingUser"));
|
||||
usersPermission.CreateChildPermission(PermissionNames.Pages_Users_Activation, L("UsersActivation"));
|
||||
|
||||
// Roles permissions
|
||||
var rolesPermission = context.CreatePermission(PermissionNames.Pages_Roles, L("Roles"));
|
||||
rolesPermission.CreateChildPermission(PermissionNames.Pages_Roles_Create, L("CreatingRole"));
|
||||
rolesPermission.CreateChildPermission(PermissionNames.Pages_Roles_Edit, L("EditingRole"));
|
||||
rolesPermission.CreateChildPermission(PermissionNames.Pages_Roles_Delete, L("DeletingRole"));
|
||||
|
||||
// Captive Portal permissions
|
||||
var captivePortalPermission = context.CreatePermission(PermissionNames.Pages_Captive_Portal, L("CaptivePortal"));
|
||||
captivePortalPermission.CreateChildPermission(PermissionNames.Pages_Captive_Portal_Create, L("CreatingCaptivePortal"));
|
||||
captivePortalPermission.CreateChildPermission(PermissionNames.Pages_Captive_Portal_Edit, L("EditingCaptivePortal"));
|
||||
captivePortalPermission.CreateChildPermission(PermissionNames.Pages_Captive_Portal_Delete, L("DeletingCaptivePortal"));
|
||||
|
||||
// Integrations permissions
|
||||
var integrationsPermission = context.CreatePermission(PermissionNames.Pages_Integrations, L("Integrations"));
|
||||
integrationsPermission.CreateChildPermission(PermissionNames.Pages_Integrations_Create, L("CreatingIntegration"));
|
||||
integrationsPermission.CreateChildPermission(PermissionNames.Pages_Integrations_Edit, L("EditingIntegration"));
|
||||
integrationsPermission.CreateChildPermission(PermissionNames.Pages_Integrations_Delete, L("DeletingIntegration"));
|
||||
integrationsPermission.CreateChildPermission(PermissionNames.Pages_Integrations_Test, L("TestingIntegration"));
|
||||
|
||||
// Email Templates permissions
|
||||
var emailTemplatesPermission = context.CreatePermission(PermissionNames.Pages_Email_Templates, L("EmailTemplates"));
|
||||
emailTemplatesPermission.CreateChildPermission(PermissionNames.Pages_Email_Templates_Create, L("CreatingEmailTemplate"));
|
||||
emailTemplatesPermission.CreateChildPermission(PermissionNames.Pages_Email_Templates_Edit, L("EditingEmailTemplate"));
|
||||
emailTemplatesPermission.CreateChildPermission(PermissionNames.Pages_Email_Templates_Delete, L("DeletingEmailTemplate"));
|
||||
|
||||
// Scheduled Emails permissions
|
||||
var scheduledEmailsPermission = context.CreatePermission(PermissionNames.Pages_Email_Scheduled, L("ScheduledEmails"));
|
||||
scheduledEmailsPermission.CreateChildPermission(PermissionNames.Pages_Email_Scheduled_Create, L("CreatingScheduledEmail"));
|
||||
scheduledEmailsPermission.CreateChildPermission(PermissionNames.Pages_Email_Scheduled_Edit, L("EditingScheduledEmail"));
|
||||
scheduledEmailsPermission.CreateChildPermission(PermissionNames.Pages_Email_Scheduled_Delete, L("DeletingScheduledEmail"));
|
||||
scheduledEmailsPermission.CreateChildPermission(PermissionNames.Pages_Email_Scheduled_Send, L("SendingScheduledEmail"));
|
||||
|
||||
// Reports permissions
|
||||
var reportsPermission = context.CreatePermission(PermissionNames.Pages_Reports, L("Reports"));
|
||||
var connectionsReportPermission = reportsPermission.CreateChildPermission(PermissionNames.Pages_Reports_Connections, L("ConnectionsReport"));
|
||||
connectionsReportPermission.CreateChildPermission(PermissionNames.Pages_Reports_Connections_Export, L("ExportingConnectionsReport"));
|
||||
var scanningReportPermission = reportsPermission.CreateChildPermission(PermissionNames.Pages_Reports_Scanning, L("ScanningReport"));
|
||||
scanningReportPermission.CreateChildPermission(PermissionNames.Pages_Reports_Scanning_Export, L("ExportingScanningReport"));
|
||||
|
||||
// Dashboards permissions
|
||||
var dashboardsPermission = context.CreatePermission(PermissionNames.Pages_Dashboards, L("Dashboards"));
|
||||
dashboardsPermission.CreateChildPermission(PermissionNames.Pages_Dashboards_Create, L("CreatingDashboard"));
|
||||
dashboardsPermission.CreateChildPermission(PermissionNames.Pages_Dashboards_Edit, L("EditingDashboard"));
|
||||
dashboardsPermission.CreateChildPermission(PermissionNames.Pages_Dashboards_EditLayout, L("EditingDashboardLayout"));
|
||||
dashboardsPermission.CreateChildPermission(PermissionNames.Pages_Dashboards_Delete, L("DeletingDashboard"));
|
||||
|
||||
// Network Groups permissions
|
||||
var networkGroupsPermission = context.CreatePermission(PermissionNames.Pages_Administration_NetworkGroups, L("NetworkGroups"));
|
||||
|
||||
Reference in New Issue
Block a user