- ABP Framework version: v3.0.5
- UI type: MVC
- Tiered (MVC) or Identity Server Seperated (Angular): no
Hello,
I want to allow a website's administrator user to edit the SMTP settings, including MailKit's SecureSocketOption since it is required to connect to some email providers. While there is some documentation about customizing the Angular settings page, I can't find anything about doing the same using the MVC UI, and it's impossible to know how to do it without the source code.
Is there a way to automatically add an Email tab with the email related settings ? What about the SecureSocketOption option ? If I have to do it manyally, what are the extension moints and their documentation ?
Thank you
3 Answer(s)
-
0
See https://support.abp.io/QA/Questions/95/Setting-Definitions-UI-in-MVC-Razor-page
-
0
Thanks, that's a good start. I can get the custom page settings to show, but I can't get it to show only to users having the right permission.
Here is what I have in my settings page contributor :
public class EmailSettingsPageContributor : ISettingPageContributor { public async Task<bool> CheckPermissionsAsync(SettingPageCreationContext context) { Check.NotNull(context, nameof(context)); var permissionChecker = context.ServiceProvider.GetRequiredService<IPermissionChecker>(); var result = await permissionChecker.IsGrantedAsync(MyAppPermissions.EmailSettings.Edit); return result; } public Task ConfigureAsync(SettingPageCreationContext context) { Check.NotNull(context, nameof(context)); var localizer = context.ServiceProvider.GetRequiredService<IStringLocalizer<MyAppResource>>(); context.Groups.Add(new SettingPageGroup("emailsPageGroup", localizer["Settings:Email"], typeof(EmailSettingsViewComponent))); return Task.CompletedTask; } }
It seems
CheckPermissionsAsync
is never called, and my settings pages is always displayed. -
0
Hi Try :
public class EmailSettingsPageContributor : ISettingPageContributor { public async Task<bool> CheckPermissionsAsync(SettingPageCreationContext context) { Check.NotNull(context, nameof(context)); var permissionChecker = context.ServiceProvider.GetRequiredService<IPermissionChecker>(); var result = await permissionChecker.IsGrantedAsync(MyAppPermissions.EmailSettings.Edit); return result; } public async Task ConfigureAsync(SettingPageCreationContext context) { if (!await CheckPermissionsAsync(context)) { return; } Check.NotNull(context, nameof(context)); var localizer = context.ServiceProvider.GetRequiredService<IStringLocalizer<MyAppResource>>(); context.Groups.Add(new SettingPageGroup("emailsPageGroup", localizer["Settings:Email"], typeof(EmailSettingsViewComponent))); } }